Python colorama.Style.RESET_ALL Examples

The following are 30 code examples of colorama.Style.RESET_ALL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module colorama.Style , or try the search function .
Example #1
Source File: core.py    From shellpy with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
def sreadline(self):
        line = self._file.readline()
        if sys.version_info[0] == 3:
            line = line.decode(self._encoding)

        if line == '':
            raise StopIteration
        else:
            line = line.rstrip(os.linesep)
            if self._print_out_stream:
                if self._color is None:
                    _print_stdout(line)
                else:
                    _print_stdout(self._color + line + Style.RESET_ALL)

            return line 
Example #2
Source File: output.py    From drydock with GNU General Public License v2.0 6 votes vote down vote up
def print_results(self,results):
    try:
      if results['status'] == 'Pass':
        print ("Status: " + Fore.GREEN + 'Pass' + Fore.RESET)
      elif results['status'] == 'Fail':
        print ("Status: " + Fore.RED + 'Fail' + Fore.RESET)
    except KeyError:
      pass
    except TypeError:
      pass
    print "Description: " + results['descr']
    try:
      res = str(results['output'])
      print "Output: "
      print(Style.DIM + res + Style.RESET_ALL)
    except KeyError:
      pass
    print "\n" 
Example #3
Source File: bmi.py    From Jarvis with MIT License 6 votes vote down vote up
def print_body_state(self, jarvis, bmi):
        """
        According the bmi number, print_body_state finds out the state of the body
        and prints it to the user using colorama library for some coloring
        """
        print("BMI:", str(bmi))
        if bmi < 16:
            print(Back.RED, " " * 2, Style.RESET_ALL)
            jarvis.say('Severe thinness')
        elif bmi < 18.5:
            print(Back.YELLOW, " " * 2, Style.RESET_ALL)
            jarvis.say('Mild thinness')
        elif bmi < 25:
            print(Back.GREEN, " " * 2, Style.RESET_ALL)
            jarvis.say('Healthy')
        elif bmi < 30:
            print(Back.YELLOW, " " * 2, Style.RESET_ALL)
            jarvis.say('Pre-obese')
        else:
            print(Back.RED, " " * 2, Style.RESET_ALL)
            jarvis.say('Obese') 
Example #4
Source File: munin-host.py    From munin with Apache License 2.0 6 votes vote down vote up
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 
Example #5
Source File: munin_stdout.py    From munin with Apache License 2.0 6 votes vote down vote up
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) 
Example #6
Source File: core.py    From shellpy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def exe(cmd, params):
    """This function runs after preprocessing of code. It actually executes commands with subprocess

    :param cmd: command to be executed with subprocess
    :param params: parameters passed before ` character, i.e. p`echo 1 which means print result of execution
    :return: result of execution. It may be either Result or InteractiveResult
    """

    global _colorama_intialized
    if _is_colorama_enabled() and not _colorama_intialized:
        _colorama_intialized = True
        colorama.init()

    if config.PRINT_ALL_COMMANDS:
        if _is_colorama_enabled():
            _print_stdout(Fore.GREEN + '>>> ' + cmd + Style.RESET_ALL)
        else:
            _print_stdout('>>> ' + cmd)

    if _is_param_set(params, _PARAM_INTERACTIVE):
        return _create_interactive_result(cmd, params)
    else:
        return _create_result(cmd, params) 
Example #7
Source File: draw.py    From rate.sx with MIT License 6 votes vote down vote up
def _colorize(self, text):

        palette = PALETTES[self.palette]
        palette_reverse = PALETTES_REVERSE[self.palette]

        def _colorize_curlies_block(text):

            text = text.group()[1:-1]
            stripped = text.lstrip('0123456789-')
            color_number = int(text[:len(text)-len(stripped)])

            reverse = False
            if color_number < 0:
                color_number = -color_number
                reverse = True

            if reverse:
                stripped = palette_reverse[color_number] + stripped + Style.RESET_ALL
            else:
                stripped = palette[color_number] + stripped + Style.RESET_ALL

            return stripped

        return re.sub("{.*?}", _colorize_curlies_block, text) 
