Add output ROM version on start exploit

pull/3/head
remittor 3 years ago
parent 6da78e4252
commit 3ca22df5dd

@ -38,6 +38,7 @@ if gw.status < 1:
dname = gw.device_name dname = gw.device_name
print("device_name =", 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: if gw.ping(verbose = 0) is True:
die(0, "Exploit already installed and running") die(0, "Exploit already installed and running")
@ -162,6 +163,8 @@ if (fn_payload2):
if (fn_payload3): if (fn_payload3):
requests.post(urlapi + "misystem/c_upload", files={"image":open(fn_payload3, 'rb')}) requests.post(urlapi + "misystem/c_upload", files={"image":open(fn_payload3, 'rb')})
time.sleep(1)
if gw.use_ssh: if gw.use_ssh:
print("Running SSH server on port 122...") print("Running SSH server on port 122...")
else: else:

@ -56,6 +56,8 @@ class Gateway():
timeout = 4 timeout = 4
config = {} config = {}
device_name = None device_name = None
rom_version = None
rom_channel = None
webpassword = None webpassword = None
status = -2 status = -2
ftp = None ftp = None
@ -79,6 +81,8 @@ class Gateway():
def detect_device(self): def detect_device(self):
self.device_name = None self.device_name = None
self.rom_version = None
self.rom_channel = None
self.status = -2 self.status = -2
try: try:
r0 = requests.get("http://{ip_addr}/cgi-bin/luci/web".format(ip_addr = self.ip_addr), timeout = self.timeout) 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: if hardware and len(hardware) > 0:
self.device_name = hardware[0] self.device_name = hardware[0]
self.device_name = self.device_name.lower() 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: except requests.exceptions.HTTPError as e:
print("Http Error:", e) print("Http Error:", e)
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:

Loading…
Cancel
Save