Python colorama.Fore.LIGHTBLUE_EX Examples

The following are 17 code examples of colorama.Fore.LIGHTBLUE_EX(). 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.Fore , or try the search function .
Example #1
Source File: ISAFInterpreter.py    From Industrial-Security-Auditing-Framework with GNU General Public License v3.0 5 votes vote down vote up
def __parse_prompt(self):
        raw_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " > " + Style.NORMAL
        raw_prompt_template = os.getenv("ISAF_RAW_PROMPT", raw_prompt_default_template).replace('\\033', '\033')
        self.raw_prompt_template = raw_prompt_template if '{host}' in raw_prompt_template else raw_prompt_default_template
        module_prompt_default_template = Style.BRIGHT + Fore.BLUE + "{host}" + Fore.RESET + " (" + Fore.LIGHTBLUE_EX \
                                         + "{module}" + Fore.RESET + Style.NORMAL + ") > "
        module_prompt_template = os.getenv("ISAF_MODULE_PROMPT", module_prompt_default_template).replace('\\033',
                                                                                                         '\033')
        self.module_prompt_template = module_prompt_template if all(
            map(lambda x: x in module_prompt_template, ['{host}', "{module}"])) else module_prompt_default_template 
Example #2
Source File: OxygenX-0.4.py    From OxygenX with MIT License 5 votes vote down vote up
def now_time():
    return f'{Fore.LIGHTBLUE_EX}{strftime("%H:%M:%S ", lt())}' 
Example #3
Source File: shell.py    From unipacker with GNU General Public License v2.0 5 votes vote down vote up
def get_path_from_user(self, known_samples):
        print("Your options for today:\n")
        lines = []
        for i, s in enumerate(known_samples):
            if s == "New sample...":
                lines += [(f"\t[{i}]", f"{Fore.LIGHTYELLOW_EX}New sample...{Fore.RESET}", "")]
            else:
                label, name = s.split(";")
                lines += [(f"\t[{i}]", f"{Fore.LIGHTBLUE_EX}{label}:{Fore.RESET}", name)]
        print_cols(lines)
        print()

        while True:
            try:
                id = int(input("Enter the option ID: "))
            except ValueError:
                print("Error parsing ID")
                continue
            if 0 <= id < len(known_samples) - 1:
                path = known_samples[id].split(";")[1]
            elif id == len(known_samples) - 1:
                path = input("Please enter the sample path (single file or directory): ").rstrip()
            else:
                print(f"Invalid ID. Allowed range: 0 - {len(known_samples) - 1}")
                continue
            if os.path.exists(path):
                return path
            else:
                print("Path does not exist")
                continue 
Example #4
Source File: utils.py    From unipacker with GNU General Public License v2.0 5 votes vote down vote up
def disass_instruction(uc, instr, addr_alias="", columns=False):
    if instr.id == 0:
        pass
    (regs_read, regs_write) = instr.regs_access()
    reg_values = {}
    for r in regs_read:
        uc_constant = getattr(unicorn.x86_const, f"UC_X86_REG_{instr.reg_name(r).upper()}", None)
        if uc_constant:
            reg_values[instr.reg_name(r)] = uc.reg_read(uc_constant)
    reg_values_str = ' '.join([f"{name}=0x{value:02x}" for name, value in reg_values.items()])
    if X86_GRP_JUMP in instr.groups:
        if jump_taken(uc, instr):
            color = Fore.LIGHTGREEN_EX
            comment = f"; taken! {reg_values_str}"
        else:
            color = Fore.LIGHTRED_EX
            comment = f"; not taken! {reg_values_str}"
    else:
        color = Fore.RESET
        comment = f"; {reg_values_str}" if reg_values_str else ""
    mnemonic = f"{color}{instr.mnemonic}{Fore.RESET}"
    addr_alias = f"0x{instr.address:02x}, {Fore.LIGHTRED_EX}{addr_alias}{Fore.RESET}" if addr_alias \
        else f"0x{instr.address:02x}"

    disass_cols = f">>> {addr_alias}:", f"{mnemonic} {Fore.LIGHTCYAN_EX}{instr.op_str}{Fore.RESET}", f"{Fore.LIGHTBLUE_EX}{comment}{Fore.RESET}"
    if columns:
        return disass_cols
    return " ".join(disass_cols) 