Example #8
Source File: colloide.py    From colloide with GNU General Public License v3.0 6 votes vote down vote up
def check_names(infile):    #Checking the path to the wordlist
	if os.path.exists(infile):
		if status_method:
			banner()    #calls the banner function
			checkasciiwolf()      #calls the sexy ASCII wolf wallpaper
			scan_start()
			statusfindAdmin() #calls the function that basically does the job
			print(Fore.RED + Style.BRIGHT + "\n[+] Rock bottom;\n" + Style.RESET_ALL)
		elif error_method:
			banner()
			checkasciiwolf()
			scan_start()
			findAdmin()
			print(Fore.RED + Style.BRIGHT + "\n[+] Rock bottom;\n" + Style.RESET_ALL)
	else: #in case wordlist cant be found
		banner()
		opts()
		print(Fore.RED + Style.BRIGHT + "[-] Invalid path to the wordlist. File could not be found.\n" + Style.RESET_ALL)
# THIS IS THE STATUS CODE METHOD 
Example #9
Source File: Basic.py    From URS with MIT License 6 votes vote down vote up
def get_settings(self, master, subs):
        for sub in subs:
            while True:
                try:
                    cat_i = int(input((Style.BRIGHT + """
Select a category to display for r/%s
-------------------
    0: Hot
    1: New
    2: Controversial
    3: Top
    4: Rising
    5: Search
-------------------
        """ + Style.RESET_ALL) % sub))

                    if cat_i == 5:
                        print("\nSelected search")
                        self._get_search(cat_i, master, sub)
                    else:
                        print("\nSelected category: %s" % self._categories[cat_i])
                        self._get_n_results(cat_i, master, sub)
                    break
                except (IndexError, ValueError):
                    print("Not an option! Try again.") 
Example #10
Source File: personality.py    From Jarvis with MIT License 6 votes vote down vote up
def __init__(self):
        self.Q = read_questions()
        self.answers = {}
        self.instruction = Back.YELLOW + "There are a total of " +\
            "32 pairs of descriptions. For each pair, choose on a scale of " +\
            "1-5. Choose 1 if you are all the way to the left, and choose " +\
            "3 if you are in the middle, etc." + Style.RESET_ALL

        self.types = ['IE', 'SN', 'FT', 'JP']
        self.scoring_scheme = ((30, (15, 23, 27), (3, 7, 11, 19, 31)),
                               (12, (4, 8, 12, 16, 20, 32), (24, 28)),
                               (30, (6, 10, 22), (2, 14, 18, 26, 30)),
                               (18, (1, 5, 13, 21, 29), (9, 17, 25)))

        self.scores = []
        self.type = [] 
Example #11
Source File: Basic.py    From URS with MIT License 6 votes vote down vote up
def get_subreddits(self, parser, reddit):
        subreddit_prompt = Style.BRIGHT + """
Enter Subreddit or a list of Subreddits (separated by a space) to scrape:

""" + Style.RESET_ALL

        while True:
            try:
                search_for = str(input(subreddit_prompt))
                if not search_for:
                    raise ValueError
                return PrintSubs().print_subreddits(parser, reddit, search_for)
            except ValueError:
                print("No Subreddits were specified! Try again.")

    ### Update Subreddit settings in master dictionary. 
Example #12
Source File: output.py    From h2t with MIT License 6 votes vote down vote up
def print_line(message, level=1, category = None, title = None, status=False):
    sts = get_status(category, status)

    if sts == 'applied':
        color = Fore.GREEN
        pre = '[+] '
    elif sts == 'touse':
        color = Fore.YELLOW
        pre = '[+] '
    elif sts == 'toremove':
        color = Fore.RED
        pre = '[-] '
    else:
        color = ''
        pre = ''

    if title:
        print(' '*4*level + Style.BRIGHT + title + ': ' + Style.RESET_ALL + message)
    else:
        print(' '*4*level + color + Style.BRIGHT + pre + Fore.RESET + message) 
Example #13
Source File: phoneinfoga.py    From Phoneinfoga with GNU General Public License v3.0 6 votes vote down vote up
def scanNumber(InputNumber):
    print(code_title + "[!] ---- Fetching informations for {} ---- [!]".format(formatNumber(InputNumber)))

    localScan(InputNumber)

    global number
    global localNumber
    global internationalNumber
    global numberCountryCode
    global numberCountry

    if not number:
        print((code_error + "Error: number {} is not valid. Skipping.".format(formatNumber(InputNumber))))
        sys.exit()

    numverifyScan()
    ovhScan()
    osintScan()

    print(code_info + "Scan finished.")

    print('\n' + Style.RESET_ALL) 
