Skip to content

Instantly share code, notes, and snippets.

@CaiJingLong
Created July 4, 2024 03:55
Show Gist options
  • Save CaiJingLong/a439bc217f4275285253053796f8a42e to your computer and use it in GitHub Desktop.
Save CaiJingLong/a439bc217f4275285253053796f8a42e to your computer and use it in GitHub Desktop.
Show the package for libapp.so
import 'dart:io';
void main(List<String> args) {
final file = File('/Users/cai/Downloads/base.apk/lib/arm64-v8a/libapp.so');
final content = file.readAsBytesSync();
// convert to ascii
final text = content.map((e) => String.fromCharCode(e)).join();
// find by regex
final pattern = RegExp(r'package:([a-zA-Z0-9_]+)/');
final allMatches = pattern.allMatches(text);
final allPkg = allMatches.map((e) => e.group(1)).toSet();
final pkgList = allPkg.toList()..sort();
for (final pkg in pkgList) {
print(pkg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment