lukleh / TwistedBot

bot and proxy for Minecraft
Other
24 stars 9 forks source link

Failed to verify username #7

Closed scottie closed 11 years ago

scottie commented 11 years ago

Love what you are doing.

I have proxy pointed to a live online server and the bot is pointed to the proxy. It connects but i get the failed to verify username error, i get this even if i set the option --username to my username or without the option.

Running on linux.

Command to start bot: python bot.py --botemail user@gmail.com --botpass mypassword --log2file --serverhost localhost --serverport 1338 --botname MYNAME --use_encryption

Command to start proxy: python proxy.py --serverhost SERVERIP --serverport 25565 --log2file --proxyport 1338

Bot: 03:22:19.982493 [CORE EVENT] Server kicked me out with message: Failed to verify username! 03:22:19.982831 [WORLD] Shutdown

Proxy: 03:22:19.151932 [SERVER] Starting encryption 03:22:19.152027 [CLIENT] Starting encryption 03:22:19.152735 [CLIENT] id 205 client statuses status: 0 03:22:19.981817 [SERVER] id 255 disconnect/kick message: Failed to verify username! 03:22:19.984072 [CLIENT] Lost connection from client: Connection was closed cleanly.

What can do, not really sure how to move on or how to fix this. Im sure everything is correct in the command line im using to load both applications. Is this common?

edit:

To clarify, i can connect to the server normally without the message using both normal and custom clients. My accounts are paid online accounts.

lukleh commented 11 years ago

Thanks :)

The bot is running by default in offline mode, so you need to use --onlinemode argument. this implies --use_encryption so you can use it instead of it.

I need to rewrite the readme to make things more clear. if you have an idea what can be written better I would be happy for pull request (or at least suggestion)

scottie commented 11 years ago

sorry to leave that out of the command i posted, i also did try that, to verify i just did try again.

"14:14:18.403985 [CORE EVENT] Server kicked me out with message: Failed to verify username!"

Honestly it was clear in the readme, i just forgot to mention in initial post i did try it with that :(

command i just tried: python bot.py --botemail blahblah@gmail.com --botpass PASSWORD --log2file --serverhost localhost --serverport 1338 --botname consolecowboy --onlinemode

response: 14:16:58.462782 [CORE EVENT] USE_ENCRYPTION is True, doing encryption. 14:16:58.465519 [PROTOCOL] doing online authentication 14:16:59.204151 [PROTOCOL] responce from http://session.minecraft.net: OK 14:16:59.818661 [CORE EVENT] Server kicked me out with message: Failed to verify username! 14:16:59.833410 [WORLD] Shutdown

lukleh commented 11 years ago

Ok, I think I got it. One has to also specify --botname, which is the name associated with your online account. That is confusing, because in official client you just use you email.

Long story short, I've change the code to take the username from login.minecraft response so one does not need to use --botname in online mode.

commit soon

lukleh commented 11 years ago

fix commited

scottie commented 11 years ago

I will clone new code thanks kindly, i did use --botname in my startup command that was what my username is (consolecowboy), so im still confused maybe i was using what i thought my username was but maybe my username is something different on mojang. Sounds like a good code change anyway to be honest.

scottie commented 11 years ago

hmm no im getting the exact same problem, still confused i didnt think i was doing anything wrong in the original post, but still that code change you did recently was probably for the best in the long run anyway, but i still seem to be getting the same problem.

:(

Client: 18:33:49.749931 [PROTOCOL] doing online authentication 18:33:50.656667 [PROTOCOL] responce from http://session.minecraft.net: OK 18:33:57.941630 [CORE EVENT] Server kicked me out with message: Failed to verify username! 18:33:57.942027 [WORLD] Shutdown

Proxy: 18:36:06.553754 [CLIENT] id 205 client statuses status: 0 18:36:09.719521 [SERVER] id 255 disconnect/kick message: Failed to verify username! 18:36:09.757598 [CLIENT] Lost connection from client: Connection was closed cleanly.

command used: python bot.py --botemail EMAIL --botpass PASSWORD --log2file --serverhost localhost --serverport 6969 --onlinemode

I have proxy running also, this command points to the mc proxy, and proxy points to the server i want to connect to. (i removed --botname as per your update)

lukleh commented 11 years ago

true...

i tested it with online server and python bot.py --onlinemode --botemail EMAIL --botpass PASS and it works, so hard to say what is going wrong

try to post the whole log

lukleh commented 11 years ago

get the latest code (https://github.com/lukleh/TwistedBot/commit/4701ab60a80aaa3783ab33a5fe976a23c109901d) , run it and post the log please

scottie commented 11 years ago

No worrys,

here are the logs. running with latest snapshot

lukleh commented 11 years ago

and one question that I did not (and should) ask, does the bot run on the server without the proxy? and what proxy are you using?

lukleh commented 11 years ago

you are using my proxy! :D

well that explains.... I did not implemented proxy for online mode and from what I know it is not even possible (or at least hard). I intended the proxy just for debugging packet sequences and other developer stuff

scottie commented 11 years ago

ok it works without the proxy, i was using the proxy that came with the bot. LOL, so sorry to waist your time, i intended to write a plugin or at least play with the pathing see if i can get it do do something usefull like farm, etc, i code in python so was hoping to use the proxy to see the packet dumps but i can just use that on offline mode to get the information i need.

Thanks again, Hopefully i can help out :)

wtfaremyinitials commented 11 years ago

If you still want to know, I know why you can't connect to an onlinemode server with a proxy.

lukleh commented 11 years ago

sure, post it!

SnoFox commented 11 years ago

And now we all wait on @wtfaremyinitials's post ... I was about to start using the proxy on an online, production mode server to look for oddities in our plugins, but if it doesn't work on online mode, that's ... Unfortunate.

lukleh commented 11 years ago

If there is demand on that I can try to investigate further.

wtfaremyinitials commented 11 years ago

First off sorry it took me so long to get back to you.... I have bene extremely busy. Anyway the reason the proxy doesn't work is that when a minecraft client wants to connect to an online mode server it sends the servers address along with a few other things up to the minecraft session servers. The issue is that if you are connecting to "localhost:25566" you send that to mojang instead of whatever the proxy is sending your connection to. As a result of that when the end server makes a request to the minecraft session servers asking if the user trying to connect is a vaild user, they don't get anything because your client never tells the minecraft session servers what the end server is. If that didn't make any sense, I'd be happy to try to re-word it.

SnoFox commented 11 years ago

It looks like the solution (that doesn't involve client mods) is to login, then fire up the proxy and have the proxy login to Mojang again. On connect, the proxy should send to Mojang "I'm SnoFox and I'm connecting to mc.example.com:25565" (even though the real client is connecting to localhost:25565).

wtfaremyinitials commented 11 years ago

Exactly.

lukleh commented 11 years ago

Ok, so do we have a reproducible and tested solution? Even partial for now....

wtfaremyinitials commented 11 years ago

Not written, no. But I can throw a beta version together later if needed.

lukleh commented 11 years ago

Sure, anything that helps.