frida-packing-detector 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,28 @@
1
- export declare namespace FridaPackingDetector {
2
- /**
3
- * 壳检测回调接口
4
- */
5
- interface DetectCallback {
6
- /**
7
- * 检测到加固状态时触发
8
- * @param isProtected - true 表示已加固,false 表示未加固
9
- */
10
- onDetected?: (isProtected: boolean) => void;
11
- /**
12
- * 壳解包完成、原始应用加载完成时触发
13
- */
14
- onUnpacked?: () => void;
15
- /**
16
- * 发生错误时触发
17
- * @param message - 错误信息
18
- */
19
- onError?: (message: string) => void;
20
- }
21
-
22
- /**
23
- * 注册加固检测
24
- *
25
- * @param callback 回调
26
- * @param isLogging 是否开启日志
27
- */
28
- function register(callback: DetectCallback, isLogging?: boolean): void;
29
- }
1
+ export declare namespace FridaPackingDetector {
2
+ /**
3
+ * 壳检测回调接口
4
+ */
5
+ interface DetectCallback {
6
+ /**
7
+ * 检测到加固状态时触发
8
+ * @param isProtected - true 表示已加固,false 表示未加固
9
+ */
10
+ onDetected?: (isProtected: boolean) => void;
11
+ /**
12
+ * 壳解包完成、原始应用加载完成时触发
13
+ */
14
+ onUnpacked?: () => void;
15
+ /**
16
+ * 发生错误时触发
17
+ * @param message - 错误信息
18
+ */
19
+ onError?: (message: string) => void;
20
+ }
21
+ /**
22
+ * 注册加固检测
23
+ *
24
+ * @param callback 回调
25
+ * @param isLogging 是否开启日志
26
+ */
27
+ function register(callback: DetectCallback, isLogging?: boolean): void;
28
+ }
package/dist/index.js CHANGED
@@ -170,16 +170,16 @@ export var FridaPackingDetector;
170
170
  }
171
171
  // Call from ActivityThread.handleBindApplication
172
172
  let appInfo = this.getApplicationInfo();
173
- if (appInfo.className == null) {
173
+ if (!appInfo.className) {
174
+ callback?.onError?.("ApplicationInfo has not 'className' field");
175
+ return;
176
+ }
177
+ if (appInfo.className.value == null) {
174
178
  // 没有自定义 Application,判定未加固
175
179
  callback?.onDetected?.(false);
176
180
  }
177
181
  else {
178
182
  let appClassName = appInfo.className.value;
179
- if (!appClassName) {
180
- callback?.onError?.("Application class is null");
181
- return;
182
- }
183
183
  Logger.info("Application class name: " + appClassName);
184
184
  hookCustomApplication(appClassName, callback);
185
185
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "frida-packing-detector",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "A general method for detecting packed APKs at runtime",
6
- "main": "dist/index.js",
7
- "types": "index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "homepage": "https://github.com/poping520/frida-packing-detector",
9
9
  "scripts": {
10
- "build": "tsc -p ./tsconfig.json",
10
+ "build": "tsc",
11
+ "watch": "tsc -w",
11
12
  "test": "frida-compile -w -c -o ./dist/test_agent.js ./src/test.ts"
12
13
  },
13
14
  "keywords": [
package/src/index.ts CHANGED
@@ -226,17 +226,16 @@ export namespace FridaPackingDetector {
226
226
 
227
227
  // Call from ActivityThread.handleBindApplication
228
228
  let appInfo = this.getApplicationInfo()
229
- if (appInfo.className == null) {
229
+ if (!appInfo.className) {
230
+ callback?.onError?.("ApplicationInfo has not 'className' field");
231
+ return;
232
+ }
233
+
234
+ if (appInfo.className.value == null) {
230
235
  // 没有自定义 Application,判定未加固
231
236
  callback?.onDetected?.(false);
232
-
233
237
  } else {
234
238
  let appClassName = appInfo.className.value;
235
- if (!appClassName) {
236
- callback?.onError?.("Application class is null");
237
- return;
238
- }
239
-
240
239
  Logger.info("Application class name: " + appClassName);
241
240
  hookCustomApplication(appClassName, callback);
242
241
  }
package/src/test.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {FridaPackingDetector} from "./index";
1
+ import {FridaPackingDetector} from "./index.js";
2
2
 
3
3
 
4
4
  function main() {
package/tsconfig.json CHANGED
@@ -4,9 +4,11 @@
4
4
  ],
5
5
  "compilerOptions": {
6
6
  "target": "ES2020",
7
- "module": "NodeNext",
8
- "moduleResolution": "NodeNext",
9
- "outDir": "dist",
7
+ "module": "Node16",
8
+ "moduleResolution": "Node16",
9
+ "strict": true,
10
+ "declaration": true,
11
+ "outDir": "./dist",
10
12
  "skipLibCheck": true
11
13
  }
12
14
  }