Detecting open Dropbear server (#808)

* Detecting open Dropbear server

* Making code more readable

After testing it rigorously i have found that without the try and except the code doesn't work, so to improve the readability i have added some comments, also added is finally block to close the connection.

* Replaced try/except with if/else

As per the suggestions i have replaced try/except with if/else and i have ran multiple tests on my localhost to test and it is working.

* Made the code concise

I have made the suggested changes to the code to make it more concise and easy to read. I have taken time to test it and make sure it works( it does ).
This commit is contained in:
Captain-T2004 2024-03-12 04:53:45 +05:30 committed by GitHub
parent ecfcf42fb2
commit 81b842563b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -22,10 +22,14 @@ class NettackSSHLib:
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(
hostname=host,
username=usernames,
password=passwords,
port=int(ports),
timeout=int(timeout)
timeout=int(timeout),
auth_strategy=paramiko.auth_strategy.Password(
username=usernames,
password_getter=lambda:passwords
) if passwords else paramiko.auth_strategy.NoneAuth(
username=usernames
),
)
ssh.close()
return {

View File

@ -1,3 +1,4 @@
123456
password
12345678
@ -997,4 +998,4 @@ brazil
01011980
wildcat
polina
freepass
freepass