Skip to content

Commit

Permalink
Readd functionality that key files are stored to db
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Jan 2, 2025
1 parent 7a6945a commit 23b4a23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nxc/protocols/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,17 @@ def plaintext_login(self, username, password, private_key=""):
port=self.port,
username=username,
passphrase=password if password != "" else None,
key_filename=private_key if private_key else self.args.key_file,
pkey=private_key,
key_filename=self.args.key_file,
timeout=self.args.ssh_timeout,
look_for_keys=False,
allow_agent=False,
banner_timeout=self.args.ssh_timeout,
)
# If we get the private key from the file, we need to load it into the database
if self.args.key_file:
with open(self.args.key_file) as f:
private_key = f.read().rstrip("\n")
cred_id = self.db.add_credential("key", username, password, key=private_key)
else:
self.logger.debug(f"Logging {self.host} with username: {self.username}, password: {self.password}")
Expand Down

0 comments on commit 23b4a23

Please sign in to comment.