Skip to content

Commit 6dcc1b4

Browse files
author
Michael Woolweaver
authored
properly close ssh connection after successful connection
1 parent 67b84d8 commit 6dcc1b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ethical-hacking/bruteforce-ssh/bruteforce_ssh.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def is_ssh_open(hostname, username, password):
3434
else:
3535
# connection was established successfully
3636
print(f"{GREEN}[+] Found combo:\n\tHOSTNAME: {hostname}\n\tUSERNAME: {username}\n\tPASSWORD: {password}{RESET}")
37+
client.close()
3738
return True
3839

3940

@@ -56,4 +57,4 @@ def is_ssh_open(hostname, username, password):
5657
if is_ssh_open(host, user, password):
5758
# if combo is valid, save it to a file
5859
open("credentials.txt", "w").write(f"{user}@{host}:{password}")
59-
break
60+
break

0 commit comments

Comments
 (0)