Adding more information
In this section, we'll continue adding features to our BruteForcer in order to improve detection and to facilitate filtering.
First, we're going to add the code that will detect whether there was a redirection, then we're going to add the time it took for the request response transaction and the MD5 hash of the response. Finally, we're going to test the improved script.
Currently, the requests
library returns a 200
status code for resources that follow the redirection as it is returning the status code from the last resource in the redirection chain. If we want to know whether there was a redirection, we need to check the history of requests:
- Let's go back to the Atom editor and open the file
forzaBruta-3.py
. We need to add this code in order to improve the redirection detection. - After line 48, we get the request response. This code will check whether there was a redirection and it will update the code with the first redirection code:
if r.history != []: ...