当前位置: 首页>>代码示例>>Python>>正文


Python termcolor.colored方法代码示例

本文整理汇总了Python中termcolor.colored方法的典型用法代码示例。如果您正苦于以下问题:Python termcolor.colored方法的具体用法?Python termcolor.colored怎么用?Python termcolor.colored使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在termcolor的用法示例。


在下文中一共展示了termcolor.colored方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connect

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def connect(self):
        """Call to set connection with remote client."""

        try:
            self.paramiko_session = paramiko.SSHClient()
            self.paramiko_session.set_missing_host_key_policy(
                paramiko.AutoAddPolicy())

            self.paramiko_session.connect(
                self.client.ip, username=self.client.user,
                password=self.client.pass_, key_filename=self.client.key,
                allow_agent=True, compress=self.client.compress)

        except (paramiko.AuthenticationException,
                paramiko.ssh_exception.NoValidConnectionsError) as e:
            self.logger.error(e)
            sys.exit(colored("> {}".format(e), 'red'))

        except paramiko.SSHException as e:
            self.logger.error(e)
            sys.exit(colored("> {}".format(e), 'red'))

        self.transfer = network.Network(
            self.paramiko_session, self.client.ip, self.client.port)
        self.transfer.open() 
开发者ID:kd8bny,项目名称:LiMEaide,代码行数:27,代码来源:network.py

示例2: stdin

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def stdin(message, params, upper=False, lower=False):
    """ask for option/input from user"""

    symbol = colored("[OPT]", "magenta")
    currentime = colored("[{}]".format(time.strftime("%H:%M:%S")), "green")

    option = raw_input("{} {} {}: ".format(symbol, currentime, message))

    if upper:
        option = option.upper()
    elif lower:
        option = option.lower()

    while option not in params:
        option = raw_input("{} {} {}: ".format(symbol, currentime, message))

        if upper:
            option = option.upper()
        elif lower:
            option = option.lower()

    return option 
开发者ID:the-robot,项目名称:sqliv,代码行数:24,代码来源:std.py

示例3: _check_previous_installation

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def _check_previous_installation():
    """
    Check if previous installation present
    Creates empty documentation if none detected
    :return:
    """
    if not os.path.exists(docks_dir + '/mkdocs.yml'):
        print(colored(
            f'No documentation found in ({docks_dir}). Creating new one.', 'yellow'))
        if not os.path.exists(docks_dir):
            os.mkdir(docks_dir)
        print(colored(f'Starting fresh installation', 'green'))
        os.system(f'mkdocs new {docks_dir}/')
    else:
        print(
            colored(f'Detected previous installation in ({docks_dir}).', 'green')) 
开发者ID:pozgo,项目名称:docker-mkdocs,代码行数:18,代码来源:common.py

示例4: format

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def format(self, record):
        date = colored('[%(asctime)s @%(filename)s:%(lineno)d]', 'green')
        msg = '%(message)s'
        if record.levelno == logging.WARNING:
            fmt = date + ' ' + colored('WRN', 'red', attrs=['blink']) + ' ' + msg
        elif record.levelno == logging.ERROR or record.levelno == logging.CRITICAL:
            fmt = date + ' ' + colored('ERR', 'red', attrs=['blink', 'underline']) + ' ' + msg
        elif record.levelno == logging.DEBUG:
            fmt = date + ' ' + colored('DBG', 'yellow', attrs=['blink']) + ' ' + msg
        else:
            fmt = date + ' ' + msg
        if hasattr(self, '_style'):
            # Python3 compatibility
            self._style._fmt = fmt
        self._fmt = fmt
        return super(_MyFormatter, self).format(record) 
开发者ID:tensorpack,项目名称:dataflow,代码行数:18,代码来源:logger.py

示例5: printAvailableFormats

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def printAvailableFormats(banner):
    print(colored(banner, 'green'))
    print("    Supported Office formats:")
    for fileType in MSTypes.MS_OFFICE_FORMATS:
        print("       - %s: %s" % (fileType, MSTypes.EXTENSION_DICT[fileType]))
    print("    Note: Ms Office file generation requires Windows OS with MS Office application installed.")
    print("\n    Supported VB formats:")
    for fileType in MSTypes.VBSCRIPTS_FORMATS:
        print("       - %s: %s" % (fileType, MSTypes.EXTENSION_DICT[fileType]))
    print("\n    Supported shortcuts/miscellaneous formats:")
    for fileType in MSTypes.Shortcut_FORMATS:
        print("       - %s: %s" % (fileType, MSTypes.EXTENSION_DICT[fileType]))
    print("\n    WARNING: These formats are only supported in MacroPack Pro:")
    for fileType in MSTypes.ProMode_FORMATS:
        print("       - %s: %s" % (fileType, MSTypes.EXTENSION_DICT[fileType]))
        
    print("\n     To create a payload for a certain format just add extension to payload.\n     Ex.  -G payload.hta ")
    if MP_TYPE=="Pro":
        printAvailableFormatsPro() 
开发者ID:sevagas,项目名称:macro_pack,代码行数:21,代码来源:help.py

示例6: printCommunityUsage

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def printCommunityUsage(banner, currentApp, mpSession):
    print(colored(banner, 'green'))
    print(" Usage 1: echo  <parameters> | %s -t <TEMPLATE> -G <OUTPUT_FILE> [options] " %currentApp)
    print(" Usage 2: %s  -f input_file_path -G <OUTPUT_FILE> [options] " % currentApp)
    print(" Usage 3: more input_file_path | %s -G <OUTPUT_FILE> [options] " %currentApp)
    
    details = getCommunityUsage(currentApp)
   
    details +="    -h, --help   Displays help and exit"
    details += \
r"""

 Notes:
    Have a look at README.md file for more details and usage!
    Home: www.github.com/sevagas && blog.sevagas.com

"""
    print(details) 
开发者ID:sevagas,项目名称:macro_pack,代码行数:20,代码来源:help.py

示例7: printProUsage

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def printProUsage(banner, currentApp, mpSession):
    print(colored(banner, 'green'))
    print(" Usage 1: echo  <parameters> | %s -t <TEMPLATE> -G <OUTPUT_FILE> [options] " %currentApp)
    print(" Usage 2: %s  -f input_file_path -G <OUTPUT_FILE> [options] " % currentApp)
    print(" Usage 3: more input_file_path | %s -G <OUTPUT_FILE> [options] " %currentApp)
    details = """
%s
%s

%s
%s

%s
%s

""" % (getGenerationFunction(currentApp), getGenerationFunctionPro(), getAvBypassFunction(currentApp), getAvBypassFunctionPro(), getOtherFunction(currentApp), getOtherFunctionPro())
    details +="    -h, --help   Displays help and exit \n"

    print(details) 
开发者ID:sevagas,项目名称:macro_pack,代码行数:21,代码来源:help.py

示例8: CheckGetVuln

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def CheckGetVuln(url, vuln, html):
    global currenttested
    global reponsetime
    
    if currenttested == "blind":
        return CheckGetBlind(url, vuln, html)
    
    validproof = CheckValidProof(html)
    payloadedurl = url + vuln
    
    while True:
        starttime = time.time()
        page = GetHTML(payloadedurl)
        endtime = time.time()
        if (currenttested != "timebase") or (reponsetime * 3 + 2 > endtime - starttime):
            break

    for ivalidproof in validproof:
        if (ivalidproof in page) or (currenttested == "timebase" and (endtime - starttime) >= (reponsetime + 2)):
            bar.printabove(colored("[GET] ", "green", attrs=["bold"]) + colored(url, "green") + colored(vuln, "red", attrs=["bold"]))
            return payloadedurl
    return False 
开发者ID:bambish,项目名称:ScanQLi,代码行数:24,代码来源:function.py

示例9: CheckPostBlind

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def CheckPostBlind(url, blindlist, fields, html):
    datatrue = {}
    datafalse = {}
    
    for field in fields:
        datatrue.update({field:blindlist[0]})
    for field in fields:
        datafalse.update({field:blindlist[1]})

    blindtrue = PostData(url, datatrue)
    blindfalse = PostData(url, datafalse)

    if (blindtrue == html) and (blindtrue != blindfalse):
        printpayload = colored("{", "yellow")
        icomma = 1
        for field in fields:
            printpayload = printpayload + colored(field + ":", "yellow") + colored(blindlist[1], "red", attrs=["bold"])
            if icomma != len(fields):
                printpayload = printpayload + colored(", ", "yellow")
            icomma += 1
        printpayload = printpayload + colored("}", "yellow")
        bar.printabove(colored("[POST] ", "yellow", attrs=["bold"]) + colored(url, "yellow") + colored(" [PARAM] ", "yellow", attrs=["bold"]) + printpayload)
        return [url, blindfalse]
    else:
        return False 
