-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frida Scripts QA, Frida Session Injection QA
- Loading branch information
1 parent
1b4721f
commit 505fb8d
Showing
27 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
mobsf/DynamicAnalyzer/tools/frida_scripts/android/others/app-environment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Based on https://github.com/sensepost/objection/blob/f8e78d8a29574c6dadd2b953a63207b45a19b1cf/objection/hooks/android/filesystem/environment.js | ||
var ActivityThread = Java.use('android.app.ActivityThread'); | ||
|
||
var currentApplication = ActivityThread.currentApplication(); | ||
var context = currentApplication.getApplicationContext(); | ||
|
||
var data = { | ||
|
||
filesDirectory: context.getFilesDir().getAbsolutePath().toString(), | ||
cacheDirectory: context.getCacheDir().getAbsolutePath().toString(), | ||
externalCacheDirectory: context.getExternalCacheDir().getAbsolutePath().toString(), | ||
codeCacheDirectory: 'getCodeCacheDir' in context ? context.getCodeCacheDir().getAbsolutePath().toString() : 'n/a', | ||
obbDir: context.getObbDir().getAbsolutePath().toString(), | ||
packageCodePath: context.getPackageCodePath().toString() | ||
}; | ||
|
||
|
||
send(JSON.stringify(data, null, 2)); |
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
mobsf/DynamicAnalyzer/tools/frida_scripts/android/others/crypto-dump-keystore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// https://github.com/sensepost/objection/blob/f8e78d8a29574c6dadd2b953a63207b45a19b1cf/objection/hooks/android/keystore/list.js | ||
// Dump entries in the Android Keystore, together with a flag | ||
// indicating if its a key or a certificate. | ||
// | ||
// Ref: https://developer.android.com/reference/java/security/KeyStore.html | ||
|
||
var KeyStore = Java.use('java.security.KeyStore'); | ||
var entries = []; | ||
|
||
// Prepare the AndroidKeyStore keystore provider and load it. | ||
// Maybe at a later stage we should support adding other stores | ||
// like from file or JKS. | ||
var ks = KeyStore.getInstance('AndroidKeyStore'); | ||
ks.load(null, null); | ||
|
||
// Get the aliases and loop through them. The aliases() method | ||
// return an Enumeration<String> type. | ||
var aliases = ks.aliases(); | ||
|
||
while (aliases.hasMoreElements()) { | ||
|
||
var alias = aliases.nextElement(); | ||
|
||
entries.push({ | ||
'alias': alias.toString(), | ||
'is_key': ks.isKeyEntry(alias), | ||
'is_certificate': ks.isCertificateEntry(alias) | ||
}) | ||
} | ||
|
||
|
||
send(JSON.stringify(entries, null, 2)); | ||
|
||
// - Sample Java | ||
// | ||
// KeyStore ks = KeyStore.getInstance("AndroidKeyStore"); | ||
// ks.load(null); | ||
// Enumeration<String> aliases = ks.aliases(); | ||
// | ||
// while(aliases.hasMoreElements()) { | ||
// Log.e("E", "Aliases = " + aliases.nextElement()); | ||
// } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
mobsf/DynamicAnalyzer/tools/frida_scripts/android/others/device-environment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var Build = Java.use('android.os.Build'); | ||
|
||
var ActivityThread = Java.use('android.app.ActivityThread'); | ||
|
||
var currentApplication = ActivityThread.currentApplication(); | ||
var context = currentApplication.getApplicationContext(); | ||
|
||
var data = { | ||
application_name: context.getPackageName(), | ||
model: Build.MODEL.value.toString(), | ||
board: Build.BOARD.value.toString(), | ||
brand: Build.BRAND.value.toString(), | ||
device: Build.DEVICE.value.toString(), | ||
host: Build.HOST.value.toString(), | ||
id: Build.ID.value.toString(), | ||
product: Build.PRODUCT.value.toString(), | ||
user: Build.USER.value.toString(), | ||
version: Java.androidVersion | ||
} | ||
send(JSON.stringify(data, null, 2)); |
41 changes: 41 additions & 0 deletions
41
mobsf/DynamicAnalyzer/tools/frida_scripts/android/others/dump-clipboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Based on https://github.com/sensepost/objection/blob/f8e78d8a29574c6dadd2b953a63207b45a19b1cf/objection/hooks/android/clipboard/monitor.js | ||
var ActivityThread = Java.use('android.app.ActivityThread'); | ||
var ClipboardManager = Java.use('android.content.ClipboardManager'); | ||
var CLIPBOARD_SERVICE = 'clipboard'; | ||
|
||
var currentApplication = ActivityThread.currentApplication(); | ||
var context = currentApplication.getApplicationContext(); | ||
|
||
var clipboard_handle = context.getApplicationContext().getSystemService(CLIPBOARD_SERVICE); | ||
var clipboard = Java.cast(clipboard_handle, ClipboardManager); | ||
|
||
// Variable used for the current string data | ||
var string_data; | ||
|
||
function check_clipboard_data() { | ||
|
||
Java.perform(function () { | ||
|
||
var primary_clip = clipboard.getPrimaryClip(); | ||
|
||
// If we have managed to get the primary clipboard and there are | ||
// items stored in it, process an update. | ||
if (primary_clip != null && primary_clip.getItemCount() > 0) { | ||
|
||
var data = primary_clip.getItemAt(0).coerceToText(context).toString(); | ||
|
||
// If the data is the same, just stop. | ||
if (string_data == data) { | ||
return; | ||
} | ||
|
||
// Update the data with the new string and report back. | ||
string_data = data; | ||
send(JSON.stringify(data, null, 2)); | ||
|
||
} | ||
}); | ||
} | ||
|
||
// Poll every 5 seconds | ||
setInterval(check_clipboard_data, 1000 * 5); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters