예제 #1
0
 def start_app(self):
     apkFile = self.apkFile
     app = analysis.Application(apkFile)
     self.packageName = app.getPackageName()
     launcherActivity = app.getMainActivity()
     # install apk and launch app
     self.startApp(apkFile, self.packageName, launcherActivity)
     print("app start")
     # wait for app
     time.sleep(10)
     return self.packageName
예제 #2
0
def main():

    # if len(sys.argv) != 2:
    #     print("usage: monitor.py example.apk")
    #     sys.exit(1)

    #get static info
    # apkFile = sys.argv[1]
    task = threading.Thread(target=start_server)
    task.start()
    #start_server()
    apkFile = "/Users/maomao/Desktop/ADM_malware/FakeInst/variety2/0a7a631b5ad0c7c8013adba356597264.apk"
    app = analysis.Application(apkFile)
    packageName = app.getPackageName()
    launcherActivity = app.getMainActivity()

    #install apk and launch app
    start_app(apkFile, packageName, launcherActivity)
    #wait for app
    time.sleep(2)

    pid = None
    device = None
    session = None
    try:
        device = frida.get_usb_device()
        pid = device.spawn([packageName])
        session = device.attach(pid)
    except Exception as e:
        print("[ERROR]: %s" % str(e))
        sys.exit(1)
    print("successfully attached to app")
    script_dir = os.path.join(".", "scripts")
    script_content = build_monitor_script(script_dir)
    script = session.create_script(script_content)
    script.on("message", on_message)
    script.load()
    device.resume(pid)

    #prevent the python script from terminating
    start = time.clock()
    while True:
        end = time.clock()
        if int(end - start) > 300:
            session.detach()
            break
예제 #3
0
def main():

    if len(sys.argv) != 2:
        print("usage: monitor.py example.apk")
        sys.exit(1)

    #get static info
    apkFile = sys.argv[1]
    app = analysis.Application(apkFile)
    packageName = app.getPackageName()
    launcherActivity = app.getMainActivity()

    #install apk and launch app
    start_app(apkFile, packageName, launcherActivity)
    #wait for app
    time.sleep(2)

    pid = None
    device = None
    session = None
    try:
        device = frida.get_usb_device()
        pid = device.spawn([packageName])
        session = device.attach(pid)
    except Exception as e:
        print("[ERROR]: %s" % str(e))
        sys.exit(1)
    print("successfully attached to app")
    script_dir = os.path.join(".", "scripts")
    script_content = build_monitor_script(script_dir)
    script = session.create_script(script_content)
    script.on("message", on_message)
    script.load()
    device.resume(pid)

    #prevent the python script from terminating
    start = time.clock()
    while True:
        end = time.clock()
        if int(end - start) > 300:
            session.detach()
            break
예제 #4
0
    def run(self):
        apkFile = r"E:\app软件破解\未破解\aweme_aweGW_v9.0.0_12535d2.apk"
        app = analysis.Application(apkFile)
        packageName = app.getPackageName()
        launcherActivity = app.getMainActivity()

        # first check app if install
        check_app = self.check_apk_install(packageName)
        if check_app:
            print("[WARNING]: the apk has installed")
            pass
        else:
            #install apk and launch app
            self.start_app(apkFile, packageName, launcherActivity)
            #wait for app
            time.sleep(2)

        pid = None
        device = None
        session = None
        try:
            device = frida.get_usb_device(timeout=5)
            pid = device.spawn([packageName])
            session = device.attach(pid)
        except Exception as e:
            print("[ERROR]: %s" % str(e))
            sys.exit(1)
        print("successfully attached to app")
        script_dir = os.path.join(".", "scripts")
        script_content = self.build_monitor_script(script_dir)
        script = session.create_script(script_content)
        script.on("message", self.on_message)
        script.load()
        device.resume(pid)

        #prevent the python script from terminating
        start = time.process_time()
        while True:
            end = time.process_time()
            if int(end - start) > 300:
                session.detach()
                break