Closed baidusteambot closed 11 years ago
I believe valve must have changed something. I'm having the same problem.
I am having the same problem, some other bot groups/sites's bots look to be offline too.
I'm having the same issue. All 4 of my bots are down. This is probably a steam security update that had unintended consequences.
Steam's response: "The remote server returned an error: (401) Unauthorized."
ISteamUserAuth is now private. It seems this must be unintentional; if valve wanted to stop bots entirely, why bother making bots unable to craft earlier?
On Wed, Oct 16, 2013 at 10:08 PM, wlhvoieh notifications@github.com wrote:
I'm having the same issue. All 4 of my bots are down. This is probably a steam security update that had unintended consequences.
— Reply to this email directly or view it on GitHubhttps://github.com/Jessecar96/SteamBot/issues/467#issuecomment-26474446 .
@geel9 care to explain a bit further on your findings?
Scrap.tf seems to have gotten their bots working..
http://steamcommunity.com/groups/tf2scrap#announcements/detail/1549529149431705533
Anyone have any idea when/if we can expect a commit with the fix?
All I did was utilize DoLogin() in SteamWeb.Authenticate as opposed to ISteamUserAuth.
On Thu, Oct 17, 2013 at 3:19 AM, SephirothSG notifications@github.comwrote:
Anyone have any idea when/if we can expect a commit with the fix?
— Reply to this email directly or view it on GitHubhttps://github.com/Jessecar96/SteamBot/issues/467#issuecomment-26483690 .
@geel9 hi,how to use DoLogin() ? do you have a fix
@geel9 Can you please elaborate?
Alright, it looks like there isn't enough retry logic for how most steam bots are doing web auth. The root issue is that the Steam servers are giving clients a stale LoginKey that the ISteamUserAuth API is rejecting with a 401 error.
The solution here is to request a new LoginKey on failure, and attempt to perform web auth again.
This will require building bots against SteamKit tip, as the required code has been committed now just now.
The web auth flow should now look something like this (with more error handling and whatnot):
new Callback<SteamUser.LoginKeyCallback>( OnLoginKey, callbackMgr );
new JobCallback<SteamUser.WebAPIUserNonceCallback>( OnWebAPINonce, callbackMgr );
...
static void OnLoginKey( SteamUser.LoginKeyCallback callback )
{
try
{
DoLogin( callback.LoginKey );
}
catch ( Exception ex )
{
Console.WriteLine( "Unable to perform web auth: {0}, retrying with new login key", ex.Message );
steamUser.RequestWebAPIUserNonce();
}
}
static void OnWebAPINonce( SteamUser.WebAPIUserNonceCallback callback, JobID jobId )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to get user nonce: {0}", callback.Result );
return;
}
DoLogin( callback.Nonce );
}
static void DoLogin( string loginKeyString )
{
using ( dynamic userAuth = WebAPI.GetInterface( "ISteamUserAuth" ) )
{
// ... usual web auth code
}
}
If a SteamKit update isn't feasible, you can drop this standalone class into your project: http://www.privatepaste.com/c1fd726838
And then simply register this handler during SteamKit init:
...
GameCoordinator = Client.GetHandler<SteamGameCoordinator>();
Trading = Client.GetHandler<SteamTrading>();
...
UserWebAPI = new SteamWebAPI();
Client.AddHandler( UserWebAPI );
@VoiDeD Sorry for being a hassle, but where is steamkit initialized?
Also, the standalone class should be in SteamKit.Internal namespace, right?
@Nattfrosten Depends on whatever framework you're using. If it's SteamBot, you'll probably have to wait until the maintainers update it.
Most of my comment is intended for anyone directly using SteamKit. The standalone class would be added to your own project (whatever is using SteamKit), into whatever namespace you like.
according to the code in this file https://github.com/Jessecar96/SteamBot/blob/master/SteamBot/Bot.cs
, the handlers are declared by this syntax msg.Handle<SteamUser.LoginKeyCallback>(callback => {//code});
(lambda statement, right?)
could you point out the nesseary changes need to this file, @VoiDeD ? i inserted the steamUser.RequestWebAPIUserNonce();
at the catch and stuck there... the LoginKeyCallback
is around line 350
@VoiDeD Right, thanks.
Hi, guys! I used DoLogin() like said geel9 and my bot loggined after typing SteamGuard Code, but trade not working, bot can't fetch backpack or something like this.
What I've done: In SteamWeb.cs commented this lines (without this action I recieved errors): //string capGID = loginJson == null ? null : Uri.EscapeDataString(loginJson.captcha_gid); //data.Add ("captcha_gid", captcha ? capGID : "");
In bot.cs changed
msg.Handle
Anyone have any idea?
@VoiDeD Many thanks. Was kind of irked that I started writing my own patch for SteamKit and then suddenly fix happens. But that's okay, worth it.
@Lagg How to fix it? I tried to make new callback for WebAPIUserNonceCallback but still not working. Please help me
@Lagg how u fixed?
Thanks for the assistance, Void
@geel9 Please update SteamBot :+1: I haven't find the fix yet :(
thank you guys
@VoiDeD Thanks for the info, now my bots work again.
In case anyone interested, to make bots work all you need to do is to store
callback.WebAPIUserNonce from
msg.Handle<SteamUser.LoggedOnCallback>
and use it in
SteamWeb.Authenticate
instead of callback.LoginKey.
@lazy1 Can you write what need to be changed step by step?
OK, this fix is not clean: 1) Declare public string MyLoginKey in Bot.cs 2) Add
if (callback.Result == EResult.OK)
{
MyLoginKey = callback.WebAPIUserNonce;
}
into
msg.Handle<SteamUser.LoggedOnCallback> (callback =>
{
3) In the Bot.cs replace
bool authd = SteamWeb.Authenticate(callback, SteamClient, out sessionId, out token);
with
bool authd = SteamWeb.Authenticate(callback, SteamClient, out sessionId, out token, MyLoginKey);
4) In SteamWeb.cs change definition of Authenticate appropriately to
public static bool Authenticate (SteamUser.LoginKeyCallback callback, SteamClient client, out string sessionId, out string token, string MyLoginKey)
5) Change
Array.Copy (Encoding.ASCII.GetBytes (callback.LoginKey), loginKey, callback.LoginKey.Length);
to
Array.Copy (Encoding.ASCII.GetBytes (MyLoginKey), loginKey, MyLoginKey.Length);
Do not ask for step by step instructions. It was explained a few times above. If you're using the issue tracker here you need to be able to code.
I was able to get my bots up again, thanks VoiDeD!
@lazy1 contact me at this email address please doms1337@gmail.com i'd like to thank you for helping everyone out
Surely someone should make a commit, rather than passing around bit and bobs in the issue tracker
ausey, to my knowledge, we still dont know if this is an intentional change by valve. so it wouldnt make sense to update the library if it will be changed back.
great job lazy, my bot worked with another type, but really your code do all with 50 words less i used in mine. ty
I'm not going to make the change yet in the repo. I don't know yet if it's intentional by valve.
tyvm, guys!
@lazy1 Thanks, @Jessecar96 I agree I feel like quite a shitty coder to just read what needed to be done instead of debug it myself, but thank you.
It's highly unlikely that this was an intentional change. I see no reason not to implement the proper handling in SteamBot.
Ahhhh.... This makes me confused:( It would be better with a more clear instruction
BTW thanks alot :D I will try ...
@lazy1 i followed your instruction at https://github.com/Jessecar96/SteamBot/issues/467#issuecomment-26528765 and i able to login successfully. However, when i try to invite the bot to trade and it show below messsage: "[Tradebot] is not available to trade. More information will be shown to [Tradebot] if they invite you to trade." When i try to login into the bot account and trade as usual and everything just working fine. The issue just happen when i run the account as a trade bot.
I try to send trade request form the bot and receive below warning
[TestBot 2013-10-18 18:41:32] DEBUG: SteamKit2.SteamTrading+TradeResultCallback [TestBot 2013-10-18 18:41:32] WARN: Trade failed: 25
is trade api changed too? can't add items, the json result only return "can't add items/add items failed"
@vudung45 I just followed what lazy1 did and it worked fine.
@mysecondlove @dandybreath I run a DotA bot: http://dota2lounge.com/profile?id=76561198085519752 and everything works fine for me after I made the changes recommended by lazy1. However, I've also made some changes to the code compared to the trunk so that it'd work with DotA. The recent changes to TradeSession.cs for fetching the inventory with the appid in the data don't work for me so I reverted those. Please email me at kaevne@gmail.com and I'll send you the source and you can do a windiff.
@kaevne: I'm coding dota 2 betting center 2 too Can i have your code for an example to continue?
@lazy1 I got this on two bots: TryhardBrigade.com Slots BOT: Trade declined. Could not correctly fetch your backpack. StajniaOgarow.pl GIFTS: Trade declined. Could not correctly fetch your backpack.
@lazy1 It started working :dart: Danke schön
@VoiDeD you're on github now? woa
the additem cmd didn't working yesterday but it's fine now.
Seems like the fix stopped working, at least for me. Still getting that 2 sec recconecting message
Do you think they are intentionally trying to break bots?
Still working for me
On Sat, Oct 19, 2013 at 11:50 AM, Kuba Chronowski notifications@github.comwrote:
Do you think they are intentionally trying to break bots?
— Reply to this email directly or view it on GitHubhttps://github.com/Jessecar96/SteamBot/issues/467#issuecomment-26652382 .
Mine is working as well
Maybe I touched something then. I'll download the blank project again and I'll check if it' a problem in my program Il 19/ott/2013 18:48 "Gabriel Mtz" notifications@github.com ha scritto:
Mine is working as well
— Reply to this email directly or view it on GitHubhttps://github.com/Jessecar96/SteamBot/issues/467#issuecomment-26653729 .
Authentication failed,retrying in 2s
steam changed someting? or just steam network problem?