File size: 2,032 Bytes
58461df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const http = require('http');
const https = require('https');

/**

 * Script kiểm tra API giải captcha với Proxy

 * Hỗ trợ cả HTTP và HTTPS, tự động chọn module phù hợp

 */
async function testCaptchaWithProxy() {
    const API_URL = 'https://kinxsoftware.online/api/solve';
    const API_KEY = 'f064b7bf-8bcc-47f4-befe-1831540cffa5';
    const PROXY = 'http://zlet9i3y:oZJQ0o4V@157.10.49.215:44128';

    const postData = JSON.stringify({
        action: 'FLOW_GENERATION',
        proxy: PROXY
    });

    const url = new URL(API_URL);
    const isHttps = url.protocol === 'https:';
    const transport = isHttps ? https : http;

    const options = {
        hostname: url.hostname,
        port: url.port || (isHttps ? 443 : 80),
        path: url.pathname,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'x-api-key': API_KEY,
            'Content-Length': Buffer.byteLength(postData)
        },
        // Bỏ qua kiểm tra SSL nếu là localhost hoặc server tự cấp chứng chỉ
        rejectUnauthorized: false
    };

    console.log('--- Đang gửi yêu cầu giải captcha với Proxy ---');
    console.log('URL:', API_URL);
    console.log('Proxy:', PROXY);

    const req = transport.request(options, (res) => {
        let data = '';

        res.on('data', (chunk) => {
            data += chunk;
        });

        res.on('end', () => {
            console.log('Phản hồi từ Server:', res.statusCode);
            try {
                const jsonResponse = JSON.parse(data);
                console.log('Kết quả:', JSON.stringify(jsonResponse, null, 2));
            } catch (e) {
                console.log('Phản hồi không phải JSON:', data);
            }
        });
    });

    req.on('error', (e) => {
        console.error('Lỗi kết nối:', e.message);
    });

    req.write(postData);
    req.end();
}

testCaptchaWithProxy();