Jump to content
Adln

Simple HTTP Brute Force/ Dictionary attack program

Recommended Posts

Salut,

 

Cu scopul de a invata si exersa un pic de Python, am facut un programel pentru Brute Force/ Dictionary attack. Proietul se gaseste la https://github.com/lucadln/http-brute-force .

 

Cateva idei despre cum functioneste:

- pentru a face un request se poate rula o comanda simpla ca "  python main.py --url 'http://localhost'  "

- pentru a face un brute force trebuie definita o variabila ${brutus}. Ca exemplu, pentru a gasi o pagina din localhost se poate rula comanda " python main.py --url 'http://localhost/${brutus}' ". In cazul asta programelul o sa faca requesturi consecutive unde ${brutus} o sa fie inlocuit cu cate o valoare din charset-ul dat. (default 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789', lungimea minima a string-ului: 1, lungimea maxima de 5 - valorile default se pot schimba cu ajutorul argumentului --rules). Variabila ${brutus} poate fi definita si in headers sau in payload.

- pentru a face un dictionary attack se specifica argumentul --type 'dictionary'. Exemplu: " python main.py --url 'http://localhost/login' --payload '$arg username : admin $arg password : ${brutus}' --type 'dictionary' ". O comanda de genul va folosi un fisier default pentru dictionary attack. Pentru folosirea unui fisier diferit se poate adauga argumentul --source. Exemplu: " --source '..\..\myDict.txt' "

- pentru a seta cand sa se opreasca brute force-ul se poate folosi argumentul --end cu valoarea 'subiect verb locatie'. Exemplu: " --end 'this text in body' " va opri brute force-ul cand 'this text' se va regasi in raspunsul vreunui  request. Sau " --end 'Location:http://localhost/cherry in headers' " va opri brute force-ul cand 'Location:http://localhost/cherry' se va regasi in response headers. Sau "--end '404 not in status' " va opri brute force-ul cand response code-ul va fi diferit de 404.

- ... plus cateva optiuni pentru logare, pentru automatic redirects si timeout.  

 

Orice sugestie e binevenita, iar daca cineva vrea sa il foloseasca si nu reuseste pot sa incerc sa il ajut. 

Edited by Adln
  • Upvote 1
Link to comment
Share on other sites

  • Active Members

In loc sa scrii tot alfabetu' + digits ai:

>>> import string
>>> string.ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> string.ascii_uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> string.digits
'0123456789'
>>> print("{}{}{}".format(string.ascii_lowercase, string.ascii_uppercase, string.digits))
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Backslash-urile alea cand faci wrap la linii sunt super enervante. Recomand:

 

_str = """
string
lung
aici
"""

Foloseste:

 

x = 'alex'
y = 'vasile'

print("{} si {} sunt gay".format(x, y))

In loc de %i, %s, %d plm.

 

In loc sa iti faci propriul modul pentru logging, poti sa folosesti modulul logging:

 

import logging

logger = logging.getLogger(__file__)
# etc...

Mai multe detalii despre logging aici

Edited by MrGrj
  • Upvote 1
Link to comment
Share on other sites

On 5/15/2017 at 9:10 PM, MrGrj said:

In loc sa scrii tot alfabetu' + digits ai:


>>> import string
>>> string.ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> string.ascii_uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> string.digits
'0123456789'
>>> print("{}{}{}".format(string.ascii_lowercase, string.ascii_uppercase, string.digits))
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Backslash-urile alea cand faci wrap la linii sunt super enervante. Recomand:

 


_str = """
string
lung
aici
"""

Foloseste:

 


x = 'alex'
y = 'vasile'

print("{} si {} sunt gay".format(x, y))

In loc de %i, %s, %d plm.

 

In loc sa iti faci propriul modul pentru logging, poti sa folosesti modulul logging:

 


import logging

logger = logging.getLogger(__file__)
# etc...

Mai multe detalii despre logging aici

Mersi fain, o să adaug și modificările astea :) De partea cu logging-ul eram conștient și când am făcut progrămelul, dar fiind începător nu știam ce și cum și am zis să mă concentrez pe chestiile super basic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...