本文整理汇总了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)
示例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')
示例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('')
示例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)
示例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
示例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)