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


Python Back.WHITE属性代码示例

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


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

示例1: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    try:
        # Highlight positives
        colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
        line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
        colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
        line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
        # Keyword highlight
        colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
        print(line)
    except Exception as e:
        pass 
开发者ID:Neo23x0,项目名称:munin,代码行数:18,代码来源:munin-host.py

示例2: printHighlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def printHighlighted(line, hl_color=Back.WHITE, tag_color=False):
    """
    Print a highlighted line
    """
    if tag_color:
        # Tags
        colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE|MSSOFT|SUCCESSFULLY\sCOMMENTED)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + '', line)
        colorer = re.compile('(REVOKED|EXPLOIT|CVE-[0-9\-]+|OBFUSCATED|RUN\-FILE)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + '', line)
        colorer = re.compile('(EXPIRED|VIA\-TOR|OLE\-EMBEDDED|RTF|ATTACHMENT|ASPACK|UPX|AUTO\-OPEN|MACROS)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + '', line)
    # Extras
    colorer = re.compile('(\[!\])', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.LIGHTMAGENTA_EX + r'\1' + Style.RESET_ALL + '', line)
    # Add line breaks
    colorer = re.compile('(ORIGNAME:)', re.VERBOSE)
    line = colorer.sub(r'\n\1', line)
    # Standard
    colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
    print(line) 
开发者ID:Neo23x0,项目名称:munin,代码行数:24,代码来源:munin_stdout.py

示例3: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    # Tags
    colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + ' ', line)
    colorer = re.compile('(SIG_REVOKED)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + ' ', line)
    colorer = re.compile('(SIG_EXPIRED)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + ' ', line)
    # Extras
    colorer = re.compile('(\[!\])', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.CYAN + r'\1' + Style.RESET_ALL + ' ', line)
    # Standard
    colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
    print line 
开发者ID:Neo23x0,项目名称:Loki,代码行数:20,代码来源:vt-checker.py

示例4: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    try:
        # Highlight positives
        colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
        line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
        colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
        line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
        # Keyword highlight
        colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
        print line
    except Exception, e:
        pass 
开发者ID:Neo23x0,项目名称:Loki,代码行数:18,代码来源:vt-checker-hosts.py

示例5: credits

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def credits():
	print("")
	print("")
	print("███╗   ███╗███████╗████████╗ █████╗ ███████╗ ██████╗ ██████╗  ██████╗ ███████╗")
	print("████╗ ████║██╔════╝╚══██╔══╝██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██╔════╝")
	print("██╔████╔██║█████╗     ██║   ███████║█████╗  ██║   ██║██████╔╝██║  ███╗█████╗  ")
	print("██║╚██╔╝██║██╔══╝     ██║   ██╔══██║██╔══╝  ██║   ██║██╔══██╗██║   ██║██╔══╝ ")
	print("██║ ╚═╝ ██║███████╗   ██║   ██║  ██║██║     ╚██████╔╝██║  ██║╚██████╔╝███████╗")
	print("╚═╝     ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝      ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚══════╝")
	print("")
	print("")
	print(Fore.WHITE + "An OSINT Metadata analyzing tool that filters through tags and creates reports")
	print("Version 1.3")
	print(Style.RESET_ALL)
	print(Fore.GREEN + "Authors: Chris Morris & Collin Mockbee")
	print("github.com/chriswmorris/Metaforge")
	print()
	print("=========================================================")
	print(Style.RESET_ALL)
	print(Fore.RED + "Remember to place the files you wish to analyze in this directory!")
	print(Style.BRIGHT +"-->  "+ ROOT_DIR + "/media  <--")
	print(Style.RESET_ALL)
	input("Press [ENTER] to continue")
	print() 
开发者ID:chriswmorris,项目名称:Metaforge,代码行数:26,代码来源:metaforge.py

示例6: printKeyLine

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def printKeyLine(line):
    """
    Print a given string as a separator line
    :param line:
    :return:
    """
    print(Fore.BLACK + Back.WHITE)
    print("{0}".format(line).ljust(80) + Style.RESET_ALL)
    print("") 
开发者ID:Neo23x0,项目名称:munin,代码行数:11,代码来源:munin_stdout.py

示例7: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def execute_command(self):
        """
        The generate command uses `Jinja2 <http://jinja.pocoo.org/>`_ templates \
        to create Python scripts, according to the specification in the configuration \
        file. The predefined templates use the extract_content() method of the \
        :ref:`selector classes <implementation-selectors>` to implement linear extractors \
        and use recursive for loops to implement multiple levels of link crawlers. This \
        implementation is effectively a representation of the traverse_next() \
        :ref:`utility function <implementation-utils>`, using the loop depth to \
        differentiate between levels of the crawler execution. 

        According to the --output_type argument in the CLI input, the results are \
        written into a JSON document or a CSV document. 

        The Python script is written into <output_filename>.py - running this file \
        is the equivalent of using the Scrapple :ref:`run command <command-run>`. 

        """
        print(Back.GREEN + Fore.BLACK + "Scrapple Generate")
        print(Back.RESET + Fore.RESET)
        directory = os.path.join(scrapple.__path__[0], 'templates', 'scripts')
        with open(os.path.join(directory, 'generate.txt'), 'r') as f:
            template_content = f.read()
        template = Template(template_content)
        try:
            with open(self.args['<projectname>'] + '.json', 'r') as f:
                config = json.load(f)
            if self.args['--output_type'] == 'csv':
                from scrapple.utils.config import extract_fieldnames
                config['fields'] = str(extract_fieldnames(config))
            config['output_file'] = self.args['<output_filename>']
            config['output_type'] = self.args['--output_type']
            rendered = template.render(config=config)
            with open(self.args['<output_filename>'] + '.py', 'w') as f:
                f.write(rendered)
            print(Back.WHITE + Fore.RED + self.args['<output_filename>'], \
                  ".py has been created" + Back.RESET + Fore.RESET, sep="")
        except IOError:
            print(Back.WHITE + Fore.RED + self.args['<projectname>'], ".json does not ", \
                  "exist. Use ``scrapple genconfig``." + Back.RESET + Fore.RESET, sep="") 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:42,代码来源:generate.py

示例8: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def execute_command(self):
        """
        The genconfig command depends on predefined `Jinja2 <http://jinja.pocoo.org/>`_ \
        templates for the skeleton configuration files. Taking the --type argument from the \
        CLI input, the corresponding template file is used. 

        Settings for the configuration file, like project name, selector type and URL \
        are taken from the CLI input and using these as parameters, the template is \
        rendered. This rendered JSON document is saved as <project_name>.json.
        
        """
        print(Back.GREEN + Fore.BLACK + "Scrapple Genconfig")
        print(Back.RESET + Fore.RESET)
        directory = os.path.join(scrapple.__path__[0], 'templates', 'configs')
        with open(os.path.join(directory, self.args['--type'] + '.txt'), 'r') as f:
            template_content = f.read()
        print("\n\nUsing the", self.args['--type'], "template\n\n")
        template = Template(template_content)
        settings = {
            'projectname': self.args['<projectname>'],
            'selector_type': self.args['--selector'],
            'url': self.args['<url>'],
            'levels': int(self.args['--levels'])
        }
        rendered = template.render(settings=settings)
        with open(self.args['<projectname>'] + '.json', 'w') as f:
            rendered_data = json.loads(rendered)
            json.dump(rendered_data, f, indent=3)
        print(Back.WHITE + Fore.RED + self.args['<projectname>'], ".json has been created" \
            + Back.RESET + Fore.RESET, sep="") 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:32,代码来源:genconfig.py

示例9: _back_color

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def _back_color(code):
    if code == 0 or (isinstance(code, str) and code.lower() == "white"):
        return Back.WHITE
    if code == 1 or (isinstance(code, str) and code.lower() == "cyan"):
        return Back.CYAN
    if code == 2 or (isinstance(code, str) and code.lower() == "red"):
        return Back.RED

    return Back.WHITE 
开发者ID:chubin,项目名称:cheat.sh,代码行数:11,代码来源:internal.py

示例10: print_welcome

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def print_welcome(self):

        if self.caller == 'main':
            print(Back.GREEN + " ".ljust(79) + Back.BLACK + Fore.GREEN)

            print("      __   ____  __ ______                            ")
            print ("     / /  / __ \/ //_/  _/                            ")
            print ("    / /__/ /_/ / ,< _/ /                              ")
            print ("   /____/\____/_/|_/___/                              ")
            print ("      ________  _____  ____                           ")
            print ("     /  _/ __ \/ ___/ / __/______ ____  ___  ___ ____ ")
            print ("    _/ // /_/ / /__  _\ \/ __/ _ `/ _ \/ _ \/ -_) __/ ")
            print ("   /___/\____/\___/ /___/\__/\_,_/_//_/_//_/\__/_/    ")

            print (Fore.WHITE)
            print ("   Copyright by Florian Roth, Released under the GNU General Public License")
            print ("   Version %s" % __version__)
            print ("  ")
            print ("   DISCLAIMER - USE AT YOUR OWN RISK")
            print ("   Please report false positives via https://github.com/Neo23x0/Loki/issues")
            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK)
            print (Fore.WHITE+''+Back.BLACK)

        else:
            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK + Fore.GREEN)

            print ("  ")
            print ("  LOKI UPGRADER ")

            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK)
            print (Fore.WHITE + '' + Back.BLACK) 
