Jump to content
McKay Development

Recommended Posts

Posted

Hello,

 

I want to connect all my bots via proxy servers to give them separate IP's to connect them to steam for trading and getting users inventory.

Yesterday I tried around many hours and could not find any workings solution.

 

I end up with this code: (free proxy's to test only)

const steam = require('steam-client');
const request = require('request');
require('request-debug')(request);
const SteamUser = require('steam-user');
const SteamCommunity = require('steamcommunity');
const SteamTotp = require('steam-totp');
const TradeOfferManager = require('steam-tradeoffer-manager');

let proxyUrl = 'https://119.28.152.208:80';
let proxifiedRequest = request.defaults({'proxy': proxyUrl});

let community = new SteamCommunity({request: proxifiedRequest});
//
// let community = new SteamCommunity();

let steamclient = new steam.CMClient();
steamclient.setHttpProxy('https://119.28.152.208:80');
let client = new SteamUser(steamclient);

let manager = new TradeOfferManager({
    "community": community,
    "steam": client, // Polling every 30 seconds is fine since we get notifications from Steam
    "domain": "localhost", // Our domain is example.com
    "language": "en" // We want English item descriptions
});

steamclient.on('error', (...data) => console.log('client-error', ...data));
steamclient.on('debug', (...data) => console.log('client-debug', ...data));
// user.on('debug', (...data) => console.log('user-debug', ...data));
// user.on('error', (...data) => console.log('user-error', ...data));

// Steam logon options
let logOnOptions = {
    "accountName": config.steamAccountName,
    "password": config.steamAccountPassword,
    "twoFactorCode": SteamTotp.generateAuthCode(config.sharedSecret)
};

client.logOn(logOnOptions);

let botOnline = false;
client.on('loggedOn', function() {
    botOnline = true;
    console.log("Logged into Steam");
});

setTimeout(function () {
    if (!botOnline) {
        console.log("BOT TIMEOUT - RESTART");
        process.exit();
    }
}, 90 * 1000);

client.on('webSession', function(sessionID, cookies) {
    manager.setCookies(cookies, function(err) {
        if (err) {
            console.log("Fatal error since we couldn't get our API key");
            console.log(err);
            setTimeout(() => {
                process.exit(1);
            }, 60000);
            return;
        }

        console.log("Got API key: " + manager.apiKey);

        [........]

but if I run this script, I instantly get an error back:

error: uncaughtException: Protocol "https:" not supported. Expected "http:"
Error: Protocol "https:" not supported. Expected "http:"
    at new ClientRequest (_http_client.js:55:11)
    at Object.exports.request (http.js:31:10)
    at TCPConnection.connect (C:\xampp\htdocs\...\node_modules\steam-client\lib\tcp_connection.js:56:34)
    at _getServer (C:\xampp\htdocs\...\node_modules\steam-client\lib\cm_client.js:119:20)
    at CMClient._getServer (C:\xampp\htdocs\...\node_modules\steam-client\lib\cm_client.js:442:3)
    at CMClient.connect (C:\xampp\htdocs\...\node_modules\steam-client\lib\cm_client.js:97:7)
    at gotCMList (C:\xampp\htdocs\...\node_modules\steam-user\components\logon.js:171:17)
    at readFileCallback (C:\xampp\htdocs\...\node_modules\steam-user\components\logon.js:117:4)
    at C:\xampp\htdocs\...\node_modules\file-manager\node_modules\async\lib\async.js:52:16

the code above uses a https proxy to connect. If I use a http proxy, my console logs looks like

Starting services...
client-debug connecting to 155.133.230.34:27019
client-debug proxy timed out
client-debug socket closed
client-debug connecting to 162.254.193.7:27019

or like

client-error { Error: HTTP CONNECT 400 Bad Request
    at ClientRequest.<anonymous> (C:\xampp\htdocs\...\node_modules\steam-client\lib\tcp_connection.js:70:14)
    at emitThree (events.js:116:13)
    at ClientRequest.emit (events.js:194:7)
    at Socket.socketOnData (_http_client.js:395:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20) eresult: 35 }

Does anyone have a working example to connect bots via proxy server?

Whats wrong with my code and does it have something to do with steam's change to https in the past? (oAuth login for example which returns https now)

 

Thanks <3

Posted

HTTPS proxies are not supported, only HTTP proxies. Your 400 Bad Request is coming from the proxy, so you're probably not using the correct proxy address/port.

 

Dear Dr. McKay,

I tried many different free proxy's from an open proxy list and every time I try to start the bot it returns an "client-debug proxy timed out" or "400 Bad Request". When I try to connect my personal internet connection to the proxy, everything works fine.

But my code is ok? Should I try to buy some proxy's or do you have any source where I can try some proxy's for free before buying them?

 

Thanks :)

Posted (edited)

I found a service provides 10 IP's. If I login with this proxy I think they will give me a random IP (only US-WA). Should I look for a provider gives me static IP's or do you think its secure if I "change" the IP of the Bot every ~24 hours but stay in the same state like US-WA? Don't want to risk they ban my bots again and again [...]

 

Edit: Found 2 Free proxy's out of ~100 working with steam but switched to a free trail paid service and.. WOW.. it works :)

Edited by creazy
  • 2 weeks later...
Posted (edited)

Any idea what properties proxies should have to work well with steam? What's the difference between paid and free ones? Is steam actively blocking free/public proxies?

Edited by Royalgamer06

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...