-
Notifications
You must be signed in to change notification settings - Fork 3
/
cli
executable file
·33 lines (30 loc) · 968 Bytes
/
cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/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');
}