开发者ID:Neo23x0,项目名称:Loki,代码行数:36,代码来源:lokilogger.py

示例11: main

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def main():
    colorama.init()
    pos = lambda y, x: Cursor.POS(x, y)
    # draw a white border.
    print(Back.WHITE, end='')
    print('%s%s' % (pos(MINY, MINX), ' '*MAXX), end='')
    for y in range(MINY, 1+MAXY):
        print('%s %s ' % (pos(y, MINX), pos(y, MAXX)), end='')
    print('%s%s' % (pos(MAXY, MINX), ' '*MAXX), end='')
    # draw some blinky lights for a while.
    for i in range(PASSES):
        print('%s%s%s%s%s' % (pos(randint(1+MINY,MAXY-1), randint(1+MINX,MAXX-1)), choice(FORES), choice(BACKS), choice(STYLES), choice(CHARS)), end='')
    # put cursor to top, left, and set color to white-on-black with normal brightness.
    print('%s%s%s%s' % (pos(MINY, MINX), Fore.WHITE, Back.BLACK, Style.NORMAL), end='') 
开发者ID:tartley,项目名称:colorama,代码行数:16,代码来源:demo06.py

示例12: main

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def main():
    """ Register a new User or Authenticates the already registered User to send message """
    try:
        if auth.check_existed(CURRENT_USER):
            password = getpass(f"User {CURRENT_USER} found\nEnter password: ")
            payload = auth.authenticate(CURRENT_USER, password)
        else:
            print(f"Welcome {CURRENT_USER} to tmessage!\nPlease register...")
            displayed_name = input("Enter your name used for display: ")
            password = getpass("Enter password: ")
            password_confirm = getpass("Re-enter password: ")
            while password != password_confirm:
                print("Passwords do not match, please try again...")
                password = getpass("Enter password: ")
                password_confirm = getpass("Re-enter password: ")
            payload = auth.register(
                CURRENT_USER, displayed_name, password, password_confirm
            )
        print("User Authorized")
        user_name = payload["user_name"]
        displayed_name = payload["displayed_name"]

        MQTT_CLIENT.on_message = on_message
        MQTT_CLIENT.connect(BROKER_ENDPOINT, BROKER_PORT)
        MQTT_CLIENT.subscribe(MQTT_TOPIC)
        MQTT_CLIENT.loop_start()
        while True:
            raw_msg = MESSAGE_INPUT.get_input()
            formatted_msg = get_formatted_message(raw_msg)
            pub_msg = f"[{user_name}] {displayed_name}: {formatted_msg}"
            if raw_msg != "":
                MQTT_CLIENT.publish(MQTT_TOPIC, pub_msg)
                if IS_STORE:
                    store_messages(CURRENT_USER, formatted_msg)
            else:
                print(Back.WHITE + Fore.RED + "Can't send empty message", end="\n")
    except KeyboardInterrupt:
        # pylint: disable=pointless-statement
        MQTT_CLIENT.disconnect()
        Style.RESET_ALL
        deinit()
        print("\nGoodbye!")
    except ConnectionRefusedError:
        # pylint: disable=pointless-statement
        Style.RESET_ALL
        deinit()
        print("\nCan't connect please check your network connection")
    except Exception as err:  # pylint: disable=broad-except
        # pylint: disable=pointless-statement
        Style.RESET_ALL
        deinit()
        print(f"\n{err}") 
