Skip to content

Commit e3341eb

Browse files
committed
Changing so that it's keyfile only auth. Will make it bidirectional in a future PR.
1 parent 7fde431 commit e3341eb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

‎src/hackingBuddyGPT/capabilities/ssh_test_credential.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import paramiko
55

66
from hackingBuddyGPT.utils import SSHConnection
7-
from .capability import Capability
7+
from hackingBuddyGPT.capabilities import Capability
88

99

1010
@dataclass
@@ -17,8 +17,8 @@ def describe(self) -> str:
1717
def get_name(self):
1818
return "test_credential"
1919

20-
def __call__(self, username: str, password: str) -> Tuple[str, bool]:
21-
test_conn = self.conn.new_with(username=username, password=password)
20+
def __call__(self, username: str, keyfilename: str, ) -> Tuple[str, bool]:
21+
test_conn = self.conn.new_with(username=username, keyfilename=keyfilename)
2222
try:
2323
test_conn.init()
2424
user = test_conn.run("whoami")[0].strip('\n\r ')

‎src/hackingBuddyGPT/cli/stats.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import argparse
44

5-
from utils.db_storage import DbStorage
5+
from hackingBuddyGPT.utils.db_storage import DbStorage
66
from rich.console import Console
77
from rich.table import Table
88

‎src/hackingBuddyGPT/utils/ssh_connection/ssh_connection.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ class SSHConnection:
1212
host: str
1313
hostname: str
1414
username: str
15-
password: str
16-
port: int = 22
1715
keyfilename: str
16+
port: int = 22
17+
1818

1919
_conn: Connection = None
2020

2121
def init(self):
2222
# create the SSH Connection
2323
conn = Connection(
2424
f"{self.username}@{self.host}:{self.port}",
25-
connect_kwargs={"password": self.password, "key_filename": self.keyfilename, "allow_agent": False},
25+
connect_kwargs={ "key_filename": self.keyfilename, "allow_agent": False},
2626
)
2727
self._conn = conn
2828
self._conn.open()
2929

30-
def new_with(self, *, host=None, hostname=None, username=None, password=None, port=None, keyfilename=None) -> "SSHConnection":
30+
def new_with(self, *, host=None, hostname=None, username=None, keyfilename=None, port=None) -> "SSHConnection":
3131
return SSHConnection(
3232
host=host or self.host,
3333
hostname=hostname or self.hostname,
3434
username=username or self.username,
35-
password=password or self.password,
35+
keyfilename=keyfilename or self.keyfilename,
3636
port=port or self.port,
37-
keyfilename=keyfilename or self.keyfilename
37+
3838
)
3939

4040
def run(self, cmd, *args, **kwargs) -> Tuple[str, str, int]:

0 commit comments

Comments
 (0)