32 lines
995 B
JavaScript
Executable file
32 lines
995 B
JavaScript
Executable file
#!/usr/bin/env node
|
|
/*
|
|
apk_unpack CLI
|
|
Commandline utility to unpack an APK file resources
|
|
Usage:
|
|
node cli.js apkfile.apk outputdirectory
|
|
*/
|
|
var apk = require("./apk_unpack"), // extract(apkfile, outputdir, onReadyCB)
|
|
args = process.argv.slice(2),
|
|
fs = require("fs"),
|
|
path = require("path"),
|
|
cur_dir = process.cwd();
|
|
var _apk, _dir;
|
|
|
|
console.log("APK unpacker");
|
|
|
|
if (args.length == 2) {
|
|
((_apk = args[0]), (_dir = path.join(cur_dir, args[1]))); // assume output dir is subdir of current one.
|
|
if (args[1].charAt(0) == path.sep) {
|
|
_dir = args[1]; // if directory starts with a path separator, then we assume its an absolute directory.
|
|
}
|
|
apk.init({ apk: _apk, dir: _dir, java: true });
|
|
apk.extract(function (err) {
|
|
//if (!err) console.log('ready!');
|
|
console.log("apk_unpack -> decompiling classes.dex");
|
|
apk.decompile(function () {
|
|
console.log("apk_unpack -> ready");
|
|
});
|
|
});
|
|
} else {
|
|
console.log("Usage: apk_unpack apkfile.apk outputdirectory");
|
|
}
|