本文整理汇总了Python中colorama.Style.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Python Style.NORMAL属性的具体用法?Python Style.NORMAL怎么用?Python Style.NORMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Style
的用法示例。
在下文中一共展示了Style.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: color
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def color(s, c, style="bright"):
color_map = {
"black": Fore.BLACK,
"red": Fore.RED,
"green": Fore.GREEN,
"yellow": Fore.YELLOW,
"blue": Fore.BLUE,
"magenta": Fore.MAGENTA,
"cyan": Fore.CYAN,
"white": Fore.WHITE,
}
style_map = {
"dim": Style.DIM,
"normal": Style.NORMAL,
"bright": Style.BRIGHT,
}
return color_map[c] + style_map[style] + s + Style.RESET_ALL
示例2: parse_port_scan
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def parse_port_scan(stream, tag, target, pattern):
address = target.address
ports = []
while True:
line = await stream.readline()
if line:
line = str(line.rstrip(), 'utf8', 'ignore')
debug(Fore.BLUE + '[' + Style.BRIGHT + address + ' ' + tag + Style.NORMAL + '] ' + Fore.RESET + '{line}', color=Fore.BLUE)
parse_match = re.search(pattern, line)
if parse_match:
ports.append(parse_match.group('port'))
for p in global_patterns:
matches = re.findall(p['pattern'], line)
if 'description' in p:
for match in matches:
if verbose >= 1:
info('Task {bgreen}{tag}{rst} on {byellow}{address}{rst} - {bmagenta}' + p['description'].replace('{match}', '{bblue}{match}{crst}{bmagenta}') + '{rst}')
async with target.lock:
with open(os.path.join(target.scandir, '_patterns.log'), 'a') as file:
file.writelines(e('{tag} - ' + p['description'] + '\n\n'))
else:
for match in matches:
if verbose >= 1:
info('Task {bgreen}{tag}{rst} on {byellow}{address}{rst} - {bmagenta}Matched Pattern: {bblue}{match}{rst}')
async with target.lock:
with open(os.path.join(target.scandir, '_patterns.log'), 'a') as file:
file.writelines(e('{tag} - Matched Pattern: {match}\n\n'))
else:
break
return ports
示例3: parse_service_detection
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def parse_service_detection(stream, tag, target, pattern):
address = target.address
services = []
while True:
line = await stream.readline()
if line:
line = str(line.rstrip(), 'utf8', 'ignore')
debug(Fore.BLUE + '[' + Style.BRIGHT + address + ' ' + tag + Style.NORMAL + '] ' + Fore.RESET + '{line}', color=Fore.BLUE)
parse_match = re.search(pattern, line)
if parse_match:
services.append((parse_match.group('protocol').lower(), int(parse_match.group('port')), parse_match.group('service')))
for p in global_patterns:
matches = re.findall(p['pattern'], line)
if 'description' in p:
for match in matches:
if verbose >= 1:
info('Task {bgreen}{tag}{rst} on {byellow}{address}{rst} - {bmagenta}' + p['description'].replace('{match}', '{bblue}{match}{crst}{bmagenta}') + '{rst}')
async with target.lock:
with open(os.path.join(target.scandir, '_patterns.log'), 'a') as file:
file.writelines(e('{tag} - ' + p['description'] + '\n\n'))
else:
for match in matches:
if verbose >= 1:
info('Task {bgreen}{tag}{rst} on {byellow}{address}{rst} - {bmagenta}Matched Pattern: {bblue}{match}{rst}')
async with target.lock:
with open(os.path.join(target.scandir, '_patterns.log'), 'a') as file:
file.writelines(e('{tag} - Matched Pattern: {match}\n\n'))
else:
break
return services
示例4: print_out
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def print_out(data, end='\n'):
datetimestr = str(datetime.datetime.strftime(datetime.datetime.now(), '%H:%M:%S'))
print(Style.NORMAL + "[" + datetimestr + "] " + data + Style.RESET_ALL,' ', end=end)
示例5: show_row
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def show_row(row):
row = color_row(row)
print(" ".join(["%s%s%s:%s" % (Style.NORMAL, x.capitalize(), Style.BRIGHT, y) for (x, y) in row.items()]))
示例6: parseLine
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def parseLine(line):
severity = getSeverity(line)
# Add color based on severity
if 'severity' not in locals():
severity = 3
if severity == 0:
color = Style.DIM + Fore.WHITE
elif severity == 1:
color = Style.NORMAL + Fore.BLUE
elif severity == 2:
color = Style.NORMAL + Fore.CYAN
elif severity == 3:
color = Style.NORMAL + Fore.WHITE
elif severity == 4:
color = Style.NORMAL + Fore.RED
elif severity == 5:
color = Style.NORMAL + Fore.BLACK + Back.RED
else:
color = Style.NORMAL + Fore.BLACK + Back.YELLOW
# Replace html tab entity with actual tabs
line = clearTags(line)
line = line.replace('	', "\t")
return color + line + Style.RESET_ALL
示例7: __parse_prompt
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def __parse_prompt(self):
raw_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " > " + Style.NORMAL
raw_prompt_template = os.getenv("ISAF_RAW_PROMPT", raw_prompt_default_template).replace('\\033', '\033')
self.raw_prompt_template = raw_prompt_template if '{host}' in raw_prompt_template else raw_prompt_default_template
module_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " (" + Fore.LIGHTBLUE_EX \
+ "{module}" + Fore.RESET + Style.NORMAL + ") > "
module_prompt_template = os.getenv("ISAF_MODULE_PROMPT", module_prompt_default_template).replace('\\033',
'\033')
self.module_prompt_template = module_prompt_template if all(
map(lambda x: x in module_prompt_template, ['{host}', "{module}"])) else module_prompt_default_template
示例8: _show_options
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def _show_options(self, *args, **kwargs):
target_opts = ['target', 'port']
module_opts = [opt for opt in self.current_module.options if opt not in target_opts]
headers = ("Name", "Value", "Description")
Utils.print_info(Style.BRIGHT + "\nTarget:" + Style.NORMAL)
Utils.printTable(headers, *self.get_opts(*target_opts))
if module_opts:
Utils.print_info(Style.BRIGHT + "\nModule:" + Style.NORMAL)
Utils.printTable(headers, *self.get_opts(*module_opts))
Utils.print_info()
示例9: _show_devices
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def _show_devices(self, *args, **kwargs): # TODO: cover with tests
try:
devices = self.current_module._Exploit__info__['devices']
Utils.print_info(Style.BRIGHT + "\nDevices:" + Style.NORMAL)
i = 0
for device in devices:
if isinstance(device, dict):
Utils.print_info(" {} - {}".format(i, device['name']))
else:
Utils.print_info(" {} - {}".format(i, device))
i += 1
Utils.print_info()
except KeyError:
Utils.print_info("\nTarget devices not defined.")
示例10: printcolored
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def printcolored(color, text):
# available color: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET
# available style: DIM, NORMAL, BRIGHT, RESET_ALL
# available back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET
if colorisok:
COLOR = getattr(Fore, "%s"%color.upper())
print(COLOR + Style.NORMAL + "%s"%text)
else:
print text
示例11: colored
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def colored(color, text):
# available color: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET
# available style: DIM, NORMAL, BRIGHT, RESET_ALL
# available back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET
if colorisok:
COLOR = getattr(Fore, "%s"%color.upper())
return COLOR + Style.NORMAL + "%s"%text
else:
return text
示例12: _highlight_keywords
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def _highlight_keywords(self, text, keywords, fore_color=Fore.GREEN):
if keywords and self.enable_color:
for keyword in keywords:
regex = re.compile(keyword, re.I | re.U | re.M)
color = fore_color + Back.RED + Style.BRIGHT
text = regex.sub(
color + keyword + Back.RESET + Style.NORMAL, text)
return text
示例13: log
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def log(message, color=Fore.BLUE):
print(f'{color}{Style.DIM}[*] {Style.NORMAL}{Fore.LIGHTBLUE_EX}{message}')
示例14: main
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def main():
init()
log(f'Starting {Fore.MAGENTA}{Style.DIM}PyNubank{Style.NORMAL}{Fore.LIGHTBLUE_EX} context creation.')
device_id = generate_random_id()
log(f'Generated random id: {device_id}')
cpf = input(f'[>] Enter your CPF(Numbers only): ')
password = getpass('[>] Enter your password (Used on the app/website): ')
generator = CertificateGenerator(cpf, password, device_id)
log('Requesting e-mail code')
try:
email = generator.request_code()
except NuException:
log(f'{Fore.RED}Failed to request code. Check your credentials!', Fore.RED)
return
log(f'Email sent to {Fore.LIGHTBLACK_EX}{email}{Fore.LIGHTBLUE_EX}')
code = input('[>] Type the code received by email: ')
cert1, cert2 = generator.exchange_certs(code)
save_cert(cert1, 'cert.p12')
print(f'{Fore.GREEN}Certificates generated successfully. (cert.pem)')
print(f'{Fore.YELLOW}Warning, keep these certificates safe (Do not share or version in git)')
示例15: output_error
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import NORMAL [as 别名]
def output_error(line):
print Fore.RED + Style.BRIGHT + "[-] !!! " + Style.NORMAL, line, Style.BRIGHT + "!!!"