Giter VIP home page Giter VIP logo

Comments (11)

pulviscriptor avatar pulviscriptor commented on May 21, 2024

That can be for different reasons.
You say you use proxy, do you use some custom lib/agent? Lib socks in example can use only SOCKS4/SOCKS5 servers. It does not working with proxy.
Is that the case?
If not, then you need some sniffer to debug whats happening. I can recommend Microsoft Network Monitor or wireshark to see what is going there.

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

Check packets from/to SOCKS server with Microsoft Network Monitor or wireshark.
Or show packets here so i can see what is wrong.

from agario-client.

 avatar commented on May 21, 2024

Here you go

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

It says "This file is not available, because the upload was interrupted.".
*If you want to upload .pcap file, be sure that you closed all applications that can send your passwords or some important data before capturing.
Also if it is .pcap file, tell me IP of your SOCKS server that was used while capturing packets.

from agario-client.

 avatar commented on May 21, 2024

Okay let me try again, http://ge.tt/1Cwgi8U2/v/0 and the proxy ips are 121.40.34.139:3128 and 31.184.242.173:3130

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

I do not see there SOCKS IP at all. Are you sure your code is correct?
Show your createAgent() function or test it replacing with this:

function createAgent() {
    return new Socks.Agent({
            proxy: {
                ipaddress: '121.40.34.139',
                port: 3128,
                type: 5
            }}
    );
}

Replace SOCKS IP with working one, if this SOCKS is dead already.

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

I do see communications with 104.20.38.148:80 (http://m.agar.io/) and 151.80.98.51:1511 (ws://151.80.98.51:1511) without any SOCKS.
There is something wrong with code i think.
Can you show me your code?

from agario-client.

 avatar commented on May 21, 2024
var stock = ["121.40.34.139:3128", "31.184.242.173:3130"];
var http=require('http');
var Socks = require('socks');
var AgarioClient = require('./agario-client/agario-client.js');

var botnames = ["DrGoat"];

//pick a random array
function randomarray(array) {
return array[Math.floor(Math.random() * array.length)];
}

//Basic info for bot
function ExampleBot(bot_id) {
    this.bot_id      = bot_id;         //ID of bot for logging
    this.nickname    = randomarray(botnames);//default nickname
    this.verbose     = true;           //default logging enabled
    this.interval_id = 0;              //here we will store setInterval's ID
    this.server     = '';   //server address will be stored here
    this.server_key = '';   //server key will be stored here
    this.client       = new AgarioClient('Bot ' + this.bot_id); //create new client
    this.client.debug = 1; //lets set debug to 1
    this.agent = ''
}

//Uses stock5 proxy
function createAgent() {
    var dataaa = randomarray(stock).split(":")
    return new Socks.Agent({
            proxy: {
                ipaddress: (dataaa[0]),
                port: (dataaa[1]),
                type: ('5')
            }}
    );
}

var agent = createAgent();

//Options for getFFAServer
var get_server_opt = {
    region: 'EU-London', //server region
    agent:  agent        //our agent
};

//Bot AI
ExampleBot.prototype = {
    log: function(text) {
        if(this.verbose) {
            console.log(this.bot_id + ' says: ' + text);
        }
    },

    connect: function(server, key) {
        this.log('Connecting to ' + server + ' with key ' + key);
        this.server = server;
        this.server_key = key;
        this.client.connect(server, key);
        this.attachEvents();
    },

    attachEvents: function() {
        var bot = this;

        bot.client.on('connected', function() {
            bot.log('Connected, spawning');
            bot.client.spawn(bot.nickname);
            bot.interval_id = setInterval(function(){bot.recalculateTarget()}, 100);
        });

        bot.client.on('connectionError', function(e) {
            bot.log('Connection failed with reason: ' + e);
            bot.log('Server address set to: ' + bot.server + ' key ' + bot.server_key);
        });

        bot.client.once('leaderBoardUpdate', function(old, leaders) {
            var name_array = leaders.map(function(ball_id) {
                return bot.client.balls[ball_id].name || 'unnamed'
            });

            bot.log('Joined server');
        });

        bot.client.on('lostMyBalls', function() {
            bot.client.spawn(bot.nickname);
        });

        bot.client.on('reset', function() { //when client clears everything (connection lost?)
            clearInterval(bot.interval_id);
        });
    },

    recalculateTarget: function() {
        var bot = this;
        bot.client.moveTo(0, 0);
    }
};



//launching bots below

//object of bots
var bots = {
    'Alpha'  : null,
    'Bravo'  : null,
    'Charlie': null,
    'Delta'  : null,
    '1'  : null,
    '2'  : null,
    '3': null,
    '4'  : null,
    '5'   : null
};

//searching party for bots in EU-London
function start() {
    console.log('Requesting party server');
AgarioClient.servers.createParty({region: 'EU-London'}, function(srv) {
    if(!srv.server) return console.log('Failed to request server (error=' + srv.error + ', error_source=' + srv.error_source + ')');
    console.log('Engaging bots to party http://agar.io/#' + srv.key + ' on IP ' + srv.server);

    for(var bot_id in bots) {
        bots[bot_id] = new ExampleBot(bot_id);
        bots[bot_id].agent = createAgent();
        console.log('using agent ' + bots[bot_id].agent)
        bots[bot_id].connect('ws://' + srv.server, srv.key);
    }
});
}

startServer()

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

I see there few problems.

  • For every new connection you use createAgent() which uses randomarray() which returns random SOCKS server.
    So you can request server/key from one IP but connect from another and server will disconnect you immediately for that. You need to request server/key and connect from same IP, through same SOCKS.
  • For requesting server/key you do have options var get_server_opt but you do not use them at all.
  • Line 121 have AgarioClient.servers.createParty({region: 'EU-London'}, function(srv) { you did not specified agent in options here. Server/Key will be requested directly from your IP.
  • startServer() is not defined, it should be start() i think.
  • While fixing, i have crash Error: Please specify a proxy type in options.proxy.type which because of type: ('5') it should be integer type - type: 5

So after "fixes" here is "working" code

var stock = ["1.2.3.4:5678"];
var http=require('http');
var Socks = require('socks');
var AgarioClient = require('./agario-client/agario-client.js');

var botnames = ["DrGoat"];

//pick a random array
function randomarray(array) {
    return array[Math.floor(Math.random() * array.length)];
}

//Basic info for bot
function ExampleBot(bot_id) {
    this.bot_id      = bot_id;         //ID of bot for logging
    this.nickname    = randomarray(botnames);//default nickname
    this.verbose     = true;           //default logging enabled
    this.interval_id = 0;              //here we will store setInterval's ID
    this.server     = '';   //server address will be stored here
    this.server_key = '';   //server key will be stored here
    this.client       = new AgarioClient('Bot ' + this.bot_id); //create new client
    this.client.debug = 1; //lets set debug to 1
    this.agent = ''
}

//Uses stock5 proxy
function createAgent() {
    var dataaa = randomarray(stock).split(":");
    return new Socks.Agent({
            proxy: {
                ipaddress: (dataaa[0]),
                port: (dataaa[1]),
                type: 5
            }}
    );
}

var agent = createAgent();

//Options for getFFAServer
var get_server_opt = {
    region: 'EU-London', //server region
    agent:  agent        //our agent
};

//Bot AI
ExampleBot.prototype = {
    log: function(text) {
        if(this.verbose) {
            console.log(this.bot_id + ' says: ' + text);
        }
    },

    connect: function(server, key) {
        this.log('Connecting to ' + server + ' with key ' + key);
        this.server = server;
        this.server_key = key;
        this.client.connect(server, key);
        this.attachEvents();
    },

    attachEvents: function() {
        var bot = this;

        bot.client.on('connected', function() {
            bot.log('Connected, spawning');
            bot.client.spawn(bot.nickname);
            bot.interval_id = setInterval(function(){bot.recalculateTarget()}, 100);
        });

        bot.client.on('connectionError', function(e) {
            bot.log('Connection failed with reason: ' + e);
            bot.log('Server address set to: ' + bot.server + ' key ' + bot.server_key);
        });

        bot.client.once('leaderBoardUpdate', function(old, leaders) {
            var name_array = leaders.map(function(ball_id) {
                return bot.client.balls[ball_id].name || 'unnamed'
            });

            bot.log('Joined server');
            bot.log('Leaders on server:' + name_array);
        });

        bot.client.on('lostMyBalls', function() {
            bot.client.spawn(bot.nickname);
        });

        bot.client.on('reset', function() { //when client clears everything (connection lost?)
            clearInterval(bot.interval_id);
        });
    },

    recalculateTarget: function() {
        var bot = this;
        bot.client.moveTo(0, 0);
    }
};



//launching bots below

//object of bots
var bots = {
    'Alpha'  : null
};

//searching party for bots in EU-London
function start() {
    console.log('Requesting party server');
    AgarioClient.servers.createParty({region: 'EU-London', agent: createAgent()}, function(srv) {
        if(!srv.server) return console.log('Failed to request server (error=' + srv.error + ', error_source=' + srv.error_source + ')');
        console.log('Engaging bots to party http://agar.io/#' + srv.key + ' on IP ' + srv.server);

        for(var bot_id in bots) {
            bots[bot_id] = new ExampleBot(bot_id);
            bots[bot_id].agent = createAgent();
            console.log('using agent ' + bots[bot_id].agent)
            bots[bot_id].connect('ws://' + srv.server, srv.key);
        }
    });
}

start();

If you add more than one SOCKS, it will stop work. You need use same SOCKS for requesting server/key and connection. You need to fix that.
Also setup somewhere your own SOCKS server for testing because public SOCKS usually are very very unstable.
I used ssspl for that. Please be careful to not allow somebody from internet use your SOCKS

from agario-client.

 avatar commented on May 21, 2024

Thanks for the help! How would I get different ips to join the same party?

from agario-client.

pulviscriptor avatar pulviscriptor commented on May 21, 2024

How would I get different ips to join the same party?

What i can think of is modifying createAgent() like

function createAgent(socks) {
    return new Socks.Agent({
            proxy: socks
        }
    );
}

Then rewrite start to something like

function start() {
    console.log('Requesting party server');
    var socks = getNewSocksServer();
    AgarioClient.servers.createParty({region: 'EU-London', agent: createAgent(socks)}, function(srv) {
        if(!srv.server) return console.log('Failed to request server (error=' + srv.error + ', error_source=' + srv.error_source + ')');
        console.log('Engaging bots to party http://agar.io/#' + srv.key + ' on IP ' + srv.server);

        for(var bot_id in bots) {
            bots[bot_id] = new ExampleBot(bot_id);
            bots[bot_id].agent = createAgent(socks);
            console.log('using agent ' + bots[bot_id].agent)
            bots[bot_id].connect('ws://' + srv.server, srv.key);
        }
    });
}

And making getNewSocksServer() is up to you. It should return object like

            {
                ipaddress: '1.2.3.4',
                port: 567,
                type: 5
            }

Didn't tested, but i think you got the idea. You can even write socks to bots[bot_id].socks for future use if you will need it.
Oh, it may not work as it should. But you still got the idea.

from agario-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.