當前位置: 首頁>>代碼示例>>Python>>正文


Python colors.good方法代碼示例

本文整理匯總了Python中core.colors.good方法的典型用法代碼示例。如果您正苦於以下問題:Python colors.good方法的具體用法?Python colors.good怎麽用?Python colors.good使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core.colors的用法示例。


在下文中一共展示了colors.good方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: heuristic

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def heuristic(response, paramList):
    done = []
    forms = re.findall(r'(?i)(?s)<form.*?</form.*?>', response)
    for form in forms:
        method = re.search(r'(?i)method=[\'"](.*?)[\'"]', form)
        inputs = re.findall(r'(?i)(?s)<input.*?>', response)
        if inputs != None and method != None:
            for inp in inputs:
                inpName = re.search(r'(?i)name=[\'"](.*?)[\'"]', inp)
                if inpName:
                    inpName = d(e(inpName.group(1)))
                    if inpName not in done:
                        if inpName in paramList:
                            paramList.remove(inpName)
                        done.append(inpName)
                        paramList.insert(0, inpName)
                        print('%s Heuristic found a potential %s parameter: %s%s%s' % (good, method.group(1), green, inpName, end))
                        print('%s Prioritizing it' % info)
    emptyJSvars = re.finditer(r'var\s+([^=]+)\s*=\s*[\'"`][\'"`]', response)
    for each in emptyJSvars:
        inpName = each.group(1)
        done.append(inpName)
        paramList.insert(0, inpName)
        print('%s Heuristic found a potential parameter: %s%s%s' % (good, green, inpName, end))
        print('%s Prioritizing it' % info) 
開發者ID:s0md3v,項目名稱:Arjun,代碼行數:27,代碼來源:arjun.py

示例2: detectCMS

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def detectCMS(domain):
    response = get('https://whatcms.org/?gpreq=json&jsoncallback=jQuery1124008091494457806547_1554361369057&s=%s&na=&nb=1cg805dlm7d7e5eickf67rzxrn12mju6bnch3a99hrt88v7n8rhf0lovwr8d0zm1&verified=&_=1554361369059' % domain).text
    match = search(r'uses<\\/div>[^>]+>(.*?)<\\/a>', response)
    try:
        sys.stdout.write(good + ' ' + match.group(1) + '\n')
    except:
        sys.stdout.write('%s Target doesn\'t seem to use a CMS' % info + '\n') 
開發者ID:s0md3v,項目名稱:ReconDog,代碼行數:9,代碼來源:detectCMS.py

示例3: bruteforcer

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def bruteforcer(target, paramData, payloadList, encoding, headers, delay, timeout):
    GET, POST = (False, True) if paramData else (True, False)
    host = urlparse(target).netloc  # Extracts host out of the url
    logger.debug('Parsed host to bruteforce: {}'.format(host))
    url = getUrl(target, GET)
    logger.debug('Parsed url to bruteforce: {}'.format(url))
    params = getParams(target, paramData, GET)
    logger.debug_json('Bruteforcer params:', params)
    if not params:
        logger.error('No parameters to test.')
        quit()
    for paramName in params.keys():
        progress = 1
        paramsCopy = copy.deepcopy(params)
        for payload in payloadList:
            logger.run('Bruteforcing %s[%s%s%s]%s: %i/%i\r' %
                       (green, end, paramName, green, end, progress, len(payloadList)))
            if encoding:
                payload = encoding(unquote(payload))
            paramsCopy[paramName] = payload
            response = requester(url, paramsCopy, headers,
                                 GET, delay, timeout).text
            if encoding:
                payload = encoding(payload)
            if payload in response:
                logger.info('%s %s' % (good, payload))
            progress += 1
    logger.no_format('') 
開發者ID:s0md3v,項目名稱:XSStrike,代碼行數:30,代碼來源:bruteforcer.py

示例4: updater

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def updater():
    """Update the current installation.

    git clones the latest version and merges it with the current directory.
    """
    print('%s Checking for updates' % run)
    # Changes must be separated by ;
    changes = '''major bug fixes;removed ninja mode;dropped python < 3.2 support;fixed unicode output;proxy support;more intels'''
    latest_commit = requester('https://raw.githubusercontent.com/s0md3v/Photon/master/core/updater.py', host='raw.githubusercontent.com')
    # Just a hack to see if a new version is available
    if changes not in latest_commit:
        changelog = re.search(r"changes = '''(.*?)'''", latest_commit)
        # Splitting the changes to form a list
        changelog = changelog.group(1).split(';')
        print('%s A new version of Photon is available.' % good)
        print('%s Changes:' % info)
        for change in changelog: # print changes
            print('%s>%s %s' % (green, end, change))

        current_path = os.getcwd().split('/') # if you know it, you know it
        folder = current_path[-1] # current directory name
        path = '/'.join(current_path) # current directory path
        choice = input('%s Would you like to update? [Y/n] ' % que).lower()

        if choice != 'n':
            print('%s Updating Photon' % run)
            os.system('git clone --quiet https://github.com/s0md3v/Photon %s'
                      % (folder))
            os.system('cp -r %s/%s/* %s && rm -r %s/%s/ 2>/dev/null'
                      % (path, folder, path, path, folder))
            print('%s Update successful!' % good)
    else:
        print('%s Photon is up to date!' % good) 
開發者ID:s0md3v,項目名稱:Photon,代碼行數:35,代碼來源:updater.py

示例5: shodan

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def shodan(ip):
	result = {ip : {}}
	response = requester('https://api.shodan.io/shodan/host/%s?key=%s' % (ip, core.memory.config['shodan_api_key']))
	data = response.json()['data']
	core.memory.global_vars['shodan_queries'] += 1
	if data:
		for each in data:
			port = each['port']
			result[ip][port] = {}
			software, version = None, None
			if 'product' in each:
				software = each['product']
				result[ip][port]['software'] = software
			else:
				result[ip][port]['software'] = ''
			if 'cpe' in each:
				cpes = each['cpe']
				for cpe in cpes:
					if software in cpe:
						result[ip][port]['cpe'] = cpe
						break
				else:
					result[ip][port]['cpe'] = cpes[0]
			else:
				result[ip][port]['cpe'] = ''
			cpe_boolean = False
			if result[ip][port]['cpe']:
				cpe_boolean = True
			if 'version' in each:
				version = each['version']
				if cpe_boolean and cpe.count(':') > 3:
					version = cpe.split(':')[-1]
				result[ip][port]['version'] = version
			elif cpe_boolean and cpe.count(':') > 3:
				result[ip][port]['version'] = cpe.split(':')[-1]
			else:
				result[ip][port]['version'] = ''
			if 'vulns' in each:
				cache(software, version, 'dummy')
			elif software and version:
				if cpe_boolean:
					for cpe in cpes:
						software = cpe
						if cpe.count(':') > 3:
							version = cpe.split(':')[-1]
						is_vuln = vulners(software, version, cpe=cpe_boolean)
						if is_vuln:
							message = '%s %s running on %s:%s is outdated' % (each['product'], version, ip, each['port'])
							notify('[Vuln] %s' % message)
							print('%s %s' % (good, message))
				else:
					is_vuln = vulners(software, version, cpe=cpe_boolean)
					if is_vuln:
						message = '%s %s running on %s:%s is outdated' % (each['product'], version, ip, each['port'])
						notify('[Vuln] %s' % message)
						print('%s %s' % (good, message))
	return result 
開發者ID:s0md3v,項目名稱:Silver,代碼行數:59,代碼來源:shodan.py

示例6: zap

# 需要導入模塊: from core import colors [as 別名]
# 或者: from core.colors import good [as 別名]
def zap(input_url, archive, domain, host, internal, robots, proxies):
    """Extract links from robots.txt and sitemap.xml."""
    if archive:
        print('%s Fetching URLs from archive.org' % run)
        if False:
            archived_urls = time_machine(domain, 'domain')
        else:
            archived_urls = time_machine(host, 'host')
        print('%s Retrieved %i URLs from archive.org' % (
            good, len(archived_urls) - 1))
        for url in archived_urls:
            verb('Internal page', url)
            internal.add(url)
    # Makes request to robots.txt
    response = requests.get(input_url + '/robots.txt',
                            proxies=random.choice(proxies)).text
    # Making sure robots.txt isn't some fancy 404 page
    if '<body' not in response:
        # If you know it, you know it
        matches = re.findall(r'Allow: (.*)|Disallow: (.*)', response)
        if matches:
            # Iterating over the matches, match is a tuple here
            for match in matches:
                # One item in match will always be empty so will combine both
                # items
                match = ''.join(match)
                # If the URL doesn't use a wildcard
                if '*' not in match:
                    url = input_url + match
                    # Add the URL to internal list for crawling
                    internal.add(url)
                    # Add the URL to robots list
                    robots.add(url)
            print('%s URLs retrieved from robots.txt: %s' % (good, len(robots)))
    # Makes request to sitemap.xml
    response = requests.get(input_url + '/sitemap.xml',
                            proxies=random.choice(proxies)).text
    # Making sure robots.txt isn't some fancy 404 page
    if '<body' not in response:
        matches = xml_parser(response)
        if matches: # if there are any matches
            print('%s URLs retrieved from sitemap.xml: %s' % (
                good, len(matches)))
            for match in matches:
                verb('Internal page', match)
                # Cleaning up the URL and adding it to the internal list for
                # crawling
                internal.add(match) 
開發者ID:s0md3v,項目名稱:Photon,代碼行數:50,代碼來源:zap.py


注:本文中的core.colors.good方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。