From 3ca22df5dd21545f978635f18166699c9362aa7b Mon Sep 17 00:00:00 2001 From: remittor Date: Wed, 3 Nov 2021 09:54:23 +0300 Subject: [PATCH] Add output ROM version on start exploit --- connect.py | 3 +++ gateway.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/connect.py b/connect.py index b19c746..99c87c5 100644 --- a/connect.py +++ b/connect.py @@ -38,6 +38,7 @@ if gw.status < 1: dname = gw.device_name print("device_name =", gw.device_name) +print("rom_version = {} {}".format(gw.rom_version, gw.rom_channel)) if gw.ping(verbose = 0) is True: die(0, "Exploit already installed and running") @@ -162,6 +163,8 @@ if (fn_payload2): if (fn_payload3): requests.post(urlapi + "misystem/c_upload", files={"image":open(fn_payload3, 'rb')}) +time.sleep(1) + if gw.use_ssh: print("Running SSH server on port 122...") else: diff --git a/gateway.py b/gateway.py index bac3539..f20aa24 100644 --- a/gateway.py +++ b/gateway.py @@ -56,6 +56,8 @@ class Gateway(): timeout = 4 config = {} device_name = None + rom_version = None + rom_channel = None webpassword = None status = -2 ftp = None @@ -79,6 +81,8 @@ class Gateway(): def detect_device(self): self.device_name = None + self.rom_version = None + self.rom_channel = None self.status = -2 try: r0 = requests.get("http://{ip_addr}/cgi-bin/luci/web".format(ip_addr = self.ip_addr), timeout = self.timeout) @@ -93,6 +97,10 @@ class Gateway(): if hardware and len(hardware) > 0: self.device_name = hardware[0] self.device_name = self.device_name.lower() + romver = re.search(r'romVersion: \'(.*?)\'', r0.text) + self.rom_version = romver.group(1).strip() if romver else None + romchan = re.search(r'romChannel: \'(.*?)\'', r0.text) + self.rom_channel = romchan.group(1).strip().lower() if romchan else None except requests.exceptions.HTTPError as e: print("Http Error:", e) except requests.exceptions.ConnectionError as e: