How to use the colorama.Fore function in colorama

To help you get started, we’ve selected a few colorama examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AUCyberClub / axion / imports / volatility_pslist.py View on Github external
def volatility_pslist():

    while True:

        check_call(["clear"])
        print (logo)
        colorprint("info","'volatility' will be used to list processes.")

        path = config_get('paths', 'path')
        if path == '':
            colorprint("fatal", "\n\tOh, it seems there is no path stored before :(")
            colorprint("fatal","\n\tPlease specify one to continue:\n")
            
            path = raw_input("Axion TERMINAL("+Style.BRIGHT+Fore.CYAN+"/ram_analysis/volatility_pslist"+Style.RESET_ALL+")\n-->")

            config_set('paths', 'path', path)
            colorprint("info", "\nWell, we'll store this path for next operations...\n")

        colorprint("success", "\n[*] Using "+path+"\n")

        colorprint("warn","9-->Go back to the top menu")
        colorprint("fatal","0-->Quit")

        choice = raw_input(Style.DIM + Fore.WHITE + "Press Enter to continue or 'p' to new path..." + Style.RESET_ALL).lower()

        if choice == "9":
            return
        elif choice == "0":
            sys.exit()
        if choice == 'p':
github gumob / music-dl / music_dl / core / args.py View on Github external
def error(self, message):
            self.print_usage(sys.stderr)
            args = {'prog': self.prog, 'message': message}
            msg = colorama.Fore.RED + _('\n[%(prog)s] Error: %(message)s\n\n') % args
            self.exit(2, msg)
github eevee / spline / spline / lib / logging.py View on Github external
def autoconfigure():
    # TODO what if logging is already handled?  i guess that's your problem?
    root = logging.getLogger()

    # Create a nice formatter with some nice defaults
    formatter = ColorFormatter(
        '{created} {levelname:>5s} [{name}][{threadName}] {message}',
    )
    formatter.set_level_colors(
        DEBUG=Fore.BLACK,
        INFO='',
        WARNING=Fore.YELLOW,
        ERROR=Fore.RED,
        CRITICAL=Fore.BLACK + Back.RED,
    )
    formatter.set_colors(
        created=Fore.BLACK,
    )

    # Send to stderr
    # TODO maybe don't always send to stderr
    handler = MaybeColoredStreamHandler(sys.stderr)
    handler.setFormatter(formatter)

    root.addHandler(handler)

    # TODO snag warnings too
    # TODO better handle exception tracebacks?
github lambdamusic / Ontospy / ontospy / extras / shell_lib.py View on Github external
# inferred stuff
            if print_inferred:
                for _dict in x.domain_of_inferred:
                    _class = list(_dict.items())[0][0]
                    _propslist = list(_dict.items())[0][1]
                    if _class.id != x.id and len(_propslist):  # print only inferred properties
                        self._print("[%d] Inherited from [%s]" % (len(_propslist), _class.qname),
                                    "IMPORTANT")
                        for i in _propslist:
                            if i.ranges:
                                ranges = ",".join([y.qname if hasattr(y, "qname")
                                                   else str(y) for y in i.ranges])
                            else:
                                ranges = "owl:Thing"
                                # print(Style.RESET_ALL + " => " + Fore.MAGENTA +
                            print(Fore.GREEN + x.qname + Style.RESET_ALL + " => " + Fore.MAGENTA +
                                  i.qname + Style.RESET_ALL + " => " + Style.DIM +
                                  ranges + Style.RESET_ALL)

            self._print("----------------")
        return
github Bee-Mar / mmpm / mmpm / colors.py View on Github external
#!/usr/bin/env python3
from colorama import Fore, Style

NORMAL_RED = Style.NORMAL + Fore.RED
BRIGHT_RED = Style.BRIGHT + Fore.RED

BRIGHT_MAGENTA = Style.NORMAL + Fore.MAGENTA
BRIGHT_MAGENTA = Style.BRIGHT + Fore.MAGENTA

NORMAL_CYAN = Style.NORMAL + Fore.CYAN
BRIGHT_CYAN = Style.BRIGHT + Fore.CYAN

NORMAL_YELLOW = Style.NORMAL + Fore.YELLOW
BRIGHT_YELLOW = Style.BRIGHT + Fore.YELLOW

NORMAL_WHITE = Style.NORMAL + Fore.WHITE
BRIGHT_WHITE = Style.BRIGHT + Fore.WHITE

NORMAL_GREEN = Style.NORMAL + Fore.GREEN
BRIGHT_GREEN = Style.BRIGHT + Fore.GREEN
github superhedgy / AttackSurfaceMapper / asm.py View on Github external
print(
                    " {0}|| SPF	: {1}".format(Fore.WHITE, Fore.GREEN + str(target_list[key].spf) + Style.RESET_ALL))
            else:
                print(" {0}|| SPF	: {1}".format(Fore.WHITE, Fore.RED + Style.BRIGHT + str(
                    target_list[key].spf) + Style.RESET_ALL))

        if len(target_list[key].dmarc) > 0:
            print(
                " {0}|| DMARC : {1}".format(Fore.WHITE, Fore.GREEN + target_list[key].dmarc_status + Style.RESET_ALL))
        else:
            print(" {0}|| DMARC : {1}".format(Fore.WHITE, Fore.RED + Style.BRIGHT + "False" + Style.RESET_ALL))

        # if len(target_list[key].pattern) > 0:
        #     print (" || Email Pattern Detected : {0}".format(Fore.RED+Style.BRIGHT+email.pattern+Style.RESET_ALL))

        print(" {0}|| dnsDumpster Map: {1}".format(Fore.WHITE, Fore.YELLOW + str(map_path) + Style.RESET_ALL))

        if args.screen_capture:
            print(
                Fore.WHITE + " || Screenshots: " + Fore.YELLOW + os.getcwd() + output_path + "/screenshots" + Style.RESET_ALL)

        # Scan each IP pointing to the same domain
        for ip in target_list[key].resolved_ips:
            print("")
            print(Fore.WHITE + " [-] IP Address: " + Style.BRIGHT + Fore.YELLOW + str(ip.address) + Style.RESET_ALL)
            if ip.hostname:
                print(Fore.WHITE + " 	|| Hostname: " + Fore.YELLOW + ','.join(map(str, ip.hostname)) + Style.RESET_ALL)
            if ip.server:
                print(Fore.WHITE + " 	|| Server: " + Fore.YELLOW + ip.server)
            if ip.ports:
                print(Fore.WHITE + " 	|| Ports: " + Fore.YELLOW + '/tcp, '.join(map(str, ip.ports)) + "/tcp" + Style.RESET_ALL)
            if ip.vulns:
github tonybaloney / mocker / mocker / __init__.py View on Github external
"""

_base_dir_ = os.path.join(os.path.expanduser('~'), 'mocker')

if not os.path.exists(_base_dir_):
    os.makedirs(_base_dir_)


# Courtesy http://plumberjack.blogspot.com/2010/12/colorizing-logging-output-in-terminals.html
# Tweaked to use colorama for the coloring


class ColorizingStreamHandler(logging.StreamHandler):
    color_map = {
        logging.DEBUG: colorama.Style.DIM + colorama.Fore.CYAN,
        logging.WARNING: colorama.Fore.YELLOW,
        logging.ERROR: colorama.Fore.RED,
        logging.CRITICAL: colorama.Back.RED,
    }

    def __init__(self, stream, color_map=None):
        logging.StreamHandler.__init__(self,
                                       colorama.AnsiToWin32(stream).stream)
        if color_map is not None:
            self.color_map = color_map

    @property
    def is_tty(self):
        isatty = getattr(self.stream, 'isatty', None)
        return isatty and isatty()

    def format(self, record):
github dfoderick / fullcycle / fullcyclepy / backend / when_provision.py View on Github external
def switchtopool(miner, pooltoswitch, minerpool):
    '''switch pool'''
    if minerpool is not None:
        #find pool number of default pool and switch to it
        switchtopoolnumber = minerpool.findpoolnumberforpool(pooltoswitch.url, pooltoswitch.user)
        if switchtopoolnumber is not None and switchtopoolnumber > 0:
            antminerhelper.switch(miner, switchtopoolnumber)
            print(Fore.YELLOW + PROVISION.app.now(), miner.name, 'switched to {0}({1})'.format(pooltoswitch.name, pooltoswitch.url))
        else:
            print(Fore.RED + PROVISION.app.now(), miner.name, 'could not switch to {0}({1})'.format(pooltoswitch.name, pooltoswitch.url))
github jtpereyda / boofuzz / boofuzz / helpers.py View on Github external
from boofuzz import ip_constants, udp_socket_connection

test_step_info = {
    "test_case": {
        "indent": 0,
        "title": "Test Case",
        "html": "Test Case: {msg}",
        "terminal": Fore.YELLOW + Style.BRIGHT + "Test Case: {msg}" + Style.RESET_ALL,
        "css_class": "log-case",
        "curses": 4,
    },
    "step": {
        "indent": 1,
        "title": "Test Step",
        "html": " Test Step: {msg}",
        "terminal": Fore.MAGENTA + Style.BRIGHT + "Test Step: {msg}" + Style.RESET_ALL,
        "css_class": "log-step",
        "curses": 6,
    },
    "info": {
        "indent": 2,
        "title": "Info",
        "html": "Info: {msg}",
        "terminal": "Info: {msg}",
        "css_class": "log-info",
        "curses": 1,
    },
    "error": {
        "indent": 2,
        "title": "Error",
        "html": "Error!!!! {msg}",
        "terminal": Back.RED + Style.BRIGHT + "Error!!!! {msg}" + Style.RESET_ALL,