MCPcopy Index your code
hub / github.com/APKLab/APKLab / findSmaliFile

Function findSmaliFile

src/tools/frida.ts:454–468  ·  view source on GitHub ↗

* Find the smali file for a given class name. * Class name format: "com.example.MainActivity"

(projectDir: string, className: string)

Source from the content-addressed store, hash-verified

452 * Class name format: "com.example.MainActivity"
453 */
454function findSmaliFile(projectDir: string, className: string): string | null {
455 const relativePath = className.replace(/\./g, "/") + ".smali";
456
457 // Check smali, smali_classes2, smali_classes3, etc.
458 const entries = fs.readdirSync(projectDir);
459 const smaliDirs = entries.filter((e) => e.startsWith("smali")).sort();
460
461 for (const dir of smaliDirs) {
462 const candidate = path.join(projectDir, dir, relativePath);
463 if (fs.existsSync(candidate)) {
464 return candidate;
465 }
466 }
467 return null;
468}
469
470/**
471 * Generate a random plausible-looking Android library name.

Callers 2

injectGadgetFunction · 0.85
frida.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected