KarlJorgensen / virgin-media-hub3

Python API and command line interface to the Virgin Media Hub 3 broadband router
GNU General Public License v3.0
77 stars 18 forks source link

Strip padding from base64 encoded login arg param #2

Closed thejsa closed 5 years ago

thejsa commented 5 years ago

Fixes issues when the login arg param, when encoded, ends with an equals sign. (Base64 pads encoded strings such that there are always four bytes for every three source bytes.)

The equals sign is automatically urlencoded somewhere down the line to %3D (maybe by requests or urllib3), which would be fine if Arris's firmware could handle something as simple as standard urlencoding, but it can't...

Luckily, their base64 decoder is tolerant of encoded strings without the padding, so rather than find a way to pass the arg parameter 'raw', we can just strip the padding from the base64-encoded string and login succeeds.

KarlJorgensen commented 5 years ago

Looks like somebody else came up with a neater solution to that problem - so I chose that one instead.

No offence :-)

I'm glad that somebody else is using this - please feel free to raise issues here on github if you find issues or have ideas for ways of extending it - input from others is very much valued :-)

thejsa commented 5 years ago

No probs, the other solution certainly does seem neater, I hadn’t thought about trying that (: