mxrch / HackTheBot

A Discord Bot in Python for Hack The Box members.
Mozilla Public License 2.0
40 stars 11 forks source link

Verify don't work #4

Closed psyray closed 3 years ago

psyray commented 3 years ago

Hi,

Thanks for your bot, it's working really well. I had to find the config structure from your code (a doc in the README could be really good) My config structure is


HTB = {
    "email": "no@email.com",
    "password": "mysuperpassword",
    "api_token": "myHTBapitoken",
    "writeup_legit" : False,
}

discord = {
    "bot_token": "myDiscordbottoken",
    "guild_name": "my guild name",
}

options = {
    "writeup_legit": False,
}

emojis = {
    "linux": "",
    "windows": "️",
}

My problem is that when I launch the verify command with my HTB account id, nothing is returned. I have debug the python script, and the line below never finish, so script is blocked and the only way to stop is to kill it. https://github.com/mxrch/HackTheBot/blob/2b22baf285a213625bb416ff5d9dc1939277c8f8/lib/htb.py#L297 If I call this URL with the account identifier in a browser, a correct JSON is returned.

Do you have an idea ?

mxrch commented 3 years ago

Hi, I'm sorry but I don't know if I can help you. The code is old and bad, HTB changed their interface (even the old with small details) so the scraping is broken, now they have a working API, you shouldn't be using this bot anymore. :/ Maybe one day I'll redo one with the new API.

psyray commented 3 years ago

This one ? https://github.com/Propolisa/htb-api-docs

psyray commented 3 years ago

This guy is working on a Node.js bot https://github.com/Propolisa/Seven But it's not working at this time

mxrch commented 3 years ago

This one ? https://github.com/Propolisa/htb-api-docs

Exactly

psyray commented 3 years ago

OK i've found the problem. User agent header is not good. Request finisehd with this one Mozilla/5.0 (X11; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0 Change it to line 24 https://github.com/mxrch/HackTheBot/blob/2b22baf285a213625bb416ff5d9dc1939277c8f8/lib/htb.py#L24