commit
a440a83a2e
|
@ -195,9 +195,16 @@ class ssh(connection):
|
||||||
with open(self.args.key_file) as f:
|
with open(self.args.key_file) as f:
|
||||||
private_key = f.read()
|
private_key = f.read()
|
||||||
|
|
||||||
pkey = paramiko.RSAKey.from_private_key(StringIO(private_key), password)
|
pkey = paramiko.RSAKey.from_private_key(StringIO(private_key))
|
||||||
|
self.conn.connect(
|
||||||
self.conn._transport.auth_publickey(username, pkey)
|
self.host,
|
||||||
|
port=self.port,
|
||||||
|
username=username,
|
||||||
|
passphrase=password if password != "" else None,
|
||||||
|
pkey=pkey,
|
||||||
|
look_for_keys=False,
|
||||||
|
allow_agent=False,
|
||||||
|
)
|
||||||
|
|
||||||
cred_id = self.db.add_credential(
|
cred_id = self.db.add_credential(
|
||||||
"key",
|
"key",
|
||||||
|
@ -208,7 +215,14 @@ class ssh(connection):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.logger.debug(f"Logging {self.host} with username: {self.username}, password: {self.password}")
|
self.logger.debug(f"Logging {self.host} with username: {self.username}, password: {self.password}")
|
||||||
self.conn._transport.auth_password(username, password, fallback=True)
|
self.conn.connect(
|
||||||
|
self.host,
|
||||||
|
port=self.port,
|
||||||
|
username=username,
|
||||||
|
password=password,
|
||||||
|
look_for_keys=False,
|
||||||
|
allow_agent=False,
|
||||||
|
)
|
||||||
cred_id = self.db.add_credential("plaintext", username, password)
|
cred_id = self.db.add_credential("plaintext", username, password)
|
||||||
|
|
||||||
# Some IOT devices will not raise exception in self.conn._transport.auth_password / self.conn._transport.auth_publickey
|
# Some IOT devices will not raise exception in self.conn._transport.auth_password / self.conn._transport.auth_publickey
|
||||||
|
|
Loading…
Reference in New Issue