JavaScript Proxy Bağlanma Sorunu

evans

Centipat
Katılım
25 Ağustos 2019
Mesajlar
1
Arkadaşlar merhaba. Günlerdir uğraştığım bir kod var atayım belki yardım edebilecek insanlar olur diye yazıyorum. Kısaca eski bir "pixelzone. İo" oyununa ait proxy kullanan otomatik "pixel koymaya" yarayan bir botum var. Fakat proxylere bağlanamıyorum ve aynen şöyle konsolda takılı kalıyorum:



Kodu buyrun:

JavaScript:
maxBots = 20;
botPerProxy = 1;
var Client = require('./pzCli.js')
var SocksProxyAgent = require('socks-proxy-agent');
var fs = require('fs');
botss = [];
proxyList = fs.readFileSync("proxy.txt").toString().split("\n");
proxyList.forEach(function(proxy, index) {
    for (var i = 0; i < botPerProxy; i++) {
        b = new Client()
        b.index = index * botPerProxy + i;
        b.agent = new SocksProxyAgent("socks://" + proxy);
        b.connect();
    }
})

console.log("oc")

var WebSocket = require('ws');

var wss = new WebSocket.Server({
    port: 8080
});

wss.on('connection', function(ws) {
    ws.on('message', function(message) {
        var buf = new Uint8Array(message).buffer;
        var dv = new DataView(buf);
        x = dv.getInt16(0, true)
        y = dv.getInt16(2, true)
        color = dv.getUint8(4, true)
        function paint(bot) {
            if (bot.socket.connected) {
                bot.updatePixel(x, y, color)
            } else {
                paint(botss.sort(function() {
                    return 0.5 - Math.random()
                })[0])
            }
        }
        paint(botss.sort(function() {
            return 0.5 - Math.random()
        })[0])
    });
});

pzCli dosyamın kodları:

JavaScript:
var io = require('socket.io-client');

function Client() {
    // chunks
    this.headers = { //headers for WebSocket connection.
        'Origin': 'http://pixelzone.io'
    };
}

Client.prototype = {
    connect: function() {
        var opt = {
            headers: this.headers
        };
        if (this.agent) opt.agent = this.agent;
        if (this.local_address) opt.localAddress = this.local_address;

        this.socket = new io("ws://pixelzone.io:80", opt);
        this.socket.on("connect", this.onConnect.bind(this))
        this.socket.on("disconnect", this.onDisconnect.bind(this))
        this.socket.on('captchaTest', function() {
            this.disconnect();
        });

    },
    disconnect: function() {
        if (!this.socket) {
            return false;
        }
        this.socket.close();
        return true;
    },
    onConnect: function() {
        console.log("Connected! (" + this.index + ")");
        this.lastCheck = Date.now()
        botss[this.index] = this
    },
    onDisconnect: function() {
        console.log("Disconnected (" + this.index + ")");
        delete botss[this.index]
    },
    updatePixel: function(x, y, color) {
        if (Date.now() - this.lastCheck > 4000) {
            console.log("Painted: " + x + " " + y + " From: " + this.index)
            this.lastCheck = Date.now()
            this.socket.emit('placePixel', {
                x: x + 4096,
                y: y + 4096,
                val: color
            });
        }
    }
}

module.exports = Client;

Eğer gerçekten yardım etmek isteyen olursa bana ulaşırsa sevinirim.
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…