How to use the colored.attr function in colored

To help you get started, we’ve selected a few colored 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 gwen001 / pentest-tools / gitpillage.py View on Github external
sys.stdout.write( "%s[-] %s%s\n" % (fg('dark_gray'),u,attr(0)) )
        return False

    if not r.status_code == 200:
        if t_multiproc['verbose']:
            sys.stdout.write( "%s[-] %s (%d)%s\n" % (fg('dark_gray'),u,r.status_code,attr(0)) )
        return False

    filename = saveObject( output_dir, object_id, r.content )
    real_filename = output_dir + '/' + real_filename

    try:
        cmd = 'cd ' + output_dir + '; git checkout ' + tmp[1]
        output = subprocess.check_output( cmd, stderr=subprocess.STDOUT, shell=True ).decode('utf-8')
        t_multiproc['n_success'] = t_multiproc['n_success'] + 1
        display = "[+] %s (%d) %s-> %s (%d)%s\n" % (u,r.status_code,fg('cyan'),real_filename,len(r.content),attr(0))
    except Exception as e:
        if t_multiproc['verbose']:
            display = "[-] %s (%d) %s-> %s%s\n" % (u,r.status_code,fg('yellow'),e,attr(0))
        return False
    
    sys.stdout.write( display )
github osrg / gobgp / test / lib / base.py View on Github external
def yellow(s):
    return fg('yellow') + str(s) + attr('reset')
github magicalraccoon / tootstream / src / tootstream / toot.py View on Github external
def format_toot_nameline(toot, dnamestyle):
    """Get the display, usernames and timestamp for a typical toot printout.

    dnamestyle: a fg/bg/attr set applied to the display name with stylize()"""
    # name line: display name, user@instance, lock if locked, timestamp
    if not toot: return ''
    formatted_time = format_time(toot['created_at'])

    display_name = format_display_name(toot['account']['display_name'])
    out = [stylize(display_name, dnamestyle),
           stylize(format_username(toot['account']), fg('green')),
           stylize(formatted_time, attr('dim'))]
    return ' '.join(out)
github nccgroup / house / houseStatic.py View on Github external
from colored import stylize

import frida
import sys
import requests
import json
# import IPython
import jinja2
import os
import cgi
from flask import render_template, request
import argparse

Error = colored.fg("red") + colored.attr("bold")
Info = colored.fg("green") + colored.attr("bold")
MightBeImportant = colored.fg("blue") + colored.attr("bold")

linebreak = "h0us3l1nebr3ak"
codeblock = "h0us3bl0ck"
delimiter = "h4oar3ud0ing"
github gwen001 / github-search / github-survey.py View on Github external
# sys.stdout.write( 'progress: %d/%d\n' %  (t_multi_datas['n_current'],t_multi_datas['n_total']) )
    t_multi_datas['n_current'] = t_multi_datas['n_current'] + 1

    try:
        u = 'https://api.github.com/search/code?sort=indexed&order=desc&q='+urllib.parse.quote(dork)
        r = requests.get( u, headers=headers, timeout=5 )
        t_json = r.json()
        if 'total_count' in t_json:
            if confirm:
                return int(t_json['total_count'])
            else:
                t_results[dork] = t_json
        else:
            return False
    except Exception as e:
        sys.stdout.write( "%s[-] error occurred: %s%s\n" % (fg('red'),e,attr(0)) )
        return False
github python-tableformatter / tableformatter / tableformatter / colors.py View on Github external
class TableColors(object):
    """Colors"""
    try:
        from colored import fg, bg, attr

        TEXT_COLOR_WHITE = fg('white')
        TEXT_COLOR_YELLOW = fg(226)
        TEXT_COLOR_RED = fg(196)
        TEXT_COLOR_GREEN = fg(119)
        TEXT_COLOR_BLUE = fg(27)
        BG_COLOR_ROW = bg(244)
        BG_RESET = attr('reset')  # docs say bg(0) should do this but it doesn't work right
        BOLD = attr('bold')
        RESET = attr('reset')
    except ImportError:
        try:
            from colorama import Fore, Back, Style

            TEXT_COLOR_WHITE = Fore.WHITE
            TEXT_COLOR_YELLOW = Fore.LIGHTYELLOW_EX
            TEXT_COLOR_RED = Fore.LIGHTRED_EX
            TEXT_COLOR_GREEN = Fore.LIGHTGREEN_EX
            TEXT_COLOR_BLUE = Fore.LIGHTBLUE_EX
            BG_COLOR_ROW = Back.LIGHTBLACK_EX
            BG_RESET = Back.RESET
            BOLD = Style.BRIGHT
            RESET = Style.NORMAL + Fore.RESET + Back.RESET
        except ImportError: