MCPcopy
hub / github.com/APKLab/APKLab / smaliTypeToJava

Function smaliTypeToJava

src/tools/frida.ts:26–55  ·  view source on GitHub ↗

* Parse smali type descriptor to Java/Frida type string. * e.g. "Ljava/lang/String;" -> "java.lang.String" * "I" -> "int" * "[B" -> "[B"

(smaliType: string)

Source from the content-addressed store, hash-verified

24 * "[B" -> "[B"
25 */
26function smaliTypeToJava(smaliType: string): string {
27 if (smaliType.startsWith("[")) {
28 return smaliType; // keep array notation for Frida overload
29 }
30 switch (smaliType) {
31 case "V":
32 return "void";
33 case "Z":
34 return "boolean";
35 case "B":
36 return "byte";
37 case "S":
38 return "short";
39 case "C":
40 return "char";
41 case "I":
42 return "int";
43 case "J":
44 return "long";
45 case "F":
46 return "float";
47 case "D":
48 return "double";
49 default:
50 if (smaliType.startsWith("L") && smaliType.endsWith(";")) {
51 return smaliType.slice(1, -1).replace(/\//g, ".");
52 }
53 return smaliType;
54 }
55}
56
57/**
58 * Parse smali method parameter list.

Callers 3

parseMethodFromLineFunction · 0.85
generateFridaHookFunction · 0.85
frida.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected