Jump to content


Photo

Connect whole Bot via Proxy (https?)

proxy http https bot trade-bot trade-offer-manager

  • Please log in to reply
10 replies to this topic

#1 creazy

creazy

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 26 April 2018 - 12:58 PM

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



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,751 posts

Posted 26 April 2018 - 01:56 PM

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.



#3 creazy

creazy

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 26 April 2018 - 02:10 PM

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 :)



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,751 posts

Posted 26 April 2018 - 02:21 PM

I highly doubt you'll find any free proxies that work with Steam.



#5 creazy

creazy

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 26 April 2018 - 02:34 PM

I highly doubt you'll find any free proxies that work with Steam.

 

Thanks for the fast reply :) Could you recommend any service (paid) for such a project?



#6 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,751 posts

Posted 26 April 2018 - 03:40 PM

Not really, just google http proxies.



#7 creazy

creazy

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 26 April 2018 - 07:21 PM

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, 26 April 2018 - 07:22 PM.


#8 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,751 posts

Posted 27 April 2018 - 11:24 AM

It shouldn't matter if your IP keeps changing.



#9 Royalgamer06

Royalgamer06

    Advanced Member

  • Member
  • PipPipPip
  • 87 posts

Posted 08 May 2018 - 08:21 PM

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, 08 May 2018 - 08:22 PM.


#10 makcc666

makcc666

    Newbie

  • Member
  • Pip
  • 6 posts

Posted 09 May 2018 - 05:53 PM

STEAM equally bans paid and free (public) proxy. The only difference is the safety and speed of the bot



#11 Royalgamer06

Royalgamer06

    Advanced Member

  • Member
  • PipPipPip
  • 87 posts

Posted 15 May 2018 - 08:16 PM

Does anyone happen to have a proxy checker function for steam services?







Also tagged with one or more of these keywords: proxy, http, https, bot, trade-bot, trade-offer-manager

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users