How to use the colorama.Back 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 chrispetrou / FastAudit / wp / utils.py View on Github external
from socket import *
from urlparse import urlparse
from bs4 import BeautifulSoup
from datetime import datetime
try:
    import shodan
    from tabulate import tabulate
    from fake_useragent import UserAgent
    from colorama import Fore,Back,Style
except ImportError, error:
    print '\n[!] Please install missing modules!\n'
    sys.exit(0)

# console colors
B, S, F  = Style.BRIGHT, Style.RESET_ALL, Fore.RESET
G, RD, Y, R, BR, C  = Fore.GREEN, Fore.RED, Fore.YELLOW, Back.RED, Back.RESET, Fore.CYAN

class FastAudit():

    def __init__(self, url, proxy=False, host=None, port=None, sha1pass=None, save=False, enumUsrs=False, enumPlgs=False, shodan_api=False, shodan_key=None, useragent=False):
        self.__url       = url
        self.__proxy     = proxy
        self.__host      = host
        self.__port      = port
        self.__save      = save
        self.__pass      = sha1pass
        self.__shodan    = shodan_api
        self.__key       = shodan_key
        self.__totalreqs = 0 # counts total requests made
        self.__starttime = datetime.now()

        # set user-agent
github voussoir / else / Toddo / toddo.py View on Github external
def colorama_print(text):
    alternator = False
    terminal_size = shutil.get_terminal_size()[0]
    for line in text.split('\n'):
        line = line.ljust(terminal_size, ' ')
        if HAS_COLORAMA:
            if alternator:
                sys.stdout.write(colorama.Fore.BLACK)
                sys.stdout.write(colorama.Back.WHITE)
            else:
                sys.stdout.write(colorama.Fore.WHITE)
                sys.stdout.write(colorama.Back.BLACK)
        alternator = not alternator
        # \r because the ljust puts us on the next line, no need for \n
        print(line, end='\r', flush=True)
    if HAS_COLORAMA:
        sys.stdout.write(colorama.Back.RESET)
        sys.stdout.write(colorama.Fore.RESET)
        sys.stdout.flush()
github pyta-uoft / pyta / sample_usage / print_nodes.py View on Github external
def _wrap_color(code_string):
    """Wrap key parts in styling and resets.
    Stying for each key part from, 
    (col_offset, fromlineno) to (end_col_offset, end_lineno).
    Note: use this to set color back to default (on mac, and others?): 
          Style.RESET_ALL + Style.DIM
    """
    ret = Style.BRIGHT + Fore.WHITE + Back.BLACK
    ret += code_string
    ret += Style.RESET_ALL + Style.DIM + Fore.RESET + Back.RESET
    return ret
github denoland / chromium_build / android / apk_operations.py View on Github external
def _GetPriorityStyle(self, priority, dim=False):
    # pylint:disable=no-self-use
    if dim:
      return ''
    style = colorama.Fore.BLACK
    if priority == 'E' or priority == 'F':
      style += colorama.Back.RED
    elif priority == 'W':
      style += colorama.Back.YELLOW
    elif priority == 'I':
      style += colorama.Back.GREEN
    elif priority == 'D':
      style += colorama.Back.BLUE
    return style
github wolfg1969 / oh-my-stars / ohmystars / view.py View on Github external
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
github Neo23x0 / Loki / tools / vt-checker.py View on Github external
except Exception, e:
                if debug:
                    traceback.print_exc()
                    # print "Error requesting VT results"
                pass

        # Process results
        result = "- / -"
        virus = "-"
        last_submitted = "-"
        first_submitted = "-"
        filenames = "-"
        filetype = "-"
        rating = "unknown"
        positives = 0
        res_color = Back.CYAN
        md5 = "-"
        sha1 = "-"
        sha256 = "-"
        imphash = "-"
        harmless = ""
        signed = ""
        revoked = ""
        expired = ""
        mssoft = ""
        vendor_result_string = "-"

        if response_dict.get("response_code") > 0:
            # Hashes
            md5 = response_dict.get("md5")
            sha1 = response_dict.get("sha1")
            sha256 = response_dict.get("sha256")
github infobyte / faraday / faraday / client / start_client.py View on Github external
if not args.disable_excepthook:
        logger.info("Main application ExceptHook enabled.")
        main_app.enableExceptHook()

    logger.info("Starting main application.")
    start = main_app.start

    from colorama import Fore, Back, Style
    serverURL = getInstanceConfiguration().getServerURI()
    if serverURL:
        url = "%s/_ui" % serverURL
        print(Fore.WHITE + Style.BRIGHT + "\n* " + "Faraday UI is ready")
        print(
            Fore.WHITE + Style.BRIGHT + "Point your browser to: \n[%s]" % url)

    print(Fore.RESET + Back.RESET + Style.RESET_ALL)

    exit_status = start()

    return exit_status
github Evidlo / passhole / passhole / passhole.py View on Github external
kp = open_database(**vars(args))

    entry = get_entry(kp, args.path)
    # show specified field
    if args.field:
        # handle lowercase field input gracefully
        field = get_field(entry, args.field)
        print(entry._get_string_field(field), end='')

    # otherwise, show all fields
    else:
        print(green("Title: ") + (entry.title or ''))
        print(green("UserName: ") + (entry.username or ''))
        print(
            green("Password: ") + Fore.RED + Back.RED +
            (entry.password or '') +
            Fore.RESET + Back.RESET
        )
        print(green("URL: ") + (entry.url or ''))
        for field_name, field_value in entry.custom_properties.items():
            print(green("{}: ".format(field_name)) + str(field_value or ''))
        print(green("Created: ") + entry.ctime.isoformat())
        print(green("Modified: ") + entry.mtime.isoformat())
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?

    # OK, cool.  Now deal with levels.
github benoitc / gaffer / gaffer / console_output.py View on Github external
def status_bar(s):
    print(''.join([Style.BRIGHT, Fore.WHITE, Back.BLACK, s,
        Style.RESET_ALL]))