def connect(self):
        """
			This method checks the connection with TOR.
				If TOR is not used, the program will exit
		"""
        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[0]
        except:
            print('Failed to connect through TOR!')
            print('Please make sure your configuration is right!\n')
            sys.exit(-2)
        try:
            regex = re.compile(
                'Congratulations. This browser is configured to use Tor.')
            searchVersion = regex.search(response)
            version = searchVersion.groups()
            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 Exception as e:
            print(e)
            print('It seems like TOR is not used.\nAborting...\n')
            sys.exit(-2)
    def check_root(domain):
        response = Request.get_request(domain.get_name(), '/')
        if re.search('[Tt][Yy][Pp][Oo]3', response[0]):
            domain.set_typo3()
            headers = Request.interesting_headers(response[1], response[2])
            for key in headers:
                domain.set_interesting_headers(key, headers[key])

            try:
                path = re.search(
                    '(href|src|content)=(.{0,35})(typo3temp/|typo3conf/)',
                    response[0])
                if not (path.groups()[1] == '"' or '"../' in path.groups()[1]):
                    real_path = (path.groups()[1].split('"')[1])
                    if 'http' in real_path:
                        domain.set_name(real_path[0:len(real_path) - 1])
                    else:
                        domain.set_name(domain.get_name() +
                                        real_path[0:len(real_path) - 1])
                    domain.set_path(real_path[0:len(real_path) - 1])
            except:
                pass
            return True
        else:
            return False
    def search_login(domain):
        try:
            response = Request.get_request(domain.get_name(),
                                           '/typo3/index.php')
            regex = re.compile('<title>(.*)</title>', re.IGNORECASE)
            searchTitle = regex.search(response[0])
            title = searchTitle.groups()[0]

            login_text = Fore.GREEN + domain.get_name(
            ) + '/typo3/index.php' + Fore.RESET
            login_text += '\n | Accessible?'.ljust(30)

            if ('TYPO3 Backend access denied: The IP address of your client'
                    in response[0]) or (response[3] == 403):
                login_text += (Fore.YELLOW +
                               ' Forbidden (IP Address Restriction)' +
                               Fore.RESET)
            elif (('TYPO3 Login' in title) or ('TYPO3 CMS Login') in title):
                login_text += Fore.GREEN + ' Yes' + Fore.RESET
            else:
                login_text = Fore.RED + 'Could not be found' + Fore.RESET
            domain.set_login_found(login_text)
            return True
        except:
            return False
	def check_404(domain):
		domain_name = domain.get_name()
		response = Request.get_request((domain_name.split('/')[0] + '//' + domain_name.split('/')[2]), '/idontexist')
		try:
			regex = re.compile('[Tt][Yy][Pp][Oo]3 CMS')
			searchInstallation = regex.search(response[0])
			installation = searchInstallation.groups()
			domain.set_typo3()
			return True
		except:
			return False
 def check_404(domain):
     domain_name = domain.get_name()
     response = Request.get_request(
         (domain_name.split('/')[0] + '//' + domain_name.split('/')[2]),
         '/idontexist')
     try:
         regex = re.compile('[Tt][Yy][Pp][Oo]3 CMS')
         searchInstallation = regex.search(response[0])
         installation = searchInstallation.groups()
         domain.set_typo3()
         return True
     except:
         return False
	def check_default_files(domain):
		files = {'/typo3_src/README.md':'[Tt][Yy][Pp][Oo]3 [Cc][Mm][Ss]',
				'/typo3_src/README.txt':'[Tt][Yy][Pp][Oo]3 [Cc][Mm][Ss]',
				'/typo3_src/INSTALL.txt':'INSTALLING [Tt][Yy][Pp][Oo]3',
				'/typo3_src/INSTALL.md':'INSTALLING [Tt][Yy][Pp][Oo]3',
				'/typo3_src/LICENSE.txt':'[Tt][Yy][Pp][Oo]3'
			}

		for path, regex in files.items():
			try:
				response = Request.get_request(domain.get_name(), path)
				regex = re.compile(regex)
				searchInstallation = regex.search(response[0])
				installation = searchInstallation.groups()
				domain.set_typo3()
				return True
			except:
				pass
		return False
	def search_login(domain):
		try:
			response = Request.get_request(domain.get_name(), '/typo3/index.php')
			regex = re.compile('<title>(.*)</title>', re.IGNORECASE)
			searchTitle = regex.search(response[0])
			title = searchTitle.groups()[0]

			login_text = Fore.GREEN + domain.get_name() + '/typo3/index.php' + Fore.RESET
			login_text += '\n | Accessible?'.ljust(30)  
			
			if ('TYPO3 Backend access denied: The IP address of your client' in response[0]) or (response[3] == 403):
				login_text += (Fore.YELLOW + ' Forbidden (IP Address Restriction)' + Fore.RESET)
			elif (('TYPO3 Login' in title) or ('TYPO3 CMS Login') in title):
				login_text += Fore.GREEN + ' Yes' + Fore.RESET
			else:
				login_text = Fore.RED + 'Could not be found' + Fore.RESET
			domain.set_login_found(login_text)
			return True
		except:
			return False
    def check_default_files(domain):
        files = {
            '/typo3_src/README.md': '[Tt][Yy][Pp][Oo]3 [Cc][Mm][Ss]',
            '/typo3_src/README.txt': '[Tt][Yy][Pp][Oo]3 [Cc][Mm][Ss]',
            '/typo3_src/INSTALL.txt': 'INSTALLING [Tt][Yy][Pp][Oo]3',
            '/typo3_src/INSTALL.md': 'INSTALLING [Tt][Yy][Pp][Oo]3',
            '/typo3_src/LICENSE.txt': '[Tt][Yy][Pp][Oo]3'
        }

        for path, regex in files.items():
            try:
                response = Request.get_request(domain.get_name(), path)
                regex = re.compile(regex)
                searchInstallation = regex.search(response[0])
                installation = searchInstallation.groups()
                domain.set_typo3()
                return True
            except:
                pass
        return False
	def check_root(domain):
		response = Request.get_request(domain.get_name(), '/')
		if re.search('[Tt][Yy][Pp][Oo]3', response[0]):
			domain.set_typo3()
			headers = Request.interesting_headers(response[1], response[2])
			for key in headers:
				domain.set_interesting_headers(key, headers[key])

			try:
				path = re.search('(href|src|content)=(.{0,35})(typo3temp/|typo3conf/)', response[0])
				if not (path.groups()[1] == '"' or '"../' in path.groups()[1]):
					real_path = (path.groups()[1].split('"')[1])
					if 'http' in real_path:
						domain.set_name(real_path[0:len(real_path)-1])
					else:
						domain.set_name(domain.get_name() + real_path[0:len(real_path)-1])
					domain.set_path(real_path[0:len(real_path)-1])
			except:
				pass
			return True
		else:
			return False