Example #5
Source File: cli.py    From pynubank with MIT License 5 votes vote down vote up
def main():
    init()

    log(f'Starting {Fore.MAGENTA}{Style.DIM}PyNubank{Style.NORMAL}{Fore.LIGHTBLUE_EX} context creation.')

    device_id = generate_random_id()

    log(f'Generated random id: {device_id}')

    cpf = input(f'[>] Enter your CPF(Numbers only): ')
    password = getpass('[>] Enter your password (Used on the app/website): ')

    generator = CertificateGenerator(cpf, password, device_id)

    log('Requesting e-mail code')
    try:
        email = generator.request_code()
    except NuException:
        log(f'{Fore.RED}Failed to request code. Check your credentials!', Fore.RED)
        return

    log(f'Email sent to {Fore.LIGHTBLACK_EX}{email}{Fore.LIGHTBLUE_EX}')
    code = input('[>] Type the code received by email: ')

    cert1, cert2 = generator.exchange_certs(code)

    save_cert(cert1, 'cert.p12')

    print(f'{Fore.GREEN}Certificates generated successfully. (cert.pem)')
    print(f'{Fore.YELLOW}Warning, keep these certificates safe (Do not share or version in git)') 
Example #6
Source File: cli.py    From pynubank with MIT License 5 votes vote down vote up
def log(message, color=Fore.BLUE):
    print(f'{color}{Style.DIM}[*] {Style.NORMAL}{Fore.LIGHTBLUE_EX}{message}') 
Example #7
Source File: onsets_frames_transcription_realtime.py    From magenta with Apache License 2.0 5 votes vote down vote up
def result_collector(result_queue):
  """Collect and display results."""

  def notename(n, space):
    if space:
      return [' ', '  ', ' ', ' ', '  ', ' ', '  ', ' ', ' ', '  ', ' ',
              '  '][n % 12]
    return [
        Fore.BLUE + 'A' + Style.RESET_ALL,
        Fore.LIGHTBLUE_EX + 'A#' + Style.RESET_ALL,
        Fore.GREEN + 'B' + Style.RESET_ALL,
        Fore.CYAN + 'C' + Style.RESET_ALL,
        Fore.LIGHTCYAN_EX + 'C#' + Style.RESET_ALL,
        Fore.RED + 'D' + Style.RESET_ALL,
        Fore.LIGHTRED_EX + 'D#' + Style.RESET_ALL,
        Fore.YELLOW + 'E' + Style.RESET_ALL,
        Fore.WHITE + 'F' + Style.RESET_ALL,
        Fore.LIGHTBLACK_EX + 'F#' + Style.RESET_ALL,
        Fore.MAGENTA + 'G' + Style.RESET_ALL,
        Fore.LIGHTMAGENTA_EX + 'G#' + Style.RESET_ALL,
    ][n % 12]  #+ str(n//12)

  print('Listening to results..')
  # TODO(mtyka) Ensure serial stitching of results (no guarantee that
  # the blocks come in in order but they are all timestamped)
  while True:
    result = result_queue.get()
    serial = result.audio_chunk.serial
    result_roll = result.result
    if serial > 0:
      result_roll = result_roll[4:]
    for notes in result_roll:
      for i in range(6, len(notes) - 6):
        note = notes[i]
        is_frame = note[0] > 0.0
        notestr = notename(i, not is_frame)
        print(notestr, end='')
      print('|') 
Example #8
Source File: save.py    From Lyndor with MIT License 5 votes vote down vote up
def course(url, lynda_folder_path):
    ''' create course folder '''
    current_course = course_path(url, lynda_folder_path)
    courses = os.listdir(lynda_folder_path)

    answer = None
    for course in courses:
        if (lynda_folder_path + course) == current_course:
            if read.redownload_course == 'force':
                # delete existing course and re-download
                shutil.rmtree(current_course)
                message.colored_message(Fore.LIGHTRED_EX, "\n✅  Course folder already exists. Current preference -> FORCE redownload")
                message.colored_message(Fore.LIGHTRED_EX, "\n❌  Existing course folder deleted!!")
                time.sleep(2)
                message.colored_message(Fore.LIGHTGREEN_EX, "\n♻️  Re-downloading the course.\n")
                time.sleep(2)
            elif read.redownload_course == 'skip':
                # skip download process
                message.colored_message(Fore.LIGHTRED_EX, "\n✅  Course folder already exists. Current preference -> SKIP redownload")
                sys.exit(message.colored_message(Fore.LIGHTRED_EX, "\n-> Skipping course download.\n"))    
            elif read.redownload_course == 'prompt':
                # prompt user with available choices
                QUESTION = '\n✅  Course folder already exists: Do you wish to delete it and download again? (Y/N): '
                sys.stdout.write(Fore.LIGHTBLUE_EX + QUESTION + Fore.RESET)
                while answer != 'y':
                    # get user input
                    answer = input().lower()

                    if answer == 'y':
                        shutil.rmtree(current_course)
                        message.colored_message(Fore.LIGHTRED_EX, "\n❌  Existing course folder deleted!!")
                        time.sleep(2)
                        message.colored_message(Fore.LIGHTGREEN_EX, "\n♻️  Re-downloading the course.\n")
                    elif answer == 'n':
                        sys.exit(message.colored_message(Fore.LIGHTRED_EX, "\n-> Program Ended!!\n"))
                    else:
                        sys.stdout.write(Fore.LIGHTRED_EX + "\n- oops!! that's not a valid choice, type Y or N: " + Fore.RESET)
    
    print(f'\ncreating course folder at: {current_course}')
    os.mkdir(current_course) 
Example #9
Source File: __init__.py    From Industrial-Security-Auditing-Framework with GNU General Public License v3.0 5 votes vote down vote up
def print_status(*args, **kwargs):
    __cprint(Fore.LIGHTBLUE_EX + '[*]' + Fore.RESET, *args, **kwargs) 
Example #10
Source File: clean_folder.py    From Scripting-and-Web-Scraping with MIT License 5 votes vote down vote up
def print_after(path):

	print(Fore.LIGHTBLUE_EX  + "\nAfter cleaning\n" + Fore.RESET)

	for files in os.listdir(path):
		print(files,end='\t')

	print(Fore.LIGHTMAGENTA_EX  + "\n\nCLEANED\n" + Fore.RESET) 
Example #11
Source File: clean_folder.py    From Scripting-and-Web-Scraping with MIT License 5 votes vote down vote up
def print_before(path):
	print("Cleaning {} located at {}\n".format(path.split('/')[-1],path))

	print(Fore.LIGHTBLUE_EX  + "Before cleaning\n" + Fore.RESET)

	for files in os.listdir(path):
		print(files,end='\t')
	print() 
Example #12
Source File: file_organise.py    From Jarvis with MIT License 5 votes vote down vote up
def print_after(self, path):
        print(Fore.LIGHTBLUE_EX + "\nFolders after cleaning\n" + Fore.RESET)

        for files in os.listdir(path):
            print(files, sep=',\t')

        print(Fore.LIGHTMAGENTA_EX + "\nCLEANED\n" + Fore.RESET) 
Example #13
Source File: file_organise.py    From Jarvis with MIT License 5 votes vote down vote up
def print_before(self, path):
        print("Cleaning {} located at {}\n".format(path.split('/')[-1], path))

        print(Fore.LIGHTBLUE_EX + "Folders before cleaning\n" + Fore.RESET)

        for files in os.listdir(path):
            print(files, end='\t')
        print() 
Example #14
Source File: file_organise.py    From Jarvis with MIT License 5 votes vote down vote up
def source_path(self, jarvis, dir_name):
        all_paths = []
        # Changing static path to get the home path from PATH variables.
        # The '/home' was causing script to exit with "file not found" error
        # on Darwin.
        home_dir = os.environ.get("HOME")
        user_name = os.environ.get("USER")
        home_path = home_dir.split(user_name)[0].rstrip('/')
        for root in os.walk(home_path):
            print(
                Fore.LIGHTBLUE_EX
                + "Searching in {}...".format(
                    (root[0])[
                        :70]),
                end="\r")
            sys.stdout.flush()
            if dir_name == root[0].split('/')[-1]:
                all_paths.append(root[0])

        for i, path_info in enumerate(all_paths):
            print()
            print("{}. {}".format(i + 1, path_info))

        if len(all_paths) == 0:
            print(Fore.LIGHTRED_EX + 'No directory found')
            exit()

        choice = int(jarvis.input('\nEnter the option number: '))

        if choice < 1 or choice > len(all_paths):
            path = ''
            print(Fore.LIGHTRED_EX + 'Wrong choice entered')
            exit()

        else:
            path = all_paths[choice - 1]

        return path 
Example #15
Source File: logger.py    From brutemap with GNU General Public License v3.0 5 votes vote down vote up
def colorize(self, msg):
        """
        Mewarnai pesan
        """

        color = self.color_map[self.record.levelno]
        reset = Style.RESET_ALL
        levelname = reset + color + self.record.levelname + reset
        if self.record.levelname == "CRITICAL":
            color = self.color_map[logging.ERROR]

        name = Fore.LIGHTBLUE_EX + self.record.name + reset
        message = self.record.message
        # XXX: kenapa cara dibawah ini tidak bekerja?
        #
        # match = re.findall(r"['\"]+(.*?)['\"]+", message)
        # if match:
        #     match.reverse()
        #     for m in match:
        #         message = message.replace(m, color + m + reset, 1)

        match = re.search(r"=> (?P<account>.*?(?:| \: .*?)) \((?P<status>[A-Z]+)\)", message)
        if match:
            account = match.group("account")
            status = match.group("status")
            if status == "NO":
                color_status = Fore.LIGHTRED_EX
            else:
                color_status = Fore.LIGHTGREEN_EX

            newmsg = message.replace(account, color_status + account + reset)
            newmsg = newmsg.replace(status, color_status + status + reset)
            msg = msg.replace(message, newmsg)

        asctime = re.findall(r"\[(.+?)\]", msg)[0]
        msg = msg.replace(asctime, Fore.LIGHTMAGENTA_EX + asctime + reset, 1)
        msg = msg.replace(self.record.name, name, 1)
        msg = msg.replace(self.record.levelname, levelname, 1)
        msg = msg + reset

        return msg 
Example #16
Source File: rpsgame.py    From python-for-absolute-beginners-course with MIT License 4 votes vote down vote up
def play_game(player_1, player_2):
    log(Fore.CYAN + f"New game starting between {player_1} and {player_2}.")

    wins = {player_1: 0, player_2: 0}
    roll_names = list(rolls.keys())

    while not find_winner(wins, wins.keys()):
        roll1 = get_roll(player_1, roll_names)
        roll2 = random.choice(roll_names)

        if not roll1:
            print(Fore.LIGHTRED_EX + "Try again!")
            print(Fore.WHITE)
            continue

        log(f"Round: {player_1} roll {roll1} and {player_2} rolls {roll2}")
        print(Fore.YELLOW + f"{player_1} rolls {roll1}")
        print(Fore.LIGHTBLUE_EX + f"{player_2} rolls {roll2}")
        print(Fore.WHITE)

        winner = check_for_winning_throw(player_1, player_2, roll1, roll2)

        if winner is None:
            msg = "This round was a tie!"
            print(msg)
            log(msg)
        else:
            msg = f'{winner} takes the round!'
            fore = Fore.GREEN if winner == player_1 else Fore.LIGHTRED_EX
            print(fore + msg + Fore.WHITE)
            log(msg)
            wins[winner] += 1

        msg = f"Score is {player_1}: {wins[player_1]} and {player_2}: {wins[player_2]}."
        print(msg)
        log(msg)
        print()

    overall_winner = find_winner(wins, wins.keys())
    fore = Fore.GREEN if overall_winner == player_1 else Fore.LIGHTRED_EX
    msg = f"{overall_winner} wins the game!"
    print(fore + msg + Fore.WHITE)
    log(msg)
    record_win(overall_winner) 
Example #17
Source File: rpsgame.py    From python-for-absolute-beginners-course with MIT License 4 votes vote down vote up
def play_game(player_1, player_2):
    log(Fore.CYAN + f"New game starting between {player_1} and {player_2}.")

    wins = {player_1: 0, player_2: 0}
    roll_names = list(rolls.keys())

    while not find_winner(wins, wins.keys()):
        roll1 = get_roll(player_1, roll_names)
        roll2 = random.choice(roll_names)

        if not roll1:
            print(Fore.LIGHTRED_EX + "Try again!")
            print(Fore.WHITE)
            continue

        log(f"Round: {player_1} roll {roll1} and {player_2} rolls {roll2}")
        print(Fore.YELLOW + f"{player_1} rolls {roll1}")
        print(Fore.LIGHTBLUE_EX + f"{player_2} rolls {roll2}")
        print(Fore.WHITE)

        winner = check_for_winning_throw(player_1, player_2, roll1, roll2)

        if winner is None:
            msg = "This round was a tie!"
            print(msg)
            log(msg)
        else:
            msg = f'{winner} takes the round!'
            fore = Fore.GREEN if winner == player_1 else Fore.LIGHTRED_EX
            print(fore + msg + Fore.WHITE)
            log(msg)
            wins[winner] += 1

        msg = f"Score is {player_1}: {wins[player_1]} and {player_2}: {wins[player_2]}."
        print(msg)
        log(msg)
        print()

    overall_winner = find_winner(wins, wins.keys())
    fore = Fore.GREEN if overall_winner == player_1 else Fore.LIGHTRED_EX
    msg = f"{overall_winner} wins the game!"
    print(fore + msg + Fore.WHITE)
    log(msg)
    record_win(overall_winner)