• 🌙 Community Spirit

    Ramadan Mubarak! To honor this month, Crax has paused NSFW categories. Wishing you peace and growth!

Bruteforce web login with python (1 Viewer)

Currently reading:
 Bruteforce web login with python (1 Viewer)

Recently searched:

dax050

Member
LV
0
Joined
Sep 23, 2023
Threads
10
Likes
3
Awards
2
Credits
463©
Cash
0$
Welcome, in this article I am going to show you how I programmed my Python script to make brute force attacks to web logins using the post method, I will also show you how to use it and some of the best features of the program (bypass IP block,add headers,add data…) I hope you like it!

The script that you will see in this article available in my Github with this link:
https://github.com/S12cybersecurity...-62b89b01fd0b--------------------------------

Features
  • Find Password
  • Bypass IP Block
  • Connect with Proxy
  • Add Headers and Data
  • Filter By Error Text Answer

Find Password​

This is going to be the bulk of the article, this is where I’m going to show how they work and a few small code snippets in case someone wants to create something similar.

First of all, how does it work?

The most important part for this script to work is comparing the size of the response from the server when we send it incorrect credentials.

Here the script does is to send a request with a totally random username and password to see how the web responds to incorrect credentials.

Code:

First Web Petition:

1640xoRdLy0Fk6YoELV6XDg

Userfile and passwordfile represents userfield and passwordfield… Sorry

Second Web Petition and Comparison:

In this part the script starts to send web requests in a loop changing the password it tries for the user you have decided to attack, then it compares the length of the answers of the first request that we used incorrect credentials with the new requests you make, with this you get that when it answers 10 bytes of different answers (to avoid false positives) the script will report you that it has found the password.

14KMB8ieboQhWkbjJnk2fnw

But in addition to this it has some details that make it a very flexible tool, the first it’s the IP Block Bypass via Headers.

Bypass IP Block​

Perfect, this part is a big difference to the great majority of scripts known so far, in my tool I have added to each request a series of headers with which you can bypass the IP Rate Limit Block, these headers are the following:

  • X-Forwarded-For
  • X-Originating-IP
  • X-Remote-IP
  • X-Remote-Addr
Not only have I added these headers, I have also created a series of very basic regular expressions with which each time a web request is sent, it is sent with a different IP in the headers, so the web thinks that each request comes from a different machine.

Code:

Regular Expresions:

1fSqTLE8e8a4j6c Ao4FT7g

Headers:

1o5EKBTM PYOUGRBJJH lUw

Result with Burpsuite:

1N2Bpw6aHwgjJ5OT0qJ1GSw

Connect with Proxy​

Sometimes you need to see what request you are sending and exactly how and what the server responds, for this I always use the Burpsuite proxy, but you can use any other, just add the -proxy option to the command and indicate the proxy address, now an example:

Command:

python3 bruteforce.py --url victim_url -user user -wordlist wordlist -proxy url_proxy
Result:

1FZ5 QspvBt6MgdYhtX1URw

Burpsuite:

1 3qKa7NAlvGv yPGOR1nSQ

Add headers and Data​

One of the most important new features of the tool is the possibility to add headers or data to your requests, you can add up to two headers or two parameters and you can quickly see how it works with the possibility to add a proxy.
One important thing to say is that the format has to be the following:

  • -data “parameter”:”value”
  • -data “parameter1”:”value”,”parameter2”:”value”
  • -headers “parameter”:”value”
  • -headers “parameter1”:”value”,”parameter2”:”value”
Examples:

Command:

python3 bruteforce.py --url victim_url -user user -wordlist wordlist -proxy url_proxy -headers "Testing":"Headers" -data "testing":"data"
Result:

1G89f Tyne7k T ItNroSMg

Filter by Error Message Response​

Another interesting option is the option to add the error message that you get if the password, when a request responds without that error message will mean that it is the correct password.

Code:

1*j38ikMdMh6VV15vM4_HVcg.png
 
  • Like
Reactions: fognayerku

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Recently searched:

Similar threads

Users who are viewing this thread

Top Bottom