zhou12189108 commited on
Commit
ae99c61
1 Parent(s): 1473ef1

Upload 2 files

Browse files
Files changed (2) hide show
  1. api.js +41 -0
  2. package.json +20 -0
api.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const axios = require('axios');
3
+ const jwt = require('jsonwebtoken');
4
+ const vm = require('vm');
5
+ const { JSDOM } = require('jsdom');
6
+
7
+ const app = express();
8
+ app.use(express.json());
9
+
10
+ async function hsw(req, host) {
11
+ try {
12
+ const url = jwt.decode(req, { complete: true }).payload.l;
13
+ const hsw = (await axios.get(`${url}/hsw.js`)).data;
14
+ const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
15
+ const script = new vm.Script(`Object.defineProperty(navigator, "webdriver", {"get": () => false}); ${hsw}; hsw("${req}");`);
16
+ dom.window.navigator.language = 'en-US'; // Set the language to English (US)
17
+ dom.window.navigator.languages = ['en-US', 'en']
18
+ dom.window.location.host = host;
19
+ const context = vm.createContext(dom.window); // Pass the entire window object to createContext
20
+ const result = await script.runInContext(context);
21
+ return String(result);
22
+ } catch (e) {
23
+ console.error(e);
24
+ return "None";
25
+ }
26
+ }
27
+
28
+
29
+ app.post('/hsw', async (req, res) => {
30
+ const data = req.body;
31
+ const result = await hsw(data.req, data.host);
32
+ res.send(result);
33
+ });
34
+
35
+ app.get('/ping', (req, res) => {
36
+ res.send("pong");
37
+ });
38
+
39
+ app.listen(5000, '0.0.0.0', () => {
40
+ console.log('Server is running on port 5000');
41
+ });
package.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "hcaptcha-solver",
3
+ "version": "1.0.0",
4
+ "description": "proof solver",
5
+ "main": "api.js",
6
+ "scripts": {
7
+ "start": "node api.js",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Anti Bot",
11
+ "license": "GPL-3.0",
12
+ "dependencies": {
13
+ "axios": "^0.21.1",
14
+ "express": "^4.17.1",
15
+ "jsonwebtoken": "^8.5.1",
16
+ "jsdom": "^16.5.1",
17
+ "vm": "^0.1.0"
18
+ },
19
+ "private": true
20
+ }