Update to v0.4.1
This commit is contained in:
@@ -43,34 +43,31 @@ class Typo3_Installation:
|
||||
@staticmethod
|
||||
def check(domain):
|
||||
response = Request.get_request(domain.get_name(), '/')
|
||||
Request.interesting_headers(domain, response[1], response[2])
|
||||
try:
|
||||
print(Fore.GREEN + '[!] fe_typo_user:'.ljust(32) + response[2].cookies['fe_typo_user'] + Fore.RESET)
|
||||
regex = re.compile('[Tt][Yy][Pp][Oo]3 (\d{1,2}\.\d{1,2}\.[0-9][0-9]?)')
|
||||
searchVersion = regex.search(response[0])
|
||||
version = searchVersion.groups()
|
||||
domain.set_typo3()
|
||||
domain.set_typo3_version(version[0].split()[0])
|
||||
return True
|
||||
except:
|
||||
try:
|
||||
regex = re.compile('[Tt][Yy][Pp][Oo]3 (\d{1,2}\.\d{1,2}\.[0-9][0-9]?)')
|
||||
searchVersion = regex.search(response[0])
|
||||
version = searchVersion.groups()
|
||||
regex = re.compile('TYPO3 (\d{1,2}\.\d{1,2}) CMS')
|
||||
searchHTML = regex.search(response[0])
|
||||
version = searchHTML.groups()
|
||||
domain.set_typo3()
|
||||
domain.set_typo3_version(version[0].split()[0])
|
||||
return True
|
||||
except:
|
||||
try:
|
||||
regex = re.compile('TYPO3(.*)', re.IGNORECASE)
|
||||
searchHTML = regex.search(response[0])
|
||||
searchHTML.groups()[0]
|
||||
domain.set_typo3()
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
# Searching Typo3 login page
|
||||
@staticmethod
|
||||
def search_login(domain):
|
||||
response = Request.get_request(domain.get_name(), '/typo3/index.php')
|
||||
Request.interesting_headers(response[1])
|
||||
try:
|
||||
response = Request.get_request(domain.get_name(), '/typo3/index.php')
|
||||
Request.interesting_headers(domain, response[1], response[2])
|
||||
regex = re.compile('<title>(.*)</title>', re.IGNORECASE)
|
||||
searchTitle = regex.search(response[0])
|
||||
title = searchTitle.groups()[0]
|
||||
|
||||
@@ -39,6 +39,7 @@ class Domain(object):
|
||||
self.__extension_config = [ext_state, top]
|
||||
self.__extensions = None
|
||||
self.__installed_extensions = {}
|
||||
self.__interesing_header = {}
|
||||
|
||||
def get_name(self):
|
||||
return self.__name
|
||||
@@ -80,4 +81,10 @@ class Domain(object):
|
||||
return self.__login_found
|
||||
|
||||
def set_login_found(self):
|
||||
self.__login_found = True
|
||||
self.__login_found = True
|
||||
|
||||
def set_interesting_headers(self, header_key, header_value):
|
||||
self.__interesing_header[header_key] = header_value
|
||||
|
||||
def get_interesting_headers(self):
|
||||
return self.__interesing_header
|
||||
@@ -28,12 +28,13 @@ except:
|
||||
if sys.platform.startswith('linux'):
|
||||
print('Please install it with: sudo apt-get install python-socksipy' + Fore.RESET)
|
||||
else:
|
||||
print('You can download it from http://socksipy.sourceforge.net/' + Fore.RESET)
|
||||
print('You can download it from https://code.google.com/p/socksipy-branch/' + Fore.RESET)
|
||||
sys.exit(-2)
|
||||
|
||||
class Privoxy:
|
||||
def __init__(self, port=8118):
|
||||
self.__port = port
|
||||
Request.timeout = 20
|
||||
|
||||
def start_daemon(self):
|
||||
if sys.platform.startswith('linux'):
|
||||
@@ -49,10 +50,11 @@ class Privoxy:
|
||||
def connect(self):
|
||||
print('\nChecking connection...')
|
||||
socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, '127.0.0.1', self.__port, True)
|
||||
socks.socket.setdefaulttimeout(20)
|
||||
socket.socket = socks.socksocket
|
||||
try:
|
||||
request = Request.get_request('https://check.torproject.org/')
|
||||
response = request[1]
|
||||
response = str(request[0])
|
||||
except:
|
||||
print('Failed to connect through Privoxy!')
|
||||
print('Please make sure your configuration is right!\n')
|
||||
@@ -73,4 +75,4 @@ class Privoxy:
|
||||
os.system('service privoxy stop')
|
||||
print('[ ok ] Stopping privoxy daemon...done.')
|
||||
elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
|
||||
print('You can close Privoxy now...')
|
||||
print('You can stop Privoxy now...')
|
||||
@@ -24,6 +24,9 @@ from colorama import Fore
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
from lib.output import Output
|
||||
|
||||
header = {'User-Agent' : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"}
|
||||
timeout = 10
|
||||
|
||||
class Request:
|
||||
"""
|
||||
This class is used to make all server requests
|
||||
@@ -31,8 +34,8 @@ class Request:
|
||||
@staticmethod
|
||||
def get_request(domain_name, path):
|
||||
try:
|
||||
r = requests.get(domain_name + path, timeout=10, headers={'User-Agent' : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"}, verify=False)
|
||||
httpResponse = r.text
|
||||
r = requests.get(domain_name + path, timeout=timeout, headers=header, verify=False)
|
||||
httpResponse = str((r.text).encode('utf-8'))
|
||||
headers = r.headers
|
||||
cookies = r.cookies
|
||||
status_code = r.status_code
|
||||
@@ -48,7 +51,7 @@ class Request:
|
||||
@staticmethod
|
||||
def head_request(domain_name, path):
|
||||
try:
|
||||
r = requests.head(domain_name + path, timeout=10, headers={'User-Agent' : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"}, allow_redirects=False, verify=False)
|
||||
r = requests.head(domain_name + path, timeout=timeout, headers=header, allow_redirects=False, verify=False)
|
||||
status_code = str(r.status_code)
|
||||
if status_code == '405':
|
||||
print("WARNING, (HEAD) method not allowed!!")
|
||||
@@ -62,19 +65,29 @@ class Request:
|
||||
print(Fore.RED + str(e) + Fore.RESET)
|
||||
|
||||
@staticmethod
|
||||
def interesting_headers(headers):
|
||||
def interesting_headers(domain, headers, cookies):
|
||||
for header in headers:
|
||||
if header == 'server':
|
||||
Output.interesting_headers('Server', headers.get('server'))
|
||||
domain.set_interesting_headers('Server', headers.get('server'))
|
||||
elif header == 'x-powered-by':
|
||||
Output.interesting_headers('X-Powered-By', headers.get('x-powered-by'))
|
||||
domain.set_interesting_headers('X-Powered-By', headers.get('x-powered-by'))
|
||||
elif header == 'via':
|
||||
Output.interesting_headers('Via', headers.get('via'))
|
||||
domain.set_interesting_headers('Via', headers.get('via'))
|
||||
try:
|
||||
typo_cookie = cookies['be_typo_user']
|
||||
domain.set_interesting_headers('be_typo_user',typo_cookie)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
typo_cookie = cookies['fe_typo_user']
|
||||
domain.set_interesting_headers('fe_typo_user', typo_cookie)
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
# not used atm because unreliable
|
||||
def version_information(domain_name, path, regex):
|
||||
r = requests.get(domain_name + path, stream=True, timeout=10, headers={'User-Agent' : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"}, verify=False)
|
||||
r = requests.get(domain_name + path, stream=True, timeout=timeout, headers=header, verify=False)
|
||||
if r.status_code == 200:
|
||||
for content in r.iter_content(chunk_size=400, decode_unicode=False):
|
||||
regex = re.compile(regex)
|
||||
|
||||
@@ -31,12 +31,13 @@ except:
|
||||
if sys.platform.startswith('linux'):
|
||||
print('Please install it with: sudo apt-get install python-socksipy' + Fore.RESET)
|
||||
else:
|
||||
print('You can download it from http://socksipy.sourceforge.net/' + Fore.RESET)
|
||||
print('You can download it from https://code.google.com/p/socksipy-branch/' + Fore.RESET)
|
||||
sys.exit(-2)
|
||||
|
||||
class Tor:
|
||||
def __init__(self, port=9050):
|
||||
def __init__(self, port=9150):
|
||||
self.__port = port
|
||||
Request.timeout = 20
|
||||
|
||||
def start_daemon(self):
|
||||
if sys.platform.startswith('linux'):
|
||||
@@ -51,12 +52,12 @@ class Tor:
|
||||
def connect(self):
|
||||
print('\nChecking connection...')
|
||||
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', self.__port, True)
|
||||
socks.socket.setdefaulttimeout(20)
|
||||
socket.socket = socks.socksocket
|
||||
try:
|
||||
request = Request.get_request('https://check.torproject.org/')
|
||||
response = request[1]
|
||||
except Exception, e:
|
||||
print(e)
|
||||
request = Request.get_request('https://check.torproject.org', '/')
|
||||
response = request[0]
|
||||
except:
|
||||
print('Failed to connect through TOR!')
|
||||
print('Please make sure your configuration is right!\n')
|
||||
sys.exit(-2)
|
||||
@@ -64,12 +65,13 @@ class Tor:
|
||||
regex = re.compile('Congratulations. This browser is configured to use Tor.')
|
||||
searchVersion = regex.search(response)
|
||||
version = searchVersion.groups()
|
||||
pprint('Connection to TOR established')
|
||||
print('Connection to TOR established')
|
||||
regex = re.compile("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")
|
||||
searchIP = regex.search(response)
|
||||
IP = searchIP.groups()[0]
|
||||
print('Your IP is: ', IP)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print('It seems like TOR is not used.\nAborting...\n')
|
||||
sys.exit(-2)
|
||||
|
||||
|
||||
@@ -31,12 +31,13 @@ except:
|
||||
if sys.platform.startswith('linux'):
|
||||
print('Please install it with: sudo apt-get install python-socksipy' + Fore.RESET)
|
||||
else:
|
||||
print('You can download it from http://socksipy.sourceforge.net/' + Fore.RESET)
|
||||
print('You can download it from https://code.google.com/p/socksipy-branch/' + Fore.RESET)
|
||||
sys.exit(-2)
|
||||
|
||||
class Tor_with_Privoxy:
|
||||
def __init__(self, port=8118):
|
||||
self.__port = port
|
||||
Request.timeout = 20
|
||||
|
||||
def start_daemon(self):
|
||||
if sys.platform.startswith('linux'):
|
||||
@@ -53,10 +54,11 @@ class Tor_with_Privoxy:
|
||||
def connect(self):
|
||||
print('\nChecking connection...')
|
||||
socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, "127.0.0.1", self.__port, True)
|
||||
socks.socket.setdefaulttimeout(20)
|
||||
socket.socket = socks.socksocket
|
||||
try:
|
||||
request = Request.get_request('https://check.torproject.org/')
|
||||
response = request[1]
|
||||
response = str(request[0])
|
||||
except:
|
||||
print('Failed to connect through Privoxy and/or TOR!')
|
||||
print('Please make sure your configuration is right!\n')
|
||||
|
||||
Reference in New Issue
Block a user