rmmh / skybot

Python IRC bot
https://github.com/rmmh/skybot/wiki
The Unlicense
247 stars 169 forks source link

Google Translate plugin without API Key access #197

Closed imnotjames closed 5 years ago

imnotjames commented 5 years ago

this updates the google translate plugin to work the same as the web application through a little bit of reverse engineering the javascript.

the way this works is that we first retrieve an initialization vector from translate.google.com, and then create a signature token by signing the text inputs.

the original javascript for all of this was obfuscated before rewriting it some in python.

imnotjames commented 5 years ago

So we've been running this for a little while and playing with it.

Haven't found any issues yet... but I'll be honest: I'm not entirely certain what the intent of some of the code is other than to create a signature in a very specific way.

Where I felt I understood the intent of the variables, I renamed them as such, but otherwise I left them alone.

rmmh commented 5 years ago

Wow, this is pretty gnarly reverse engineering. Can you add some error handling for when this inevitably breaks?

imnotjames commented 5 years ago

When it breaks we'll get a 403 and it'll get caught by the except - and you'll get an error message.

What other error handling should be added?

imnotjames commented 5 years ago

And yes, I agree, very gnarly. :D but it's free and works great for our use case.