Python colorama.Fore.YELLOW Examples
The following are 30
code examples of colorama.Fore.YELLOW().
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: Comments.py From URS with MIT License | 8 votes |
def list_submissions(reddit, post_list, parser): print("\nChecking if post(s) exist...") posts, not_posts = Validation.Validation.existence(s_t[2], post_list, parser, reddit, s_t) if not_posts: print(Fore.YELLOW + Style.BRIGHT + "\nThe following posts were not found and will be skipped:") print(Fore.YELLOW + Style.BRIGHT + "-" * 55) print(*not_posts, sep = "\n") if not posts: print(Fore.RED + Style.BRIGHT + "\nNo submissions to scrape!") print(Fore.RED + Style.BRIGHT + "\nExiting.\n") quit() return posts
Example #2
Source File: supersede_command.py From openSUSE-release-tools with GNU General Public License v2.0 | 7 votes |
def perform(self, requests=None): for stage_info, code, request in self.api.dispatch_open_requests(requests): action = request.find('action') target_package = action.find('target').get('package') if code == 'unstage': # Technically, the new request has not been staged, but superseded the old one. code = None verbage = self.CODE_MAP[code] if code is not None: verbage += ' in favor of' print('request {} for {} {} {} in {}'.format( request.get('id'), Fore.CYAN + target_package + Fore.RESET, verbage, stage_info['rq_id'], Fore.YELLOW + stage_info['prj'] + Fore.RESET))
Example #3
Source File: Subreddit.py From URS with MIT License | 6 votes |
def list_subreddits(parser, reddit, s_t, sub_list): print("\nChecking if Subreddit(s) exist...") subs, not_subs = Validation.Validation().existence(s_t[0], sub_list, parser, reddit, s_t) if not_subs: print(Fore.YELLOW + Style.BRIGHT + "\nThe following Subreddits were not found and will be skipped:") print(Fore.YELLOW + Style.BRIGHT + "-" * 60) print(*not_subs, sep = "\n") if not subs: print(Fore.RED + Style.BRIGHT + "\nNo Subreddits to scrape!") print(Fore.RED + Style.BRIGHT + "\nExiting.\n") quit() return subs
Example #4
Source File: automate_project.py From project-automation with MIT License | 6 votes |
def GetCredentials(): global repoName global private global username global password if repoName == "": repoName = input("Enter a name for the GitHub repository: ") if private == "": private = input("Private GitHub repository (y/n): ") while private != False and private != True: if private == "y": private = True elif private == "n": private = False else: print("{}Invalid value.{}".format(Fore.YELLOW, Fore.WHITE)) private = input("Private GitHub repository (y/n): ") if username == "": username = input("Enter your GitHub username: ") if username == "" or password == "": password = getpass.getpass("Enter your GitHub password: ") # creates GitHub repo if credentials are valid
Example #5
Source File: jira-scan.py From Jira-Scan with The Unlicense | 6 votes |
def test_ssrf (URL,FILE): print (Fore.YELLOW +"[*] Testing: "+URL+" [*]") try: URLi = "https://"+URL+""+FILE+"" headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Connection":"close","Accept-Language":"en-US,en;q=0.5","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Upgrade-Insecure-Requests":"1"} response = session.get(URLi, headers=headers, timeout=10, verify=False) result = response.text if 'googlelogo' in result: text_file = open("./cfg/vun.txt", "a") text_file.write(""+URLi+"\n") text_file.close() print (Fore.GREEN +"[*] *********** Jira Vulnerable... Found *********** [*]") #print (result) else: print (Fore.RED +"[*] Not Vulnerable [*] ") except KeyboardInterrupt: print ("Ctrl-c pressed ...") sys.exit(1) except Exception as e: print (Fore.RED +"[*] Nothing Found on URL:"+URL+" [*]") #print (e)
Example #6
Source File: download_imagenet_weights.py From Detectron.pytorch with MIT License | 6 votes |
def parse_args(): """Parser command line argumnets""" parser = argparse.ArgumentParser(formatter_class=ColorHelpFormatter) parser.add_argument('--output_dir', help='Directory to save downloaded weight files', default=os.path.join(cfg.DATA_DIR, 'pretrained_model')) parser.add_argument('-t', '--targets', nargs='+', metavar='file_name', help='Files to download. Allowed values are: ' + ', '.join(map(lambda s: Fore.YELLOW + s + Fore.RESET, list(PRETRAINED_WEIGHTS.keys()))), choices=list(PRETRAINED_WEIGHTS.keys()), default=list(PRETRAINED_WEIGHTS.keys())) return parser.parse_args() # ---------------------------------------------------------------------------- # # Mapping from filename to google drive file_id # ---------------------------------------------------------------------------- #
Example #7
Source File: output.py From h2t with MIT License | 6 votes |
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 #8
Source File: __init__.py From visionary with MIT License | 6 votes |
def getConfig(): try: with open('%s/visionarypm.conf' % path) as f: config = json.loads(f.read().strip()) if config['oLen'] < 16 or config['oLen'] > 64 or config['cost'] < 10 or config['cost'] > 20 or config['nwords'] > 16 or config['nwords'] < 4: exit('Invalid config! Please delete the configuration file (%s) and a new one will be generated on the next run.' % (path + '/visionarypm.conf')) return config, 1 except IOError: config = get_defaults() autosave = safe_input('Do you want to save this config? (Y/n) ').lower() if autosave == 'yes' or autosave == 'y' or autosave == '': print('\nAutosaving configuration...') try: with open('%s/visionarypm.conf' % path, 'a') as f: f.write(json.dumps(config)) return config, 1 except: print(color('Autosaving failed! [Permission denied]\n', Fore.RED)) print('In order to save these settings, place %s' % color(json.dumps(config), Fore.YELLOW)) print('in %s' % (color('%s/visionarypm.conf' % path, Fore.YELLOW))) return config, 0 except (KeyError, json.decoder.JSONDecodeError): exit('Invalid config! Please delete the configuration file (%s) and a new one will be generated on the next run.' % (path + '/visionarypm.conf'))
Example #9
Source File: Redditor.py From URS with MIT License | 6 votes |
def list_redditors(parser, reddit, user_list): print("\nChecking if Redditor(s) exist...") users, not_users = Validation.Validation.existence(s_t[1], user_list, parser, reddit, s_t) if not_users: print(Fore.YELLOW + Style.BRIGHT + "\nThe following Redditors were not found and will be skipped:") print(Fore.YELLOW + Style.BRIGHT + "-" * 59) print(*not_users, sep = "\n") if not users: print(Fore.RED + Style.BRIGHT + "\nNo Redditors to scrape!") print(Fore.RED + Style.BRIGHT + "\nExiting.\n") quit() return users
Example #10
Source File: ProxyTool.py From ProxHTTPSProxyMII with MIT License | 6 votes |
def handle_one_request(self): """Catch more exceptions than default Intend to catch exceptions on local side Exceptions on remote side should be handled in do_*() """ try: BaseHTTPRequestHandler.handle_one_request(self) return except (ConnectionError, FileNotFoundError) as e: logger.warning("%03d " % self.reqNum + Fore.RED + "%s %s", self.server_version, e) except (ssl.SSLEOFError, ssl.SSLError) as e: if hasattr(self, 'url'): # Happens after the tunnel is established logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while operating on established local SSL tunnel for [%s]' % (e, self.url)) else: logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while trying to establish local SSL tunnel for [%s]' % (e, self.path)) self.close_connection = 1
Example #11
Source File: ProxyTool.py From ProxHTTPSProxyMII with MIT License | 6 votes |
def tunnel_traffic(self): "Tunnel traffic to remote host:port" logger.info("%03d " % self.reqNum + Fore.CYAN + '[D] SSL Pass-Thru: https://%s/' % self.path) server_conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: server_conn.connect((self.host, int(self.port))) self.wfile.write(("HTTP/1.1 200 Connection established\r\n" + "Proxy-agent: %s\r\n" % self.version_string() + "\r\n").encode('ascii')) read_write(self.connection, server_conn) except TimeoutError: self.wfile.write(b"HTTP/1.1 504 Gateway Timeout\r\n\r\n") logger.warning("%03d " % self.reqNum + Fore.YELLOW + 'Timed Out: https://%s:%s/' % (self.host, self.port)) except socket.gaierror as e: self.wfile.write(b"HTTP/1.1 503 Service Unavailable\r\n\r\n") logger.warning("%03d " % self.reqNum + Fore.YELLOW + '%s: https://%s:%s/' % (e, self.host, self.port)) finally: # We don't maintain a connection reuse pool, so close the connection anyway server_conn.close()
Example #12
Source File: supersede_command.py From openSUSE-release-tools with GNU General Public License v2.0 | 6 votes |
def perform(self, requests=None): for stage_info, code, request in self.api.dispatch_open_requests(requests): action = request.find('action') target_package = action.find('target').get('package') if code == 'unstage': # Technically, the new request has not been staged, but superseded the old one. code = None verbage = self.CODE_MAP[code] if code is not None: verbage += ' in favor of' print('request {} for {} {} {} in {}'.format( request.get('id'), Fore.CYAN + target_package + Fore.RESET, verbage, stage_info['rq_id'], Fore.YELLOW + stage_info['prj'] + Fore.RESET))
Example #13
Source File: munin-host.py From munin with Apache License 2.0 | 6 votes |
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 #14
Source File: cb_tools.py From Forager with MIT License | 6 votes |
def create_json_feed(meta, json_path): #Creating JSON feed using scripts in cbfeeds/ data = generate_feed.create_feed(meta) #print data #Saving the data to file in json_feeds/ try: print((Fore.YELLOW + '[*]' + Fore.RESET), end=' ') print('Saving report to: %s' % json_path) dump_data = open(json_path, 'w+').write(data) except: print((Fore.RED + '[-]' + Fore.RESET), end=' ') print('Could not dump report to %s' % json_path) exit(0) return
Example #15
Source File: systemOptions.py From Jarvis with MIT License | 6 votes |
def check_ram__WINDOWS(jarvis, s): """ checks your system's RAM stats. -- Examples: check ram """ import psutil mem = psutil.virtual_memory() def format(size): mb, _ = divmod(size, 1024 * 1024) gb, mb = divmod(mb, 1024) return "%s GB %s MB" % (gb, mb) jarvis.say("Total RAM: %s" % (format(mem.total)), Fore.BLUE) if mem.percent > 80: color = Fore.RED elif mem.percent > 60: color = Fore.YELLOW else: color = Fore.GREEN jarvis.say("Available RAM: %s" % (format(mem.available)), color) jarvis.say("RAM used: %s%%" % (mem.percent), color)
Example #16
Source File: football.py From Jarvis with MIT License | 6 votes |
def matches(self, jarvis, compId): """ Fetches today's matches in given competition and prints the match info """ print() jarvis.spinner_start('Fetching ') r = fetch("/matches?competitions={}".format(compId)) if r is None: jarvis.spinner_stop("Error in fetching data - try again later.", Fore.YELLOW) return jarvis.spinner_stop('') if r["count"] == 0: jarvis.say("No matches found for today.", Fore.BLUE) return else: # Print each match info for match in r["matches"]: matchInfo = self.formatMatchInfo(match) length = len(matchInfo) jarvis.say(matchInfo[0], Fore.BLUE) for i in range(1, length): print(matchInfo[i]) print()
Example #17
Source File: build.py From maubot with GNU Affero General Public License v3.0 | 6 votes |
def write_plugin(meta: PluginMeta, output: Union[str, IO]) -> None: with zipfile.ZipFile(output, "w") as zip: meta_dump = BytesIO() yaml.dump(meta.serialize(), meta_dump) zip.writestr("maubot.yaml", meta_dump.getvalue()) for module in meta.modules: if os.path.isfile(f"{module}.py"): zip.write(f"{module}.py") elif module is not None and os.path.isdir(module): zipdir(zip, module) else: print(Fore.YELLOW + f"Module {module} not found, skipping" + Fore.RESET) for file in meta.extra_files: zip.write(file)
Example #18
Source File: binary.py From Jarvis with MIT License | 6 votes |
def binary(jarvis, s): """ Converts an integer into a binary number """ if s == "": s = jarvis.input("What's your number? ") try: n = int(s) except ValueError: jarvis.say("This is no number, right?", Fore.RED) return else: if n < 0: jarvis.say("-" + bin(n)[3:], Fore.YELLOW) else: jarvis.say(bin(n)[2:], Fore.YELLOW)
Example #19
Source File: basketball.py From Jarvis with MIT License | 6 votes |
def todays_games(self, jarvis): jarvis.spinner_start('Fetching...') date = datetime.datetime.now().strftime('%Y-%m-%d') response = self.fetch_data("games?date={}".format(date)) if response is None: jarvis.spinner_stop("Error While Loading Matches - Try Again Later.", Fore.YELLOW) return total_count = response["results"] matches = response["response"] if total_count == 0: jarvis.spinner_stop("There is No Matches Today", Fore.YELLOW) return jarvis.spinner_stop("Found {} Matches".format(total_count)) for i in range(total_count): match = matches[i] time = match["time"] country = match["country"]["name"] league = match["league"]["name"] teams = "{} VS {}".format(match["teams"]["home"]["name"], match["teams"]["away"]["name"]) print(" {}. {} {} {} {}".format(i + 1, country, league, time, teams))
Example #20
Source File: basketball.py From Jarvis with MIT License | 5 votes |
def get_choice(self, jarvis): while True: try: inserted_value = int(jarvis.input("Enter your choice: ", Fore.GREEN)) if inserted_value == 6: return -1 elif inserted_value == 1 or inserted_value == 2 or inserted_value == 3 or inserted_value == 4 or inserted_value == 5: return inserted_value else: jarvis.say( "Invalid input! Enter a number from the choices provided.", Fore.YELLOW) except ValueError: jarvis.say( "Invalid input! Enter a number from the choices provided.", Fore.YELLOW) print()
Example #21
Source File: base.py From raw-packet with MIT License | 5 votes |
def __init__(self, admin_only: bool = True, available_platforms: List[str] = ['Linux', 'Darwin', 'Windows']) -> None: """ Init """ # Check user is admin/root if admin_only: self.check_user() # Check platform self.check_platform(available_platforms=available_platforms) # If current platform is Windows get network interfaces settings if self.get_platform().startswith('Windows'): self._windows_adapters = get_adapters() init(convert=True) self.cINFO: str = Style.BRIGHT + Fore.BLUE self.cERROR: str = Style.BRIGHT + Fore.RED self.cSUCCESS: str = Style.BRIGHT + Fore.GREEN self.cWARNING: str = Style.BRIGHT + Fore.YELLOW self.cEND: str = Style.RESET_ALL self.c_info: str = self.cINFO + '[*]' + self.cEND + ' ' self.c_error: str = self.cERROR + '[-]' + self.cEND + ' ' self.c_success: str = self.cSUCCESS + '[+]' + self.cEND + ' ' self.c_warning: str = self.cWARNING + '[!]' + self.cEND + ' ' self.lowercase_letters: str = 'abcdefghijklmnopqrstuvwxyz' self.uppercase_letters: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' self.digits: str = '0123456789' # endregion # region Output functions
Example #22
Source File: basketball.py From Jarvis with MIT License | 5 votes |
def list_leagues(self, jarvis): jarvis.spinner_start('Fetching...') response = self.fetch_data("leagues") if response is None: jarvis.spinner_stop("Error While Loadin Data - Try Again Later.", Fore.YELLOW) return total_count = response["results"] leagues = response["response"] jarvis.spinner_stop("Found {} Leagues".format(total_count)) for i in range(total_count): print(" {}. {} {}".format(i + 1, leagues[i]["country"]["name"], leagues[i]["name"]))
Example #23
Source File: basketball.py From Jarvis with MIT License | 5 votes |
def search_team(self, jarvis): response = self.search_request(jarvis, "teams", "Team") if response is None: return found_count = response["results"] if found_count == 0: jarvis.spinner_stop("Nothing was Found With Given Name", Fore.YELLOW) return jarvis.spinner_stop("Found {} Teams".format(found_count)) teams = response["response"] for i in range(found_count): team = teams[i] print(" {}. '{}' Country: {}".format(i + 1, team["name"], team["country"]["name"]))
Example #24
Source File: basketball.py From Jarvis with MIT License | 5 votes |
def search_request(self, jarvis, query, search_name): value = jarvis.input("Enter {} Name: ".format(search_name), Fore.GREEN) while len(value.strip()) < 3: print() print("The Search {} must be at least 3 characters in length", search_name.lower()) value = jarvis.input("Enter {} Name: ".format(search_name), Fore.GREEN) jarvis.spinner_start('Searching...') response = self.fetch_data("{}?search={}".format(query, value.strip())) if response is None: jarvis.spinner_stop("Error While Searching {} - Try Again Later.".format(search_name), Fore.YELLOW) return return response
Example #25
Source File: corona.py From Jarvis with MIT License | 5 votes |
def __call__(self, jarvis, s): if 'help' in s: jarvis.say(cleandoc(self.__doc__), Fore.GREEN) else: corona_info = self.get_corona_info(s) if corona_info == "URLError": jarvis.say(f"Result was not available at the moment. Try again!!", Fore.RED) elif corona_info is None: jarvis.say(f"Cant find the country \"{s}\"", Fore.RED) else: location = corona_info["Country"] jarvis.say(f"\t+++++++++++++++++++++++++++++++++++++++", Fore.CYAN) jarvis.say(f"\tCorona status: \"{location}\"", Fore.CYAN) jarvis.say(f"\t+++++++++++++++++++++++++++++++++++++++", Fore.CYAN) new_confirmed = corona_info["NewConfirmed"] jarvis.say(f"\tNew confirmed cases : {new_confirmed}", Fore.YELLOW) total_confirmed = corona_info["TotalConfirmed"] jarvis.say(f"\tTotal confirmed cases : {total_confirmed}", Fore.YELLOW) new_deaths = corona_info["NewDeaths"] jarvis.say(f"\tNew deaths : {new_deaths}", Fore.RED) total_deaths = corona_info["TotalDeaths"] jarvis.say(f"\tTotal deaths : {total_deaths}", Fore.RED) new_recovered = corona_info["NewRecovered"] jarvis.say(f"\tNew recovered : {new_recovered}", Fore.GREEN) total_recovered = corona_info["TotalRecovered"] jarvis.say(f"\tTotal recovered : {total_recovered}", Fore.GREEN)
Example #26
Source File: football.py From Jarvis with MIT License | 5 votes |
def get_option(self, jarvis): """ Get user input for choosing between match info or competition info """ options = {1: 'competitions', 2: 'matches'} # Ask for the option jarvis.say("What information do you want:", Fore.BLUE) print() print("1: Competition/league standings") print("2: Today's matches") print("3: Exit") print() while True: try: option = int(jarvis.input("Enter your choice: ", Fore.GREEN)) if option == 3: return elif option == 1 or option == 2: return options[option] else: jarvis.say( "Invalid input! Enter a number from the choices provided.", Fore.YELLOW) except ValueError: jarvis.say( "Invalid input! Enter a number from the choices provided.", Fore.YELLOW) print()
Example #27
Source File: football.py From Jarvis with MIT License | 5 votes |
def competition(self, jarvis, compId): """ Fetches details of a competition and outputs the competition's current standings """ # Fetch competition info) jarvis.spinner_start('Fetching ') r = fetch("/competitions/{}/standings".format(compId)) if r is None: jarvis.spinner_stop("Error in fetching data - try again later.", Fore.YELLOW) return jarvis.spinner_stop('') print() self.printStandings(jarvis, r["standings"])
Example #28
Source File: test_systems_generators_yaml.py From skelebot with MIT License | 5 votes |
def test_loadConfig_with_bad_plugin(self, mock_getcwd, mock_expanduser, mock_exists, mock_makedirs, mock_shutil, mock_print): mock_expanduser.return_value = "{path}/test/plugins-bad".format(path=self.path) mock_getcwd.return_value = "{path}/test/files".format(path=self.path) mock_exists.side_effect = [True, False] config = sb.systems.generators.yaml.loadConfig() folder = "{}/test/plugins-bad/addNumbersBad".format(self.path) mock_print.assert_called_with(Fore.YELLOW + "WARNING" + Style.RESET_ALL + " | The addNumbersBad plugin contains errors - Adding plugin to Quarantine") mock_makedirs.assert_called_with("{path}/test/plugins-bad".format(path=self.path)) mock_shutil.assert_called_with(folder, folder) # Test to ensure that the config loads from skelebot.yaml and overwrites with skelebot-test.yaml properly
Example #29
Source File: debug.py From NukeToolSet with MIT License | 5 votes |
def print_to_stdout(level, str_out): """ The default debug function """ if level == NOTICE: col = Fore.GREEN elif level == WARNING: col = Fore.RED else: col = Fore.YELLOW if not is_py3: str_out = str_out.encode(encoding, 'replace') print(col + str_out + Fore.RESET) # debug_function = print_to_stdout
Example #30
Source File: joke_of_day.py From Jarvis with MIT License | 5 votes |
def joke(self, jarvis, joke_fetch): title = joke_fetch["contents"]["jokes"][0]["joke"]["title"] joke = joke_fetch["contents"]["jokes"][0]["joke"]["text"] print() jarvis.say("Title: " + title, Fore.BLUE) print() jarvis.say(joke, Fore.YELLOW)