本文整理汇总了Python中colorama.Fore.LIGHTRED_EX属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.LIGHTRED_EX属性的具体用法?Python Fore.LIGHTRED_EX怎么用?Python Fore.LIGHTRED_EX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Fore
的用法示例。
在下文中一共展示了Fore.LIGHTRED_EX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_yara
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def do_yara(self, args):
"""Run YARA rules against the sample
Usage: yara [<rules_path>]
If no rules file is specified, the default 'malwrsig.yar' is being used.
Those rules are then compiled and checked against the memory dump of the current emulator state (see 'dump' for further
details on this representation)"""
if not args:
if not self.rules:
try:
self.rules = yara.compile(filepath=f"{os.path.dirname(unipacker.__file__)}/malwrsig.yar")
print("Default rules file used: malwrsig.yar")
except:
print(f"{Fore.LIGHTRED_EX}Error: malwrsig.yar not found!{Fore.RESET}")
else:
self.rules = yara.compile(filepath=args)
self.sample.unpacker.dump(self.engine.uc, self.engine.apicall_handler, self.sample)
matches = self.rules.match("unpacked.exe")
print(", ".join(map(str, matches)))
示例2: source_path
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def source_path(dir_name):
for root in os.walk("/home"):
if dir_name == root[0].split('/')[-1]:
all_paths.append(root[0])
for i in range(len(all_paths)):
print()
print("{}. {}".format(i+1,all_paths[i]))
if len(all_paths) == 0:
print(Fore.LIGHTRED_EX + 'No directory found')
exit()
choice = int(input('\nEnter the option number: '))
if choice < 1 or choice > len(all_paths):
print(Fore.LIGHTRED_EX +'Wrong choice entered')
exit()
else:
path = all_paths[choice-1]
return path
示例3: error
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def error(self, message: str) -> None:
"""Custom error override. Allows application to control the error being displayed by argparse"""
if len(self._custom_error_message) > 0:
message = self._custom_error_message
self._custom_error_message = ''
lines = message.split('\n')
linum = 0
formatted_message = ''
for line in lines:
if linum == 0:
formatted_message = 'Error: ' + line
else:
formatted_message += '\n ' + line
linum += 1
sys.stderr.write(Fore.LIGHTRED_EX + '{}\n\n'.format(formatted_message) + Fore.RESET)
# sys.stderr.write('{}\n\n'.format(formatted_message))
self.print_help()
sys.exit(1)
示例4: perror
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def perror(self, err: Union[str, Exception], traceback_war: bool=True, err_color: str=Fore.LIGHTRED_EX,
war_color: str=Fore.LIGHTYELLOW_EX) -> None:
""" Print error message to sys.stderr and if debug is true, print an exception Traceback if one exists.
:param err: an Exception or error message to print out
:param traceback_war: (optional) if True, print a message to let user know they can enable debug
:param err_color: (optional) color escape to output error with
:param war_color: (optional) color escape to output warning with
"""
if self.debug:
import traceback
traceback.print_exc()
if isinstance(err, Exception):
err_msg = "EXCEPTION of type '{}' occurred with message: '{}'\n".format(type(err).__name__, err)
else:
err_msg = "{}\n".format(err)
err_msg = err_color + err_msg + Fore.RESET
self.decolorized_write(sys.stderr, err_msg)
if traceback_war and not self.debug:
war = "To enable full traceback, run the following command: 'set debug true'\n"
war = war_color + war + Fore.RESET
self.decolorized_write(sys.stderr, war)
示例5: test_integrity
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def test_integrity(self):
curr_path = os.getcwd()
if "Tests" in curr_path:
os.chdir(curr_path.split("Tests")[0])
for rt, dir, _ in os.walk(os.getcwd() + "/Sample/"):
for d in dir:
for rt2, dir2, f2 in os.walk(rt + d):
for f in f2:
test_path = os.path.join(rt2, f)
relative_test_path = test_path.split(f"Sample{os.path.sep}")[1]
if relative_test_path not in self.hashes:
print(
f"{Fore.LIGHTRED_EX}Warning: Unknown file {relative_test_path} found in sample directory{Fore.RESET}")
continue
self.assertTrue(calc_md5(test_path).hexdigest() == self.hashes[relative_test_path],
f"Tested file: {relative_test_path}. Expected: {self.hashes[relative_test_path]}, got: {calc_md5(test_path).hexdigest()}")
print(f"Tested:{relative_test_path}, MD5: {calc_md5(test_path).hexdigest()}")
示例6: sample_loop
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def sample_loop(self, samples=None):
known_samples = self.init_banner_and_history()
if not samples:
sample_path = self.get_path_from_user(known_samples)
samples = Sample.get_samples(sample_path)
for self.sample in samples:
print(f"\nNext up: {self.sample}")
with open(".unpacker_history", "w") as f:
f.writelines(
"\n".join(sorted(set([f"{self.sample.unpacker.name};{self.sample.path}"] + known_samples[:-1]))))
self.init_engine()
with open(f"{os.path.dirname(unipacker.__file__)}/fortunes") as f:
fortunes = f.read().splitlines()
print(f"\n{Fore.LIGHTRED_EX}{choice(fortunes)}{Fore.RESET}\n")
self.cmdloop()
if self.clear_queue:
break
示例7: print_imports
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def print_imports(self, args):
lines_static = []
lines_dynamic = []
for addr, name in self.engine.apicall_handler.hooks.items():
try:
module = self.engine.apicall_handler.module_for_function[name]
except KeyError:
module = "?"
if name in self.sample.imports:
lines_static += [(f"0x{addr:02x}", name, module)]
else:
lines_dynamic += [(f"0x{addr:02x}", name, module)]
print(f"\n{Fore.LIGHTRED_EX}Static imports:{Fore.RESET}")
print_cols(lines_static)
print(f"\n{Fore.LIGHTRED_EX}Dynamic imports:{Fore.RESET}")
print_cols(lines_dynamic)
示例8: do_aaa
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def do_aaa(self, args):
"""Analyze absolutely all: Show a collection of stats about the current sample"""
print(f"{Fore.LIGHTRED_EX}File analysis:{Fore.RESET}")
print_cols([
("YARA:", ", ".join(map(str, self.sample.yara_matches))),
("Chosen unpacker:", self.sample.unpacker.__class__.__name__),
("Allowed sections:", ', '.join(self.sample.unpacker.allowed_sections)),
("End of unpacking stub:",
f"0x{self.sample.unpacker.endaddr:02x}" if self.sample.unpacker.endaddr != sys.maxsize else "unknown"),
("Section hopping detection:", "active" if self.sample.unpacker.section_hopping_control else "inactive"),
("Write+Exec detection:", "active" if self.sample.unpacker.write_execute_control else "inactive")
])
print(f"\n{Fore.LIGHTRED_EX}PE stats:{Fore.RESET}")
print_cols([
("Declared virtual memory size:", f"0x{self.sample.virtualmemorysize:02x}", "", ""),
("Actual loaded image size:", f"0x{len(self.sample.loaded_image):02x}", "", ""),
("Image base address:", f"0x{self.sample.BASE_ADDR:02x}", "", ""),
("Mapped stack space:", f"0x{self.engine.STACK_ADDR:02x}", "-",
f"0x{self.engine.STACK_ADDR + self.engine.STACK_SIZE:02x}"),
("Mapped hook space:", f"0x{self.engine.HOOK_ADDR:02x}", "-", f"0x{self.engine.HOOK_ADDR + 0x1000:02x}")
])
self.do_i("i")
print(f"\n{Fore.LIGHTRED_EX}Register status:{Fore.RESET}")
self.do_i("r")
示例9: PREPEND
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def PREPEND(state):
"""PREPEND is used to print ==> in front of the lines.
They are colorised according to their status.
If everything is good then green else red.
"""
# State 1 is for ok
# State 2 is for notok
print(Style.BRIGHT, end='')
if state == 1:
print(Fore.LIGHTGREEN_EX, end='')
elif state == 2:
print(Fore.LIGHTRED_EX, end='')
else:
pass
print(' ==> ', end='')
print(Style.RESET_ALL, end='')
示例10: labymod
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def labymod(self, uuid, combo, user):
cape = False
if OxygenX.Cape.labymod:
link = f'http://capes.labymod.net/capes/{uuid[:8]}-{uuid[8:12]}-{uuid[12:16]}-{uuid[16:20]}-{uuid[20:]}'
try:
laby = get(url=link).text
if not str(laby).__contains__('Not Found'):
cape = True
except Exception as e:
if self.debug:
self.printing.put(f'{Fore.LIGHTRED_EX}Error Labymod:\n{e}{Fore.WHITE}')
if cape:
Counter.labymod += 1
open(f'{self.folder}/LabymodCape.txt', 'a', encoding='u8').write(
f'{combo} | Username: {user}\n')
return cape
示例11: hivemc
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def hivemc(self, uuid, combo):
rank = False
if OxygenX.Rank.hivemc_rank:
try:
response = get(url=f'https://www.hivemc.com/player/{uuid}').text
match = self.rankhv.search(response).group(1)
if match != 'Regular':
rank = match
except AttributeError:
rank = False
except Exception as e:
if self.debug:
self.printing.put(f'{Fore.LIGHTRED_EX}Error HiveMC:\n{e}{Fore.WHITE}')
if rank:
open(f'{self.folder}/HiveRanked.txt', 'a', encoding='u8').write(
f'{combo} | Rank: {str(rank)}\n')
Counter.hivemcrank += 1
return rank
示例12: veltpvp
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def veltpvp(self, username, combo):
rank = False
if OxygenX.Rank.veltpvp_rank:
try:
link = get(url=f'https://www.veltpvp.com/u/{username}', headers=self.mailheaders).text
if '<h1>Not Found</h1><p>The requested URL' not in link:
rank = self.veltrank.search(link).group(1)
if rank == 'Standard' or rank == 'Default':
rank = False
else:
rank = rank
except AttributeError:
rank = False
except Exception as e:
if self.debug:
self.printing.put(f'{Fore.LIGHTRED_EX}Error Veltpvp:\n{e}{Fore.WHITE}')
if rank:
open(f'{self.folder}/VeltRanked.txt', 'a', encoding='u8').write(f'{combo} | Rank: {rank}\n')
Counter.veltrank += 1
return rank
示例13: lunar
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def lunar(self, uuid, combo):
both = [False, False]
if OxygenX.Rank.lunar_rank:
try:
check = get(url=f'http://www.lunar.gg/u/{uuid}', headers=self.mailheaders).text
if '404: Page Not Found' not in check:
if '>Banned<' in check:
both[1] = True
both[0] = self.lunarr.search(check).group(1)
if both[0] == 'Default':
both[0] = False
else:
both[0] = both[0]
except Exception as e:
if self.debug:
self.printing.put(f'{Fore.LIGHTRED_EX}Error Lunar: \n{e}{Fore.WHITE}')
if both[0]:
open(f'{self.folder}/LunarRanked.txt', 'a', encoding='u8').write(f'{combo} | Rank: {both[0]}\n')
Counter.lunarrank += 1
return both
示例14: mailaccess
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def mailaccess(self, email, password):
mailaccesz = False
if OxygenX.emailaccess:
try:
link = f'http://aj-https.my.com/cgi-bin/auth?timezone=GMT%2B2&reqmode=fg&ajax_call=1&udid=16cbef29939532331560e4eafea6b95790a743e9&device_type=Tablet&mp=iOS¤t=MyCom&mmp=mail&os=iOS&md5_signature=6ae1accb78a8b268728443cba650708e&os_version=9.2&model=iPad%202%3B%28WiFi%29&simple=1&Login={email}&ver=4.2.0.12436&DeviceID=D3E34155-21B4-49C6-ABCD-FD48BB02560D&country=GB&language=fr_FR&LoginType=Direct&Lang=fr_FR&Password={password}&device_vendor=Apple&mob_json=1&DeviceInfo=%7B%22Timezone%22%3A%22GMT%2B2%22%2C%22OS%22%3A%22iOS%209.2%22%2C?%22AppVersion%22%3A%224.2.0.12436%22%2C%22DeviceName%22%3A%22iPad%22%2C%22Device?%22%3A%22Apple%20iPad%202%3B%28WiFi%29%22%7D&device_name=iPad&'
ans = get(url=link, headers=self.mailheaders).text
except Exception as e:
if self.debug:
self.printing.put(f'{Fore.LIGHTRED_EX}Error Mail Access: \n{e}{Fore.WHITE}')
ans = 'bad'
if 'Ok=1' in ans:
mailaccesz = True
if mailaccesz:
Counter.emailaccess += 1
open(f'{self.folder}/EmailAccess.txt', 'a', encoding='u8').write(f'{email}:{password}\n')
return mailaccesz
示例15: get_roll
# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import LIGHTRED_EX [as 别名]
def get_roll(player_name, roll_names):
if os.environ.get('PYCHARM_HOSTED') == "1":
print(Fore.LIGHTRED_EX + "Warning: Cannot use fancy prompt dialog in PyCharm.")
print(Fore.LIGHTRED_EX + "Run this app outside of PyCharm to see it in action.")
val = input(Fore.LIGHTYELLOW_EX + "What is your roll: ")
print(Fore.WHITE)
return val
print(f"Available rolls: {', '.join(roll_names)}.")
# word_comp = WordCompleter(roll_names)
word_comp = PlayComplete()
roll = prompt(f"{player_name}, what is your roll: ", completer=word_comp)
if not roll or roll not in roll_names:
print(f"Sorry {player_name}, {roll} not valid!")
return None
return roll
# def get_roll(player_name, roll_names):
# print("Available rolls:")
# for index, r in enumerate(roll_names, start=1):
# print(f"{index}. {r}")
#
# text = input(f"{player_name}, what is your roll? ")
# selected_index = int(text) - 1
#
# if selected_index < 0 or selected_index >= len(rolls):
# print(f"Sorry {player_name}, {text} is out of bounds!")
# return None
#
# return roll_names[selected_index]
#