I recently started experimenting with Hydra to try and crack my router's password and I'm having a problem.
Here's what I did: My router uses form-based HTTP POST authentication. After examining the network traffic, I noticed that the only POST parameter sent by the browser upon submitting the form was 'response' and its value seemed to be a random combination of 32 alphanumeric characters (no username is needed; just a password). I examined the router's webpage source code and it turned out that it uses JavaScript to encode the password. It joins the password with a string (I'm going to refer to it as a 'token') by a dash after running the password through an MD5 hashing algorithm. The token is different every time I try to log in. The result is then set as the value for the form field 'response'. I downloaded the JS code that does the hashing and was able to replicate the process with nodejs so that the output can be written to the console.
So far so good. The only problem is that I need to look for the token in the HTML source code. I need to find a way to make Hydra retrieve this token automatically.
In other words: is there a way I can automate Hydra to execute the following steps before doing the POST request:
- Get the login page with a GET request.
- Find the token. (with regular expressions maybe?)