Example #14
Source File: colloide08.py    From colloide with GNU General Public License v3.0 5 votes vote down vote up
def check_names(infile):    #Checking the path to the wordlist
	if os.path.exists(infile):
		banner()    #calls the banner function
		wolf()      #calls the sexy ASCII wolf wallpaper
		findAdmin() #calls the function that basically does the job 
	else: #in case wordlist cant be found
		banner()
		opts()
		print(Fore.RED + Style.BRIGHT + "[-] Invalid path to the wordlist. File could not be found.\n" + Style.RESET_ALL) 
Example #15
Source File: colors.py    From drone with MIT License 5 votes vote down vote up
def bright_foreground(self):
        color = {
            'red'       : '{0}{1}'.format(Fore.RED, Style.BRIGHT),
            'cyan'      : '{0}{1}'.format(Fore.CYAN, Style.BRIGHT),
            'green'     : '{0}{1}'.format(Fore.GREEN, Style.BRIGHT),
            'yellow'    : '{0}{1}'.format(Fore.YELLOW, Style.BRIGHT),
            'blue'      : '{0}{1}'.format(Fore.BLUE, Style.BRIGHT),
            'magenta'   : '{0}{1}'.format(Fore.MAGENTA, Style.BRIGHT),
            'white'     : '{0}{1}'.format(Fore.WHITE, Style.BRIGHT),
            'grey'      : '{0}{1}'.format(Fore.WHITE, Style.RESET_ALL)
        }
        return color 
Example #16
Source File: colloide09.py    From colloide with GNU General Public License v3.0 5 votes vote down vote up
def check_names(infile):    #Checking the path to the wordlist
	if os.path.exists(infile):
		if status_method:
			banner()    #calls the banner function
			wolf()      #calls the sexy ASCII wolf wallpaper
			statusfindAdmin() #calls the function that basically does the job
		elif error_method:
			banner()  
			wolf()
			findAdmin() 
	else: #in case wordlist cant be found
		banner()
		opts()
		print(Fore.RED + Style.BRIGHT + "[-] Invalid path to the wordlist. File could not be found.\n" + Style.RESET_ALL)
# THIS IS THE STATUS CODE METHOD 
Example #17
Source File: phoneinfoga.py    From Phoneinfoga with GNU General Public License v3.0 5 votes vote down vote up
def resetColors():
    if not args.output:
        print(Style.RESET_ALL)

# Reset text color at exit 
Example #18
Source File: munin_stdout.py    From munin with Apache License 2.0 5 votes vote down vote up
def printSeparator(count, total, color, rating):
    """
    Print a separator line status infos
    :param count:
    :param total:
    :return:
    """
    print(Fore.BLACK + color)
    print(" {0} / {1} > {2}".format(count+1, total, rating.title()).ljust(80) + Style.RESET_ALL) 
Example #19
Source File: munin_stdout.py    From munin with Apache License 2.0 5 votes vote down vote up
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("") 
Example #20
Source File: script_utils.py    From clove with GNU General Public License v3.0 5 votes vote down vote up
def print_section(*args):
    print(Fore.GREEN, '▶', ' '.join(map(str, args)), Style.RESET_ALL) 
Example #21
Source File: script_utils.py    From clove with GNU General Public License v3.0 5 votes vote down vote up
def print_error(*args):
    print(Fore.RED, '●', ' '.join(map(str, args)), Style.RESET_ALL) 
Example #22
Source File: config.py    From onshape-to-robot with MIT License 5 votes vote down vote up
def configGet(name, default=None):
    global config
    if name in config:
        return config[name]
    else:
        if default is None:
            print(Fore.RED + 'ERROR: missing key "'+name+'" in config' + Style.RESET_ALL)
            exit()
        else:
            return default 
Example #23
Source File: colloide101.py    From colloide with GNU General Public License v3.0 5 votes vote down vote up
def check_names(infile):    #Checking the path to the wordlist
	if os.path.exists(infile):
		if status_method:
			banner()    #calls the banner function
			checkasciiwolf()      #calls the sexy ASCII wolf wallpaper
			statusfindAdmin() #calls the function that basically does the job
		elif error_method:
			banner()
			checkasciiwolf()
			findAdmin()
	else: #in case wordlist cant be found
		banner()
		opts()
		print(Fore.RED + Style.BRIGHT + "[-] Invalid path to the wordlist. File could not be found.\n" + Style.RESET_ALL)