开发者ID:bambish,项目名称:ScanQLi,代码行数:27,代码来源:function.py

示例10: formatException

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def formatException(exc_info):
		tb_lines = traceback.format_exception(*exc_info)
		tb_lines[0] = termcolor.colored(tb_lines[0], 'red', attrs=['bold'])
		for line_no, line in enumerate(tb_lines[1:], 1):
			search = re.search(r'File \"([^"]+)", line ([\d,]+), in', line)
			if search:
				new_line = line[:search.start(1)]
				new_line += termcolor.colored(search.group(1), 'yellow', attrs=['underline'])
				new_line += line[search.end(1):search.start(2)]
				new_line += termcolor.colored(search.group(2), 'white', attrs=['bold'])
				new_line += line[search.end(2):]
				tb_lines[line_no] = new_line
		line = tb_lines[-1]
		if line.find(':'):
			idx = line.find(':')
			line = termcolor.colored(line[:idx], 'red', attrs=['bold']) + line[idx:]
		if line.endswith(os.linesep):
			line = line[:-len(os.linesep)]
		tb_lines[-1] = line
		return ''.join(tb_lines) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:22,代码来源:color.py

示例11: log_request

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def log_request(self, code='-', size='-'):
        msg = self.requestline
        code = str(code)

        if termcolor:
            color = termcolor.colored

            if code[0] == '1':    # 1xx - Informational
                msg = color(msg, attrs=['bold'])
            elif code[0] == '2':    # 2xx - Success
                msg = color(msg, color='white')
            elif code == '304':   # 304 - Resource Not Modified
                msg = color(msg, color='cyan')
            elif code[0] == '3':  # 3xx - Redirection
                msg = color(msg, color='green')
            elif code == '404':   # 404 - Resource Not Found
                msg = color(msg, color='yellow')
            elif code[0] == '4':  # 4xx - Client Error
                msg = color(msg, color='red', attrs=['bold'])
            else:                 # 5xx, or any other response
                msg = color(msg, color='magenta', attrs=['bold'])

        self.log('info', '"%s" %s %s', msg, code, size) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:25,代码来源:serving.py

示例12: colorize

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def colorize(status):
    msg = {}
    if os.getenv("APPR_COLORIZE_OUTPUT", "true") == "true":
        msg = {
            'ok': 'green',
            'created': 'yellow',
            'updated': 'cyan',
            'replaced': 'yellow',
            'absent': 'green',
            'deleted': 'red',
            'protected': 'magenta'}
    color = msg.get(status, None)
    if color:
        return colored(status, color)
    else:
        return status 
开发者ID:app-registry,项目名称:appr,代码行数:18,代码来源:utils.py

示例13: __download_lime__

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def __download_lime__(self):
        """Download LiME from GitHub"""

        cprint("Downloading LiME", 'green')
        try:
            urllib.request.urlretrieve(
                "https://github.com/504ensicsLabs/LiME/archive/" +
                "v{}.zip".format(
                    self.lime_version), filename="./tools/lime_master.zip")
            zip_lime = zipfile.ZipFile("./tools/lime_master.zip", 'r')
            zip_lime.extractall(self.tools_dir)
            zip_lime.close()
            shutil.move(
                './tools/LiME-{}'.format(self.lime_version), './tools/LiME/')
        except urllib.error.URLError:
            sys.exit(colored(
                "LiME failed to download. Check your internet connection" +
                " or place manually", 'red')) 
开发者ID:kd8bny,项目名称:LiMEaide,代码行数:20,代码来源:config.py

示例14: stdout

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def stdout(message, end="\n"):
    """print a message for user in console"""

    symbol = colored("[MSG]", "yellow")
    currentime = colored("[{}]".format(time.strftime("%H:%M:%S")), "green")
    print("{} {} {}".format(symbol, currentime, message), end=end) 
开发者ID:the-robot,项目名称:sqliv,代码行数:8,代码来源:std.py

示例15: stderr

# 需要导入模块: import termcolor [as 别名]
# 或者: from termcolor import colored [as 别名]
def stderr(message, end="\n"):
    """print an error for user in console"""

    symbol = colored("[ERR]", "red")
    currentime = colored("[{}]".format(time.strftime("%H:%M:%S")), "green")
    print("{} {} {}".format(symbol, currentime, message), end=end) 
开发者ID:the-robot,项目名称:sqliv,代码行数:8,代码来源:std.py


注:本文中的termcolor.colored方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。