Skip to content

Commit 65030d7

Browse files
Merge pull request Pennyw0rth#313 from Pennyw0rth/neff-fix-ssh
Handle paramiko error when bruteforcing
2 parents 198f8f8 + d2760dc commit 65030d7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

nxc/protocols/ssh.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ def plaintext_login(self, username, password, private_key=""):
195195
username=username,
196196
passphrase=password if password != "" else None,
197197
key_filename=private_key if private_key else self.args.key_file,
198+
timeout=self.args.ssh_timeout,
198199
look_for_keys=False,
199200
allow_agent=False,
201+
banner_timeout=self.args.ssh_timeout,
200202
)
201203

202204
cred_id = self.db.add_credential(
@@ -213,8 +215,10 @@ def plaintext_login(self, username, password, private_key=""):
213215
port=self.port,
214216
username=username,
215217
password=password,
218+
timeout=self.args.ssh_timeout,
216219
look_for_keys=False,
217220
allow_agent=False,
221+
banner_timeout=self.args.ssh_timeout,
218222
)
219223
cred_id = self.db.add_credential("plaintext", username, password)
220224

@@ -226,6 +230,8 @@ def plaintext_login(self, username, password, private_key=""):
226230
except SSHException as e:
227231
if "Invalid key" in str(e):
228232
self.logger.fail(f"{username}:{process_secret(password)} Could not decrypt private key, error: {e}")
233+
if "Error reading SSH protocol banner" in str(e):
234+
self.logger.error(f"Internal Paramiko error for {username}:{process_secret(password)}, {e}")
229235
else:
230236
self.logger.exception(e)
231237
except Exception as e:

0 commit comments

Comments
 (0)