Add in config.txt new param "ssh_port"

pull/3/head
remittor 3 years ago
parent c9a4a6d8cd
commit 696dd705d5

@ -39,6 +39,7 @@ print("device_name =", gw.device_name)
print("rom_version = {} {}".format(gw.rom_version, gw.rom_channel)) print("rom_version = {} {}".format(gw.rom_version, gw.rom_channel))
print("mac = {}".format(gw.mac_address)) print("mac = {}".format(gw.mac_address))
gw.ssh_port = 122
if gw.ping(verbose = 0) is True: if gw.ping(verbose = 0) is True:
die(0, "Exploit already installed and running") die(0, "Exploit already installed and running")
@ -140,7 +141,7 @@ if (fn_payload3):
time.sleep(1) time.sleep(1)
if gw.use_ssh: if gw.use_ssh:
print("Running SSH server on port 122...") print("Running SSH server on port {}...".format(gw.ssh_port))
else: else:
print("Running TELNET and FTP servers...") print("Running TELNET and FTP servers...")

@ -66,13 +66,14 @@ class Gateway():
ftp = None ftp = None
socket = None # TCP socket for SSH socket = None # TCP socket for SSH
ssh = None # SSH session ssh = None # SSH session
ssh_port = 122
def __init__(self, timeout = 4, verbose = 2, detect_device = True): def __init__(self, timeout = 4, verbose = 2, detect_device = True):
self.verbose = verbose self.verbose = verbose
self.timeout = timeout self.timeout = timeout
self.config['device_ip_addr'] = None self.config['device_ip_addr'] = None
self.load_config() self.load_config()
if not 'ssh_port' in self.config:
self.config['ssh_port'] = 22 # SSH default port
self.device_name = None self.device_name = None
self.webpassword = None self.webpassword = None
self.status = -2 self.status = -2
@ -194,6 +195,15 @@ class Gateway():
def ip_addr(self, value): def ip_addr(self, value):
self.config['device_ip_addr'] = 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): def load_config(self):
self.config = {} self.config = {}
with open('config.txt', 'r') as file: with open('config.txt', 'r') as file:

Loading…
Cancel
Save