# THIS IS THE STATUS CODE METHOD 
Example #24
Source File: colloide101.py    From colloide with GNU General Public License v3.0 5 votes vote down vote up
def scan_start():
	print(Fore.RED + Style.BRIGHT + "[!] Report bugs: /MichaelDim02/colloide.py/issues \n" + Style.RESET_ALL)

	print(Fore.RED + Style.BRIGHT + "[!] Press Ctrl + C to terminate the process.\n" + Style.RESET_ALL) 
Example #25
Source File: colloide.py    From colloide with GNU General Public License v3.0 5 votes vote down vote up
def scan_start():
	print(Fore.RED + Style.BRIGHT + "[!] Report bugs: /MichaelDim02/colloide.py/issues \n" + Style.RESET_ALL)

	print(Fore.RED + Style.BRIGHT + "[!] Press Ctrl + C to terminate the process.\n" + Style.RESET_ALL) 
Example #26
Source File: systemOptions.py    From Jarvis with MIT License 5 votes vote down vote up
def Os__MAC(jarvis, s):
    """Displays information about your operating system"""
    jarvis.say(
        Style.BRIGHT
        + '[!] Operating System Information'
        + Style.RESET_ALL,
        Fore.BLUE)
    jarvis.say('[*] Kernel: ' + sys(), Fore.GREEN)
    jarvis.say('[*] Kernel Release Version: ' + release(), Fore.GREEN)
    jarvis.say('[*] macOS System version: ' + mac_ver()[0], Fore.GREEN)
    for _ in architecture():
        if _ != '':
            jarvis.say('[*] ' + _, Fore.GREEN) 
Example #27
Source File: movie.py    From Jarvis with MIT License 5 votes vote down vote up
def colorized_output(key, value):
    """
    pretty print key value pair
    """
    green_text = Fore.GREEN + "{:<14}".format(key)
    normal_text = Style.RESET_ALL + ": " + str(value)
    return green_text + normal_text 
Example #28
Source File: personality.py    From Jarvis with MIT License 5 votes vote down vote up
def __call__(self, jarvis, s):
        prompt = "{black}Q{Q_id} {cyan}{left} {black}--- {green}{right}"
        prompt_formatter = {
            'cyan': Fore.CYAN,
            'black': Fore.BLACK,
            'green': Fore.GREEN
        }
        jarvis.say("Start personality test..", color=Fore.BLACK)
        jarvis.say(self.instruction)
        for i, (Q_id, left, right) in enumerate(self.Q):
            prompt_formatter['Q_id'] = i
            prompt_formatter['left'] = left
            prompt_formatter['right'] = right

            jarvis.say(prompt.format(**prompt_formatter))
            user_input = jarvis.input_number(
                prompt="Enter your choice on the scale of 1-5:\n", rmin=1,
                rmax=5, color=Fore.BLUE, rtype=int)
            self.answers[Q_id] = user_input
        self.get_scores()

        jarvis.say(
            "{}Your personality is: {}{}{}{}".format(
                Fore.BLUE,
                Fore.BLACK,
                Back.MAGENTA,
                self.type,
                Style.RESET_ALL))
        jarvis.say(
            "Redirecting to your personality analysis\
                 in 3s...", color=Fore.BLUE)
        time.sleep(3)
        self.open_analysis() 
Example #29
Source File: output.py    From h2t with MIT License 5 votes vote down vote up
def show_normal(content, fields, category, status):
    print_line(content['title'], category=category, status=status)

    if isinstance(fields, list):
        if 'description' in fields:
            print_line(content['description'], level=2, title='Description')
        if 'refs' in fields:
            print_line('', level=2, title='Refs')
            for item in content['refs']:
                print_line(Style.RESET_ALL + item, level=3)
    print(Style.RESET_ALL, end='') 
Example #30
Source File: output.py    From h2t with MIT License 5 votes vote down vote up
def print_bright(message, end='\n'):
    print(Style.BRIGHT + message + Style.RESET_ALL, end=end)