Adln Posted May 15, 2017 Report Share Posted May 15, 2017 (edited) 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 June 13, 2017 by Adln 1 Quote Link to comment Share on other sites More sharing options...
Active Members MrGrj Posted May 15, 2017 Active Members Report Share Posted May 15, 2017 (edited) 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 May 15, 2017 by MrGrj 1 Quote Link to comment Share on other sites More sharing options...
Adln Posted May 17, 2017 Author Report Share Posted May 17, 2017 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. Quote Link to comment Share on other sites More sharing options...