1. 命令行窗口输出的打印日志带有对应的预警颜色
2. 配合调式模式输出,例如 debug 则打印输出
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from core.colors import *
from files.config import DEBUG as verbose
def verbout(stat, content_info):
'''
此模块用于提供详细的输出。
'''
# 如果调试模式选择为True
if verbose:
# 连接stat类型和字符串值并打印出来
print(stat+content_info)
verbout(color.RED, ' +------------------------+\n'+color.CYAN)
verbout(O, '通过端点请求验证 ' + color.GREY + 'Referer' + color.END + ' 检查...')
verbout(GR, '准备表单输入...')
verbout(R, '表单索引错误')
verbout(R, '异常 : ' + msg.__str__())
import os
if os.name != 'nt' and os.name != 'mac':
class color:
END = '\033[0m' # normal
BOLD = '\033[1m' # bold
RED = '\033[1;91m' # red
GREEN = '\033[1;92m' # green
ORANGE = '\033[1;93m' # orange
BLUE = '\033[1;94m' # blue
PURPLE = '\033[1;95m' # purple
UNDERLINE = '\033[4m' # underline
CYAN = '\033[1;96m' # cyan
GREY = '\033[1;97m' # gray
BR = '\033[1;97;41m' # background red
BG = '\033[1;97;42m' # background green
BY = '\033[1;97;43m' # background yellow
O = '\033[1m \033[93m[!]\033[0m ' # information
R = '\033[1m \033[91m[-]\033[0m ' # something's not right
GR = '\033[1m \033[97m[*]\033[0m ' # processing
G = '\033[1m \033[92m[+]\033[0m ' # yay!
C = '\033[1m \033[96m[+]\033[0m ' # crawling...
else:
class color:
# no escape sequences
END=BOLD=RED=GREEN=ORANGE=BLUE=PURPLE=UNDERLINE=CYAN=GREY=BR=BG=BY=''
# no color values
O = ' [!] '
R = ' [-] '
GR = ' [*] '
G = ' [+] '
C = ' [+] '