开发者ID:Haider8,项目名称:tmessage,代码行数:54,代码来源:cli.py

示例13: main

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def main():
    init(autoreset=False)

    print(Style.RESET_ALL)
    print(Fore.BLACK + Back.WHITE)
    print("   _    _   _    _   ______  _____  ______   ".ljust(80))
    print("  | |  | | | |  | | | | ____  | |  | |  \ \   (.\\ ".ljust(80))
    print("  | |--| | | |  | | | |  | |  | |  | |  | |   |/(\\ ".ljust(80))
    print("  |_|  |_| \_|__|_| |_|__|_| _|_|_ |_|  |_|    \\ \\\\".ljust(80))
    print("                                               \" \"'\\  ".ljust(80))
    print(" ".ljust(80))
    print("  Result Checker for Virustotal Retrohunts".ljust(80))
    print(("  " + __AUTHOR__ + " - " + __VERSION__ + "").ljust(80))
    print(" ".ljust(80) + Style.RESET_ALL)
    print(Style.RESET_ALL + " ")

    parser = argparse.ArgumentParser(description='Retrohunt Checker')
    parser.add_argument('-r', help='Name for the queried retrohunt', metavar='retrohunt-name', default='')
    parser.add_argument('-i', help='Name of the ini file that holds the VT API key', metavar='ini-file',
                        default=os.path.dirname(os.path.abspath(__file__)) + '/munin.ini')
    parser.add_argument('--csv-path', help='Write a CSV with the results', default='retrohunt_results.csv')
    parser.add_argument('--debug', action='store_true', default=False, help='Debug output')
    parser.add_argument('--no-comments', help='Skip VirusTotal comments', action='store_true', default=False)
    
    args = parser.parse_args()

    # PyMISP error handling > into Nirvana
    logger = logging.getLogger("pymisp")
    logger.setLevel(logging.CRITICAL)
    if args.debug:
        logger.setLevel(logging.DEBUG)

    # Read the config file
    config = configparser.ConfigParser()
    try:
        config.read(args.i)
        munin_vt.VT_PUBLIC_API_KEY = config['DEFAULT']['VT_PUBLIC_API_KEY']
        try:
            connections.setProxy(config['DEFAULT']['PROXY'])
        except KeyError as e:
            print("[E] Your config misses the PROXY field - check the new munin.ini template and add it to your "
                  "config to avoid this error.")
    except Exception as e:
        traceback.print_exc()
        print("[E] Config file '%s' not found or missing field - check the template munin.ini if fields have "
              "changed" % args.i)

    print("[+] Retrieving Retrohunt results ...")
    found_files = munin_vt.getRetrohuntResults(args.r, args.no_comments, args.debug)
    print("[+] Retrohunt results retrieved")

    csv_filename = args.csv_path

    writeCSVHeader(csv_filename)

    for i, file_info in enumerate(found_files):
        printResult(file_info, i, len(found_files))
        writeCSV(file_info, csv_filename) 
开发者ID:Neo23x0,项目名称:munin,代码行数:60,代码来源:hugin.py

示例14: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import WHITE [as 别名]
def execute_command(self):
        """
        The run command implements the web content extractor corresponding to the given \
        configuration file. 

        The execute_command() validates the input project name and opens the JSON \
        configuration file. The run() method handles the execution of the extractor run.

        The extractor implementation follows these primary steps :

        1. Selects the appropriate :ref:`selector class <implementation-selectors>` through \
        a dynamic dispatch, with the selector_type argument from the CLI input. 

        #. Iterate through the data section in level-0 of the configuration file. \
        On each data item, call the extract_content() method from the selector class to \
        extract the content according to the specified extractor rule. 

        #. If there are multiple levels of the extractor, i.e, if there is a 'next' \
        attribute in the configuration file, call the traverse_next() \
        :ref:`utility function <implementation-utils>` and parse through successive levels \
        of the configuration file.

        #. According to the --output_type argument, the result data is saved in a JSON \
        document or a CSV document. 

        """
        try:
            self.args['--verbosity'] = int(self.args['--verbosity'])
            if self.args['--verbosity'] not in [0, 1, 2]:
                raise ValueError
            if self.args['--verbosity'] > 0:
                print(Back.GREEN + Fore.BLACK + "Scrapple Run")
                print(Back.RESET + Fore.RESET)
            import json
            with open(self.args['<projectname>'] + '.json', 'r') as f:
                self.config = json.load(f)
            validate_config(self.config)
            self.run()
        except ValueError:
            print(Back.WHITE + Fore.RED + "Use 0, 1 or 2 for verbosity." \
                + Back.RESET + Fore.RESET, sep="")
        except IOError:
            print(Back.WHITE + Fore.RED + self.args['<projectname>'], ".json does not ", \
                  "exist. Use ``scrapple genconfig``." + Back.RESET + Fore.RESET, sep="")
        except InvalidConfigException as e:
            print(Back.WHITE + Fore.RED + e + Back.RESET + Fore.RESET, sep="") 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:48,代码来源:run.py


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