Skip to content

Commit e282ea0

Browse files
authored
(fix) frida v17 changes, webserver disabled. (#734)
* (fix) frida v17 changes, webserver disabled. * (feat) Frida < 17 backwards compatibility. * (feat) objection backwards compatibility (-g explore). Bump dep versions. * (chore) deprecated `pkg_resources` replaced with `packaging`.
1 parent 9fbf5af commit e282ea0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+331
-200
lines changed

agent/package-lock.json

Lines changed: 34 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
},
3030
"homepage": "https://github.com/sensepost/objection#readme",
3131
"dependencies": {
32-
"frida-java-bridge": "^6",
33-
"frida-objc-bridge": "^7",
34-
"frida-screenshot": "^5",
32+
"frida-java-bridge": "^7",
33+
"frida-objc-bridge": "^8",
34+
"frida-screenshot": "^6",
3535
"macho-ts": "^0.1.0"
3636
},
3737
"devDependencies": {
38-
"@types/frida-gum": "^18",
38+
"@types/frida-gum": "^19",
3939
"@types/node": "^18",
40-
"frida-compile": "^16",
40+
"frida-compile": "^17",
4141
"tslint": "^6"
4242
}
4343
}

agent/src/android/clipboard.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { colors as c } from "../lib/color.js";
22
import {
33
getApplicationContext,
4-
wrapJavaPerform
4+
wrapJavaPerform,
5+
Java
56
} from "./lib/libjava.js";
67
import { ClipboardManager } from "./lib/types.js";
78

agent/src/android/filesystem.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { hexStringToBytes } from "../lib/helpers.js";
44
import { IAndroidFilesystem } from "./lib/interfaces.js";
55
import {
66
getApplicationContext,
7-
wrapJavaPerform
7+
wrapJavaPerform,
8+
Java
89
} from "./lib/libjava.js";
910
import {
1011
File,

agent/src/android/general.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { wrapJavaPerform } from "./lib/libjava.js";
1+
import {
2+
wrapJavaPerform,
3+
Java
4+
} from "./lib/libjava.js";
25

36
export const deoptimize = (): Promise<void> => {
47
return wrapJavaPerform(() => {

agent/src/android/heap.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import {
55
IJavaField,
66
IHeapNormalised
77
} from "./lib/interfaces.js";
8-
import { wrapJavaPerform } from "./lib/libjava.js";
9-
8+
import {
9+
wrapJavaPerform,
10+
Java
11+
} from "./lib/libjava.js";
1012
export let handles: IHeapClassDictionary = {};
13+
import type { default as JavaTypes } from "frida-java-bridge";
14+
1115

12-
const getInstance = (hashcode: number): Java.Wrapper | null => {
16+
const getInstance = (hashcode: number): JavaTypes.Wrapper | null => {
1317
const matches: IHeapObject[] = [];
1418

1519
// Search for this handle, and push the results to matches
@@ -112,7 +116,7 @@ export const fields = (handle: number): Promise<IJavaField[]> => {
112116

113117
return clazz.class.getDeclaredFields().map((field: any): IJavaField => {
114118
const fieldName: string = field.getName();
115-
const fieldInstance: Java.Wrapper = clazz.class.getDeclaredField(fieldName);
119+
const fieldInstance: JavaTypes.Wrapper = clazz.class.getDeclaredField(fieldName);
116120
fieldInstance.setAccessible(true);
117121

118122
let fieldValue = fieldInstance.get(clazz);

agent/src/android/hooking.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { ICurrentActivityFragment } from "./lib/interfaces.js";
44
import {
55
getApplicationContext,
66
R,
7-
wrapJavaPerform
7+
wrapJavaPerform,
8+
Java
89
} from "./lib/libjava.js";
910
import {
1011
Activity,
@@ -16,6 +17,7 @@ import {
1617
Throwable,
1718
JavaMethodsOverloadsResult,
1819
} from "./lib/types.js";
20+
import type { default as JavaTypes } from "frida-java-bridge";
1921

2022
enum PatternType {
2123
Regex = 'regex',
@@ -70,7 +72,7 @@ export const lazyWatchForPattern = (query: string, watch: boolean, dargs: boolea
7072

7173
// This method loops over all enumerate matches and then calls watch
7274
// with the arguments specified in the parent function
73-
const watchMatches = (matches: Java.EnumerateMethodsMatchGroup[]) => {
75+
const watchMatches = (matches: JavaTypes.EnumerateMethodsMatchGroup[]) => {
7476
matches.forEach(match => {
7577
match.classes.forEach(_class => {
7678
_class.methods.forEach(_method => {
@@ -114,7 +116,7 @@ export const lazyWatchForPattern = (query: string, watch: boolean, dargs: boolea
114116
}, 1000 * 5);
115117
};
116118

117-
export const javaEnumerate = (query: string): Promise<Java.EnumerateMethodsMatchGroup[]> => {
119+
export const javaEnumerate = (query: string): Promise<JavaTypes.EnumerateMethodsMatchGroup[]> => {
118120
// If the query is just a classname, strongarm it into a pattern.
119121
if (getPatternType(query) === PatternType.Klass) {
120122
query = `*${query}*!*`;
@@ -270,9 +272,9 @@ export const watch = (pattern: string, dargs: boolean, dbt: boolean, dret: boole
270272
jobs.add(job);
271273

272274
return new Promise((resolve, reject) => {
273-
javaEnumerate(pattern).then((matches: Java.EnumerateMethodsMatchGroup[]) => {
274-
matches.forEach((match: Java.EnumerateMethodsMatchGroup) => {
275-
match.classes.forEach((klass: Java.EnumerateMethodsMatchClass) => {
275+
javaEnumerate(pattern).then((matches: JavaTypes.EnumerateMethodsMatchGroup[]) => {
276+
matches.forEach((match: JavaTypes.EnumerateMethodsMatchGroup) => {
277+
match.classes.forEach((klass: JavaTypes.EnumerateMethodsMatchClass) => {
276278
klass.methods.forEach(method => {
277279
// Only watch matched methods
278280
watchMethod(`${klass.name}.${method}`, job, dargs, dbt, dret);

agent/src/android/intent.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { colors as c } from "../lib/color.js";
22
import {
33
getApplicationContext,
4-
wrapJavaPerform
4+
wrapJavaPerform,
5+
Java
56
} from "./lib/libjava.js";
67
import { Intent, FridaOverload } from "./lib/types.js";
78
import { analyseIntent } from "./lib/intentUtils.js";
89
import * as jobs from "../lib/jobs.js";
9-
10+
import type { default as JavaTypes } from "frida-java-bridge";
1011

1112
// https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK
1213
const FLAG_ACTIVITY_NEW_TASK = 0x10000000;
@@ -28,7 +29,7 @@ export const startActivity = (activityClass: string): Promise<void> => {
2829
const androidIntent: Intent = Java.use("android.content.Intent");
2930

3031
// Get the Activity class's .class
31-
const newActivity: Java.Wrapper = Java.use(activityClass).class;
32+
const newActivity: JavaTypes.Wrapper = Java.use(activityClass).class;
3233
send(`Starting activity ${c.green(activityClass)}...`);
3334

3435
// Init and launch the intent

agent/src/android/keystore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import {
33
IKeyStoreDetail,
44
IKeyStoreEntry
55
} from "./lib/interfaces.js";
6-
import { wrapJavaPerform } from "./lib/libjava.js";
6+
import {
7+
wrapJavaPerform,
8+
Java
9+
} from "./lib/libjava.js";
710
import {
811
KeyFactory,
912
KeyInfo,

agent/src/android/lib/intentUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { Java } from "./libjava.js";
12
import { colors as c } from "../../lib/color.js";
23

3-
export const analyseIntent = (methodName: string, intent: Java.Wrapper, backtrace: boolean = false): void => {
4+
export const analyseIntent = (methodName: string, intent: any, backtrace: boolean = false): void => {
45
try {
56
send(`\nAnalyzing Intent from: ${c.green(`${methodName}`)}`);
67

0 commit comments

Comments
 (0)