mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-11 22:50:09 +00:00
[HOTFIX] Android script loading, frida injected code view, paramiko SSH issues (#2300)
* Android script loading bug fix * Frida injected code view * Paramiko SSH reactor to address some host key issues, revert from warning to autoadd. * Frida Injection refactoring
This commit is contained in:
@@ -12,4 +12,4 @@ Java.perform(function () {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -134,10 +134,84 @@ function bypassJailbreakDetection(){
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (ObjC.available) {
|
||||
bypassJailbreakDetection();
|
||||
} else {
|
||||
send('[Jailbreak Detection Bypass] error: Objective-C Runtime is not available!');
|
||||
|
||||
function bypassJailbreakDetection2() {
|
||||
try {
|
||||
|
||||
var resolver = new ApiResolver('objc');
|
||||
|
||||
resolver.enumerateMatches('*[* *jail**]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function() {},
|
||||
onLeave: function(retval) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
|
||||
resolver.enumerateMatches('*[* fileExistsAtPath*]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function(args) {
|
||||
var path = ObjC.Object(args[2]).toString();
|
||||
this.jailbreakCall = false;
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
if (paths[i] == path) {
|
||||
this.jailbreakCall = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
onLeave: function(retval) {
|
||||
if (this.jailbreakCall) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
|
||||
resolver.enumerateMatches('*[* canOpenURL*]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function(args) {
|
||||
var url = ObjC.Object(args[2]).toString();
|
||||
this.jailbreakCall = false;
|
||||
if (url.indexOf("cydia") >= 0) {
|
||||
this.jailbreakCall = true;
|
||||
}
|
||||
},
|
||||
onLeave: function(retval) {
|
||||
if (this.jailbreakCall) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
send("[Jailbreak Detection Bypass 2] success");
|
||||
}
|
||||
catch(e) {
|
||||
send('[Jailbreak Detection Bypass 2] script error:' + e.toString());
|
||||
}
|
||||
}
|
||||
} catch(err) {}
|
||||
|
||||
try {
|
||||
if (ObjC.available) {
|
||||
bypassJailbreakDetection();
|
||||
// Disable the below if the app is crashing
|
||||
setTimeout(() => {
|
||||
bypassJailbreakDetection2();
|
||||
}, "1000");
|
||||
} else {
|
||||
send('[Jailbreak Detection Bypass] error: Objective-C Runtime is not available!');
|
||||
}
|
||||
} catch(err) {}
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
var paths = [
|
||||
"/Applications/blackra1n.app",
|
||||
"/Applications/Cydia.app",
|
||||
"/Applications/FakeCarrier.app",
|
||||
"/Applications/Icy.app",
|
||||
"/Applications/IntelliScreen.app",
|
||||
"/Applications/MxTube.app",
|
||||
"/Applications/RockApp.app",
|
||||
"/Applications/SBSetttings.app",
|
||||
"/Applications/WinterBoard.app",
|
||||
"/bin/bash",
|
||||
"/bin/sh",
|
||||
"/bin/su",
|
||||
"/etc/apt",
|
||||
"/etc/ssh/sshd_config",
|
||||
"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",
|
||||
"/Library/MobileSubstrate/DynamicLibraries/Veency.plist",
|
||||
"/Library/MobileSubstrate/MobileSubstrate.dylib",
|
||||
"/pguntether",
|
||||
"/private/var/lib/cydia",
|
||||
"/private/var/mobile/Library/SBSettings/Themes",
|
||||
"/private/var/stash",
|
||||
"/private/var/tmp/cydia.log",
|
||||
"/System/Library/LaunchDaemons/com.ikey.bbot.plist",
|
||||
"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
|
||||
"/usr/bin/cycript",
|
||||
"/usr/bin/ssh",
|
||||
"/usr/bin/sshd",
|
||||
"/usr/libexec/sftp-server",
|
||||
"/usr/libexec/ssh-keysign",
|
||||
"/usr/sbin/frida-server",
|
||||
"/usr/sbin/sshd",
|
||||
"/var/cache/apt",
|
||||
"/var/lib/cydia",
|
||||
"/var/log/syslog",
|
||||
"/var/mobile/Media/.evasi0n7_installed",
|
||||
"/var/tmp/cydia.log",
|
||||
"/etc/apt",
|
||||
"/Library/MobileSubstrate/MobileSubstrate.dylib",
|
||||
"/Applications/Cydia.app",
|
||||
"/Applications/blackra1n.app",
|
||||
"/Applications/FakeCarrier.app",
|
||||
"/Applications/Icy.app",
|
||||
"/Applications/IntelliScreen.app",
|
||||
"/Applications/MxTube.app",
|
||||
"/Applications/RockApp.app",
|
||||
"/Applications/SBSetttings.app",
|
||||
"/private/var/lib/apt/",
|
||||
"/Applications/WinterBoard.app",
|
||||
"/usr/sbin/sshd",
|
||||
"/private/var/tmp/cydia.log",
|
||||
"/usr/binsshd",
|
||||
"/usr/libexec/sftp-server",
|
||||
"/Systetem/Library/LaunchDaemons/com.ikey.bbot.plist",
|
||||
"/System/Library/LaunchDaemons/[email protected]",
|
||||
"/var/log/syslog",
|
||||
"/bin/bash",
|
||||
"/bin/sh",
|
||||
"/etc/ssh/sshd_config",
|
||||
"/usr/libexec/ssh-keysign",
|
||||
"/Library/MobileSubstrate/DynamicLibraries/Veency.plist",
|
||||
"/System/Library/LaunchDaemons/com.ikey.bbot.plist",
|
||||
"/private/var/stash",
|
||||
"/usr/bin/cycript",
|
||||
"/usr/bin/ssh",
|
||||
"/usr/bin/sshd",
|
||||
"/var/cache/apt",
|
||||
"/var/lib/cydia",
|
||||
"/var/tmp/cydia.log",
|
||||
"/Applications/SBSettings.app",
|
||||
"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",
|
||||
"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
|
||||
"/private/var/lib/apt",
|
||||
"/private/var/lib/cydia",
|
||||
"/private/var/mobile/Library/SBSettings/Themes",
|
||||
"/var/lib/apt",
|
||||
"/private/jailbreak.txt",
|
||||
"/bin/su",
|
||||
"/pguntether",
|
||||
"/usr/sbin/frida-server",
|
||||
"/private/Jailbreaktest.txt",
|
||||
"/var/mobile/Media/.evasi0n7_installed",
|
||||
"cydia://package/com.example.package"
|
||||
];
|
||||
|
||||
function bypassJailbreakDetection2() {
|
||||
try {
|
||||
|
||||
var resolver = new ApiResolver('objc');
|
||||
|
||||
resolver.enumerateMatches('*[* *jail**]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function() {},
|
||||
onLeave: function(retval) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
|
||||
resolver.enumerateMatches('*[* fileExistsAtPath*]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function(args) {
|
||||
var path = ObjC.Object(args[2]).toString();
|
||||
this.jailbreakCall = false;
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
if (paths[i] == path) {
|
||||
this.jailbreakCall = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
onLeave: function(retval) {
|
||||
if (this.jailbreakCall) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
|
||||
resolver.enumerateMatches('*[* canOpenURL*]', {
|
||||
onMatch: function(match) {
|
||||
var ptr = match["address"];
|
||||
Interceptor.attach(ptr, {
|
||||
onEnter: function(args) {
|
||||
var url = ObjC.Object(args[2]).toString();
|
||||
this.jailbreakCall = false;
|
||||
if (url.indexOf("cydia") >= 0) {
|
||||
this.jailbreakCall = true;
|
||||
}
|
||||
},
|
||||
onLeave: function(retval) {
|
||||
if (this.jailbreakCall) {
|
||||
retval.replace(0x0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onComplete: function() {}
|
||||
});
|
||||
send("[Jailbreak Detection Bypass 2] success");
|
||||
}
|
||||
catch(e) {
|
||||
send('[Jailbreak Detection Bypass 2] script error:' + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (ObjC.available) {
|
||||
bypassJailbreakDetection2();
|
||||
} else {
|
||||
send('[Jailbreak Detection Bypass 2] error: Objective-C Runtime is not available!');
|
||||
}
|
||||
} catch(err) {}
|
||||
@@ -59,7 +59,9 @@ function getDataProtectionKeysForAllPaths() {
|
||||
|
||||
send('Dumping Application Directory file information');
|
||||
try {
|
||||
send(JSON.stringify({'[MBSFDUMP] datadir': getDataProtectionKeysForAllPaths()}));
|
||||
setTimeout(() => {
|
||||
send(JSON.stringify({'[MBSFDUMP] datadir': getDataProtectionKeysForAllPaths()}));
|
||||
}, "2000");
|
||||
} catch(err) {}
|
||||
|
||||
// /********************************************************************************
|
||||
|
||||
@@ -28,5 +28,8 @@ function ns_userdefaults() {
|
||||
}
|
||||
|
||||
try{
|
||||
ns_userdefaults();
|
||||
setTimeout(() => {
|
||||
ns_userdefaults();
|
||||
}, "2000");
|
||||
|
||||
} catch(err) {}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Get caller of the function using backtrace
|
||||
|
||||
// From: https://node-security.com/posts/frida-for-ios/
|
||||
function getBacktrace(){
|
||||
send('Get the caller of the function using backtrace');
|
||||
Interceptor.attach(ObjC.classes.NSFileManager['- fileExistsAtPath:'].implementation, {
|
||||
onEnter: function (args) {
|
||||
const backtrace = Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n");
|
||||
console.log(backtrace + "\n");
|
||||
console.log(ObjC.Object(args[2]).toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
getBacktrace();
|
||||
} catch(err) {}
|
||||
@@ -147,6 +147,7 @@ class Frida:
|
||||
except frida.TimedOutError:
|
||||
logger.error('Timed out while waiting for device to appear')
|
||||
except (frida.ProcessNotFoundError,
|
||||
frida.ProcessNotRespondingError,
|
||||
frida.TransportError,
|
||||
frida.InvalidOperationError):
|
||||
pass
|
||||
@@ -184,6 +185,7 @@ class Frida:
|
||||
except frida.NotSupportedError:
|
||||
logger.exception('Not Supported Error')
|
||||
except (frida.ProcessNotFoundError,
|
||||
frida.ProcessNotRespondingError,
|
||||
frida.TransportError,
|
||||
frida.InvalidOperationError):
|
||||
pass
|
||||
|
||||
@@ -7,7 +7,7 @@ from mobsf.MobSF.utils import strict_package_check
|
||||
|
||||
def get_content(file_name):
|
||||
tools_dir = Path(settings.TOOLS_DIR)
|
||||
aux_dir = tools_dir / 'frida_scripts' / 'ios' / 'auxiliary'
|
||||
aux_dir = tools_dir / 'frida_scripts' / 'android' / 'auxiliary'
|
||||
script = aux_dir / file_name
|
||||
|
||||
if script.exists():
|
||||
|
||||
@@ -102,6 +102,9 @@ def instrument(request, api=False):
|
||||
elif action == 'ps':
|
||||
logger.info('Enumerating running applications')
|
||||
data['message'] = frida_obj.ps()
|
||||
elif action == 'get':
|
||||
# Get injected Frida script.
|
||||
data['message'] = frida_obj.get_script()
|
||||
if action in ('spawn', 'session'):
|
||||
if pid and pid.isdigit():
|
||||
# Attach to a different pid/bundle id
|
||||
|
||||
@@ -344,6 +344,10 @@ class CorelliumInstanceAPI:
|
||||
# Should not be greater than max screen size
|
||||
swipe_x = min(int(x) + 200, int(max_x))
|
||||
swipe_y = min(int(y) + 400, int(max_y))
|
||||
# Just to prevent linter complaining
|
||||
# Make use of these variables in future
|
||||
swipe_x = swipe_y
|
||||
swipe_y = swipe_x
|
||||
if event == 'home':
|
||||
data = [{
|
||||
'buttons': ['holdButton'],
|
||||
@@ -374,8 +378,9 @@ class CorelliumInstanceAPI:
|
||||
elif event == 'swipe_down':
|
||||
data = [{
|
||||
'startButtons': ['finger'],
|
||||
'start': [[x, swipe_y]],
|
||||
'end': [[swipe_x, y]],
|
||||
'start': [[300, 600]],
|
||||
'bezierPoints': [[[700, 350]], [[850, 375]]],
|
||||
'end': [[950, 400]],
|
||||
'duration': 200,
|
||||
}]
|
||||
elif event == 'swipe_left':
|
||||
|
||||
@@ -358,7 +358,7 @@ def appsync_ipa_install(ssh_string):
|
||||
out = ssh_execute_cmd(target, 'appinst /tmp/app.ipa')
|
||||
target.close()
|
||||
jumpbox.close()
|
||||
if 'Failed' in out:
|
||||
if 'Successfully installed' not in out:
|
||||
logger.error('AppSync IPA Install Failed.\n%s', out)
|
||||
return out
|
||||
logger.info(out)
|
||||
|
||||
@@ -212,8 +212,7 @@ def ssh_jump_host(ssh_string):
|
||||
generate_keypair_if_not_exists(home)
|
||||
keyf = home / 'ssh_key.private'
|
||||
jumpbox = paramiko.SSHClient()
|
||||
jumpbox.load_system_host_keys()
|
||||
jumpbox.set_missing_host_key_policy(paramiko.WarningPolicy())
|
||||
jumpbox.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
jumpbox.connect(
|
||||
bastion_host,
|
||||
username=bastion_user,
|
||||
@@ -226,8 +225,7 @@ def ssh_jump_host(ssh_string):
|
||||
'direct-tcpip', dest_addr, src_addr)
|
||||
|
||||
target = paramiko.SSHClient()
|
||||
target.load_system_host_keys()
|
||||
target.set_missing_host_key_policy(paramiko.WarningPolicy())
|
||||
target.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
target.connect(
|
||||
private_ip,
|
||||
username=user,
|
||||
|
||||
@@ -53,6 +53,11 @@ class Frida:
|
||||
self.frida_log = self.ipa_dir / 'mobsf_frida_out.txt'
|
||||
self.dump_file = self.ipa_dir / 'mobsf_dump_file.txt'
|
||||
self.container_file = self.ipa_dir / 'mobsf_app_container_path.txt'
|
||||
self.not_supported_text = (
|
||||
'Failed to instrument the app with Frida. '
|
||||
'This app is not supported by Frida. '
|
||||
'Are you able to run the app on '
|
||||
'this device?')
|
||||
|
||||
def get_scripts(self, script_type, selected_scripts):
|
||||
"""Get Frida Scripts."""
|
||||
@@ -159,7 +164,7 @@ class Frida:
|
||||
self.clean_up()
|
||||
_PID = frida.get_remote_device().spawn([self.bundle_id])
|
||||
except frida.NotSupportedError:
|
||||
logger.exception('Not Supported Error')
|
||||
logger.error(self.not_supported_text)
|
||||
return
|
||||
except frida.ServerNotRunningError:
|
||||
self.frida_ssh_forward()
|
||||
@@ -170,9 +175,10 @@ class Frida:
|
||||
except frida.TimedOutError:
|
||||
logger.error('Timed out while waiting for device to appear')
|
||||
except frida.NotSupportedError:
|
||||
logger.exception('Not Supported Error')
|
||||
logger.error(self.not_supported_text)
|
||||
return
|
||||
except (frida.ProcessNotFoundError,
|
||||
frida.ProcessNotRespondingError,
|
||||
frida.TransportError,
|
||||
frida.InvalidOperationError):
|
||||
pass
|
||||
@@ -193,10 +199,11 @@ class Frida:
|
||||
# No front most app, spawn the app or
|
||||
# pid is not the front most app
|
||||
_PID = device.spawn([self.bundle_id])
|
||||
logger.info('Spawning %s', self.bundle_id)
|
||||
# pid is the fornt most app
|
||||
session = device.attach(_PID)
|
||||
except frida.NotSupportedError:
|
||||
logger.exception('Not Supported Error')
|
||||
logger.error(self.not_supported_text)
|
||||
return
|
||||
except Exception:
|
||||
logger.warning('Cannot attach to pid, spawning again')
|
||||
@@ -214,8 +221,9 @@ class Frida:
|
||||
script.unload()
|
||||
session.detach()
|
||||
except frida.NotSupportedError:
|
||||
logger.exception('Not Supported Error')
|
||||
logger.error(self.not_supported_text)
|
||||
except (frida.ProcessNotFoundError,
|
||||
frida.ProcessNotRespondingError,
|
||||
frida.TransportError,
|
||||
frida.InvalidOperationError):
|
||||
pass
|
||||
|
||||
@@ -92,6 +92,9 @@ def ios_instrument(request, api=False):
|
||||
elif action == 'ps':
|
||||
logger.info('Enumerating running applications')
|
||||
data['message'] = frida_obj.ps()
|
||||
elif action == 'get':
|
||||
# Get injected Frida script.
|
||||
data['message'] = frida_obj.get_script()
|
||||
if action in ('spawn', 'session'):
|
||||
if pid and pid.isdigit():
|
||||
# Attach to a different pid/bundle id
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ from mobsf.install.windows.setup import windows_config_local
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
VERSION = '3.8.3'
|
||||
VERSION = '3.8.4'
|
||||
BANNER = """
|
||||
__ __ _ ____ _____ _____ ___
|
||||
| \/ | ___ | |__/ ___|| ___|_ _|___ / ( _ )
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="{% static "others/css/terminal.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "others/css/devices.min.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "codemirror/codemirror.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "enlighterjs/enlighterjs.min.css" %}" />
|
||||
<link rel="stylesheet" href="{% static "codemirror/lint.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "others/css/spinner.css" %}">
|
||||
<style>
|
||||
@@ -239,9 +240,10 @@
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer">
|
||||
<button id="frida_spawn" type="submit" class="btn btn-success"><i class="far fa-play-circle"></i> Spawn & Inject</button>
|
||||
<button id="frida_session" type="submit" class="btn btn-success"><i class="fas fa-redo"></i> Inject </button>
|
||||
<button id="frida_attach" type="submit" class="btn btn-success"><i class="fas fa-bug"></i> Attach </button>
|
||||
<button id="frida_spawn" type="submit" class="btn btn-success btn-sm"><i class="far fa-play-circle"></i> Spawn & Inject</button>
|
||||
<button id="frida_session" type="submit" class="btn btn-success btn-sm"><i class="fas fa-redo"></i> Inject </button>
|
||||
<button id="frida_attach" type="submit" class="btn btn-success btn-sm"><i class="fas fa-bug"></i> Attach </button>
|
||||
<button id="frida_get" class="btn btn-primary btn-sm" hidden><i class="fas fa-code"></i> Injected Code</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -402,6 +404,21 @@ Java.perform(function() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="get_code_modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Injected Frida Script</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="injected_content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal" id="tls_modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
@@ -486,6 +503,7 @@ Java.perform(function() {
|
||||
<script src="{% static "codemirror/lint.js" %}"></script>
|
||||
<script src="{% static "codemirror/javascript-lint.js" %}"></script>
|
||||
<script src="{% static "others/js/swipe.js" %}"></script>
|
||||
<script src="{% static "enlighterjs/enlighterjs.min.js" %}"></script>
|
||||
<script>
|
||||
// Loading Spinner
|
||||
function dynamic_loader(){
|
||||
@@ -1195,9 +1213,11 @@ function frida_instrument(frida_action, pid=null, new_pkg=null){
|
||||
// Save Frida Code to Session Storage
|
||||
var code = editor.getDoc().getValue();
|
||||
window.sessionStorage.setItem('code_android', code);
|
||||
//Show Frida logs
|
||||
// Show Frida logs
|
||||
document.getElementById('frida-logs').style.display = 'block';
|
||||
var default_hooks = [];
|
||||
// Show Frida inject button
|
||||
document.getElementById('frida_get').hidden = false;
|
||||
var default_hooks = [];
|
||||
|
||||
$.each($("input[name='default_hooks']:checked"), function(){
|
||||
default_hooks.push($(this).val());
|
||||
@@ -1219,6 +1239,8 @@ function frida_instrument(frida_action, pid=null, new_pkg=null){
|
||||
print_status("Attaching to PID: " + parseInt(pid));
|
||||
} else if (frida_action == 'ps'){
|
||||
print_status("Enumerating running processes.");
|
||||
} else if (frida_action == 'get'){
|
||||
print_status("Getting injected frida script.");
|
||||
}
|
||||
action('{% url 'android_instrument' %}', {
|
||||
frida_action,
|
||||
@@ -1232,8 +1254,8 @@ function frida_instrument(frida_action, pid=null, new_pkg=null){
|
||||
class_trace: $('#class_trace').val(),
|
||||
frida_code: editor.getDoc().getValue(),
|
||||
}, function(json) {
|
||||
if (json.status !== "ok")
|
||||
print_status(json.message);
|
||||
if (json.status !== "ok")
|
||||
print_status(json.message);
|
||||
// Attach to a running process
|
||||
if (frida_action == 'ps' && json.message && json.message.length > 0 && Array.isArray(json.message)){
|
||||
$("#process_select").empty();
|
||||
@@ -1242,11 +1264,21 @@ function frida_instrument(frida_action, pid=null, new_pkg=null){
|
||||
'<option value=' + escape(p.pid.toString()) + ',' + escape(p.identifier.toString()) + '>' + escape(p.pid.toString()) + ': ' + escapeHtml(p.name.toString()) + ' - ' + escape(p.identifier.toString()) + '</option>');
|
||||
});
|
||||
$('#frida_attach_mdl').modal('toggle');
|
||||
} else if (frida_action =='get'){
|
||||
var injected = document.getElementById("injected_content");
|
||||
injected.innerHTML = '<pre id="injected-pre"></pre>';
|
||||
document.getElementById("injected-pre").textContent = json.message;
|
||||
EnlighterJS.enlight( document.getElementById('injected-pre'), {
|
||||
theme: 'enlighter',
|
||||
linehover: false,
|
||||
textOverflow: 'scroll',
|
||||
language: 'javascript',
|
||||
});
|
||||
$('#get_code_modal').modal('toggle');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Frida Spawn
|
||||
$("#frida_spawn").click(function() {
|
||||
frida_instrument('spawn');
|
||||
@@ -1255,7 +1287,10 @@ $("#frida_spawn").click(function() {
|
||||
|
||||
// Frida Session
|
||||
$("#frida_session").click(function() {
|
||||
$( "input[name='default_hooks']:checkbox" ).prop( "checked", false );
|
||||
var default_hooks = "input[name='default_hooks']";
|
||||
if ($(default_hooks + ":checked").length == $(default_hooks).length)
|
||||
// If all default hooks are selected, uncheck all during injection
|
||||
$(default_hooks + ':checkbox').prop("checked", false );
|
||||
frida_instrument('session');
|
||||
return false;
|
||||
});
|
||||
@@ -1277,6 +1312,11 @@ $("#attach_to_pid").click(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
// Frida Get Injected Script
|
||||
$("#frida_get").click(function() {
|
||||
frida_instrument('get');
|
||||
return false;
|
||||
});
|
||||
|
||||
//Frida Get Runtime Dependencies
|
||||
$("#deps").click(function() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="{% static "others/css/terminal.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "others/css/devices.min.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "codemirror/codemirror.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "enlighterjs/enlighterjs.min.css" %}" />
|
||||
<link rel="stylesheet" href="{% static "codemirror/lint.css" %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static "others/css/spinner.css" %}">
|
||||
<link href="{% static "adminlte/plugins/sweetalert2/sweetalert2.min.css" %}" rel="stylesheet">
|
||||
@@ -174,9 +175,6 @@
|
||||
Jailbreak Detection Bypass
|
||||
</label>
|
||||
<label>
|
||||
<input name="default_hooks" type="checkbox" value="jailbreak_bypass2">
|
||||
Jailbreak Detection Bypass 2
|
||||
</label>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="form-group">
|
||||
@@ -280,10 +278,11 @@
|
||||
<!-- /.box-body -->
|
||||
|
||||
<div class="box-footer">
|
||||
<button id="run" type="submit" class="btn btn-success"><i class="fas fa-play"></i> Run</button>
|
||||
<button id="frida_spawn" type="submit" class="btn btn-success"><i class="far fa-play-circle"></i> Spawn & Inject</button>
|
||||
<button id="frida_session" type="submit" class="btn btn-success"><i class="fas fa-redo"></i> Inject </button>
|
||||
<button id="frida_attach" type="submit" class="btn btn-success"><i class="fas fa-bug"></i> Attach </button>
|
||||
<button id="run" type="submit" class="btn btn-success btn-sm"><i class="fas fa-play"></i> Run</button>
|
||||
<button id="frida_spawn" type="submit" class="btn btn-success btn-sm"><i class="far fa-play-circle"></i> Spawn & Inject</button>
|
||||
<button id="frida_session" type="submit" class="btn btn-success btn-sm"><i class="fas fa-redo"></i> Inject </button>
|
||||
<button id="frida_attach" type="submit" class="btn btn-success btn-sm"><i class="fas fa-bug"></i> Attach </button>
|
||||
<button id="frida_get" class="btn btn-primary btn-sm" hidden><i class="fas fa-code"></i> Injected Code</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -399,6 +398,22 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="get_code_modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Injected Frida Script</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="injected_content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="frida_attach_mdl" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
@@ -442,6 +457,7 @@
|
||||
<script src="{% static "codemirror/javascript-lint.js" %}"></script>
|
||||
<script src="{% static "others/js/swipe.js" %}"></script>
|
||||
<script src="{% static "adminlte/plugins/sweetalert2/sweetalert2.min.js" %}"></script>
|
||||
<script src="{% static "enlighterjs/enlighterjs.min.js" %}"></script>
|
||||
<script>
|
||||
|
||||
var appContainerPath;
|
||||
@@ -1013,6 +1029,7 @@ $("#run").click(function() {
|
||||
print_status('Runnning application');
|
||||
} else {
|
||||
print_status('Failed to run the application');
|
||||
Swal.fire('Failed!', escape(json.message), 'error')
|
||||
}
|
||||
});
|
||||
return false;
|
||||
@@ -1041,8 +1058,10 @@ function frida_instrument(frida_action, pid=null, new_bundle_id=null){
|
||||
// Save Frida Code to Session Storage
|
||||
var code = editor.getDoc().getValue();
|
||||
window.sessionStorage.setItem('code', code);
|
||||
//Show Frida logs
|
||||
// Show Frida logs
|
||||
document.getElementById('frida-logs').style.display = 'block';
|
||||
// Show Frida inject button
|
||||
document.getElementById('frida_get').hidden = false;
|
||||
var default_hooks = [];
|
||||
var dump_hooks = [];
|
||||
|
||||
@@ -1065,6 +1084,8 @@ function frida_instrument(frida_action, pid=null, new_bundle_id=null){
|
||||
print_status("Attaching to PID: " + parseInt(pid));
|
||||
} else if (frida_action == 'ps'){
|
||||
print_status("Enumerating running processes.");
|
||||
} else if (frida_action == 'get'){
|
||||
print_status("Getting injected frida script.");
|
||||
}
|
||||
action('{% url 'ios_instrument' %}', {
|
||||
frida_action,
|
||||
@@ -1095,6 +1116,17 @@ function frida_instrument(frida_action, pid=null, new_bundle_id=null){
|
||||
'<option value=' + escape(p.pid.toString()) + ',' + escape(p.identifier.toString()) + '>' + escape(p.pid.toString()) + ': ' + escapeHtml(p.name.toString()) + ' - ' + escape(p.identifier.toString()) + '</option>');
|
||||
});
|
||||
$('#frida_attach_mdl').modal('toggle');
|
||||
} else if (frida_action =='get'){
|
||||
var injected = document.getElementById("injected_content");
|
||||
injected.innerHTML = '<pre id="injected-pre"></pre>';
|
||||
document.getElementById("injected-pre").textContent = json.message;
|
||||
EnlighterJS.enlight( document.getElementById('injected-pre'), {
|
||||
theme: 'enlighter',
|
||||
linehover: false,
|
||||
textOverflow: 'scroll',
|
||||
language: 'javascript',
|
||||
});
|
||||
$('#get_code_modal').modal('toggle');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1110,8 +1142,16 @@ $("#frida_spawn").click(function() {
|
||||
|
||||
// Frida Session
|
||||
$("#frida_session").click(function() {
|
||||
$( "input[name='default_hooks']:checkbox" ).prop( "checked", false );
|
||||
$( "input[name='dump_hooks']:checkbox" ).prop( "checked", false );
|
||||
var default_hooks = "input[name='default_hooks']";
|
||||
var dump_hooks = "input[name='dump_hooks']";
|
||||
|
||||
if ($(default_hooks + ":checked").length == $(default_hooks).length && $(dump_hooks + ":checked").length == $(dump_hooks).length){
|
||||
// If all default hooks and dump hooks are selected, uncheck all during injection
|
||||
$( default_hooks + ":checkbox" ).prop( "checked", false );
|
||||
$( dump_hooks + ":checkbox" ).prop( "checked", false );
|
||||
}
|
||||
|
||||
|
||||
start_network_capture();
|
||||
frida_instrument('session');
|
||||
enableReportBtn(2);
|
||||
@@ -1123,7 +1163,7 @@ $("#frida_session").click(function() {
|
||||
$("#frida_attach").click(function() {
|
||||
frida_instrument('ps');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Frida Attach to Pid
|
||||
$("#attach_to_pid").click(function() {
|
||||
@@ -1135,7 +1175,13 @@ $("#attach_to_pid").click(function() {
|
||||
$('#frida_attach_mdl').modal('hide');
|
||||
enableReportBtn(2);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Frida Get Injected Script
|
||||
$("#frida_get").click(function() {
|
||||
frida_instrument('get');
|
||||
return false;
|
||||
});
|
||||
|
||||
//Finish & Generate Report
|
||||
$("#report").one( "click", function() {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "mobsf"
|
||||
version = "3.8.3"
|
||||
version = "3.8.4"
|
||||
description = "Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis."
|
||||
keywords = ["mobsf", "mobile security framework", "mobile security", "security tool", "static analysis", "dynamic analysis", "malware analysis"]
|
||||
authors = ["Ajin Abraham <[email protected]>"]
|
||||
|
||||
Reference in New Issue
Block a user