Update to v0.4.1

This commit is contained in:
Jan Rude
2015-04-14 00:09:43 +02:00
parent 4246a96399
commit 7672d9c0b0
15 changed files with 5725 additions and 5654 deletions

View File

@@ -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)