updated to version 0.3.1

This commit is contained in:
root
2014-08-21 19:33:53 +02:00
parent 1189f94734
commit 0658c27e42
5 changed files with 73 additions and 62 deletions

View File

@@ -12,26 +12,24 @@ from colorama import Fore
from lib import settings
# Searching Typo3 login page
def search_login(domain):
def search_login():
try:
r = requests.get('http://' + domain + '/typo3/index.php', allow_redirects=False, timeout=settings.TIMEOUT, headers=settings.user_agent)
r = requests.get(settings.DOMAIN + '/typo3/index.php', allow_redirects=False, timeout=settings.TIMEOUT, headers=settings.user_agent, verify=False)
statusCode = r.status_code
httpResponse = r.text
if statusCode == 200:
return check_title(httpResponse, r.url)
elif (statusCode == 301) or (statusCode == 302):
location = r.headers['location']
if ("http://") in location:
locsplit = location.split("//")
new_location = locsplit[1].split("/")
search_login(new_location[0])
elif ("https://") in location:
r = requests.get(location, timeout=settings.TIMEOUT, headers=settings.user_agent, verify=False)
statusCode = r.status_code
httpResponse = r.text
redirect = raw_input('Got redirect to: ' + str(location) + '\nFollow? (y/n) ')
if redirect is 'y':
locsplit = location.split('/')
settings.DOMAIN = locsplit[0] + '//' + locsplit[2]
return "redirect"
else:
return check_title(httpResponse, r.url)
elif statusCode == 404:
return check_main_page()
return False
else:
print "Oops! Got unhandled code:".ljust(32) + str(statusCode) + ": " + str(r.raise_for_status())
except requests.exceptions.Timeout:
@@ -52,11 +50,11 @@ def check_title(response, url):
return True
except:
pass
return check_main_page()
return False
# Searching for Typo3 references in HTML comments
def check_main_page():
req = urllib2.Request('http://' + settings.DOMAIN, None, settings.user_agent)
req = urllib2.Request(settings.DOMAIN, None, settings.user_agent)
req.add_header('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
try:
connection = urllib2.urlopen(req, timeout = settings.TIMEOUT)
@@ -66,6 +64,9 @@ def check_main_page():
cookie = connection.info().getheader('Set-Cookie')
if 'fe_typo_user' in cookie:
return bad_url()
except KeyboardInterrupt:
print Fore.RED + "\nReceived keyboard interrupt.\nQuitting..." + Fore.RESET
exit(-1)
except:
try:
regex = re.compile("TYPO3(.*)", re.IGNORECASE)
@@ -85,16 +86,15 @@ def check_main_page():
if "404" in str(e):
print Fore.RED + str(e) + "\nPlease ensure you entered the right url" + Fore.RESET
else:
print Fore.RED + "Got \"" + str(e) + "\" on testing main page." + Fore.RESET
return False
print "Typo3 Login:".ljust(32) + Fore.RED + "Typo3 is not used on this domain" + Fore.RESET
print Fore.RED + str(e) + Fore.RESET
return "skip"
return False
def bad_url():
print "Typo3 Login:".ljust(32) + Fore.GREEN + "Typo3 is used, but could not find login" + Fore.RESET
print "".ljust(32) + "This will mostly result in \"no extensions are installed\"."
print "".ljust(32) + "This could result in \"no extensions are installed\"."
print "".ljust(32) + "Seems like something is wrong with the given url."
var = raw_input("".ljust(32) + "Try anyway (y/n)? ")
if var is 'y':
return True
return False
return "skip"