diff --git a/objection/api/app.py b/objection/api/app.py index 9d1e1a81..85c59609 100644 --- a/objection/api/app.py +++ b/objection/api/app.py @@ -1,4 +1,5 @@ from flask import Flask + from . import rpc from . import script diff --git a/objection/commands/android/hooking.py b/objection/commands/android/hooking.py index 4d959561..a4df98ec 100644 --- a/objection/commands/android/hooking.py +++ b/objection/commands/android/hooking.py @@ -1,6 +1,7 @@ +import fnmatch + import click import frida -import fnmatch from objection.state.connection import state_connection from objection.utils.helpers import clean_argument_flags @@ -283,8 +284,8 @@ def search_class(args: list) -> None: click.secho('Usage: android hooking search classes ', bold=True) return - click.secho('Note that Java classes are only loaded when they are used,' - ' so if the expected class has not been found, it might not have been loaded yet.', fg='yellow') + click.secho('Note that Java classes are only loaded when they are used,' + ' so if the expected class has not been found, it might not have been loaded yet.', fg='yellow') search = args[0] found = 0 @@ -318,8 +319,8 @@ def search_methods(args: list) -> None: class_filter = args[1] if len(clean_argument_flags(args)) > 1 else None found = 0 - click.secho('Note that Java classes are only loaded when they are used,' - ' so if the expected class has not been found, it might not have been loaded yet.', fg='yellow') + click.secho('Note that Java classes are only loaded when they are used,' + ' so if the expected class has not been found, it might not have been loaded yet.', fg='yellow') if not class_filter: click.secho('Warning, searching all classes may take some time and in some cases, ' diff --git a/objection/commands/android/proxy.py b/objection/commands/android/proxy.py index dc678565..10543483 100644 --- a/objection/commands/android/proxy.py +++ b/objection/commands/android/proxy.py @@ -1,4 +1,5 @@ import click + from objection.state.connection import state_connection diff --git a/objection/commands/ios/monitor.py b/objection/commands/ios/monitor.py index b6971f28..d1d1e59c 100644 --- a/objection/commands/ios/monitor.py +++ b/objection/commands/ios/monitor.py @@ -1,5 +1,6 @@ from objection.state.connection import state_connection + def crypto_enable(args: list = None) -> None: """ Attempts to enable ios crypto monitoring. diff --git a/objection/commands/memory.py b/objection/commands/memory.py index 076f39ea..50cce9f2 100644 --- a/objection/commands/memory.py +++ b/objection/commands/memory.py @@ -1,5 +1,5 @@ -import os import json +import os import click from tabulate import tabulate diff --git a/objection/commands/mobile_packages.py b/objection/commands/mobile_packages.py index f42075c5..3dbfccbb 100644 --- a/objection/commands/mobile_packages.py +++ b/objection/commands/mobile_packages.py @@ -180,7 +180,7 @@ def patch_android_apk(source: str, architecture: str, pause: bool, skip_cleanup: # ensure that we have all of the commandline requirements if not patcher.are_requirements_met(): return - + # ensure we have the latest apk-tool and run the if not patcher.is_apktool_ready(): click.secho('apktool is not ready for use', fg='red', bold=True) @@ -229,6 +229,7 @@ def patch_android_apk(source: str, architecture: str, pause: bool, skip_cleanup: 'Copying final apk from {0} to {1} in current directory...'.format(patcher.get_patched_apk_path(), destination)) shutil.copyfile(patcher.get_patched_apk_path(), os.path.join(os.path.abspath('.'), destination)) + def sign_android_apk(source: str, skip_cleanup: bool = True) -> None: """ Zipaligns and signs an Android APK with the objection key. diff --git a/objection/state/device.py b/objection/state/device.py index bb299347..f92711be 100644 --- a/objection/state/device.py +++ b/objection/state/device.py @@ -12,7 +12,7 @@ class Android(Device): class Ios(Device): """ Represents iOS specific configurations. """ - + name = 'ios' path_seperator = '/' diff --git a/objection/utils/assets/javahookmanager.js b/objection/utils/assets/javahookmanager.js index 028eaf4e..c8a88944 100644 --- a/objection/utils/assets/javahookmanager.js +++ b/objection/utils/assets/javahookmanager.js @@ -62,7 +62,7 @@ class JavaHookManager { validMethod(method) { if (!this.available_methods.includes(method)) { return false; - } + } return true; } @@ -74,11 +74,11 @@ class JavaHookManager { return true; } else { return false; - }; + }; } hook(m, f = null) { - if (!this.validMethod(m)) { + if (!this.validMethod(m)) { this.print(`Method ${m} is not valid for this class.`); return; } @@ -92,11 +92,11 @@ class JavaHookManager { var r = []; this.target[m].overloads.forEach(overload => { if (f == null) { - overload.replacement = function() { + overload.replacement = function () { return overload.apply(this, arguments); } } else { - overload.implementation = function() { + overload.implementation = function () { var ret = overload.apply(this, arguments); return f(arguments, ret); } @@ -105,11 +105,11 @@ class JavaHookManager { r.push(overload); }); - this.hooking.push({method: m, replacements: r}); + this.hooking.push({ method: m, replacements: r }); } unhook(method) { - if (!this.validMethod(method)) { + if (!this.validMethod(method)) { this.print(`Method ${method} is not valid for this class.`); return; } diff --git a/objection/utils/assets/objchookmanager.js b/objection/utils/assets/objchookmanager.js index 1f91ad65..7e862eee 100644 --- a/objection/utils/assets/objchookmanager.js +++ b/objection/utils/assets/objchookmanager.js @@ -40,7 +40,7 @@ class ObjCHookManager { validMethod(method) { if (!this.available_methods.includes(method)) { return false; - } + } return true; } @@ -52,11 +52,11 @@ class ObjCHookManager { return true; } else { return false; - }; + }; } hook(m, enter = null, leave = null) { - if (!this.validMethod(m)) { + if (!this.validMethod(m)) { this.print(`Method ${m} is not valid for this class.`); return; } @@ -80,11 +80,11 @@ class ObjCHookManager { }, }); - this.hooking.push({method: m, listener: l}); + this.hooking.push({ method: m, listener: l }); } unhook(method) { - if (!this.validMethod(method)) { + if (!this.validMethod(method)) { this.print(`Method ${method} is not valid for this class.`); return; } diff --git a/objection/utils/patchers/base.py b/objection/utils/patchers/base.py index 83835761..498d3e79 100644 --- a/objection/utils/patchers/base.py +++ b/objection/utils/patchers/base.py @@ -1,10 +1,10 @@ import json import os +import shlex import shutil +from subprocess import list2cmdline import click -import shlex -from subprocess import list2cmdline from .github import Github