diff --git a/connect.py b/connect.py index 3a39fe0..de1b7dc 100644 --- a/connect.py +++ b/connect.py @@ -39,6 +39,7 @@ print("device_name =", gw.device_name) print("rom_version = {} {}".format(gw.rom_version, gw.rom_channel)) print("mac = {}".format(gw.mac_address)) +gw.ssh_port = 122 if gw.ping(verbose = 0) is True: die(0, "Exploit already installed and running") @@ -140,7 +141,7 @@ if (fn_payload3): time.sleep(1) if gw.use_ssh: - print("Running SSH server on port 122...") + print("Running SSH server on port {}...".format(gw.ssh_port)) else: print("Running TELNET and FTP servers...") diff --git a/gateway.py b/gateway.py index 5a1cb28..cfc5ffb 100644 --- a/gateway.py +++ b/gateway.py @@ -66,13 +66,14 @@ class Gateway(): ftp = None socket = None # TCP socket for SSH ssh = None # SSH session - ssh_port = 122 def __init__(self, timeout = 4, verbose = 2, detect_device = True): self.verbose = verbose self.timeout = timeout self.config['device_ip_addr'] = None self.load_config() + if not 'ssh_port' in self.config: + self.config['ssh_port'] = 22 # SSH default port self.device_name = None self.webpassword = None self.status = -2 @@ -194,6 +195,15 @@ class Gateway(): def ip_addr(self, value): self.config['device_ip_addr'] = value + @property + def ssh_port(self): + return self.config['ssh_port'] + + @ssh_port.setter + def ssh_port(self, value): + self.config['ssh_port'] = value + self.save_config() + def load_config(self): self.config = {} with open('config.txt', 'r') as file: