-
Notifications
You must be signed in to change notification settings - Fork 6
/
cli
executable file
·47 lines (44 loc) · 1.33 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
/*
ti_recover CLI
Appcelerator Titanium APK source code recovery tool
Usage:
node ti_recover apkfile.apk outputdirectory
*/
var recover = require('./ti_recover'), //
args = process.argv.slice(2),
fs = require('fs'),
path = require('path'),
cur_dir = process.cwd(),
colors = require('colors');
var _apk, _dir;
// intro
console.log('Appcelerator Titanium'.yellow+' - '+'APK Source Code Recovery Tool'.underline.green);
//
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.
}
recover.init({ apk:_apk, out_dir:_dir }, function() {
recover.test(function(err, isit) {
if (isit==true) {
recover.extract(function(err,info) {
if (err) {
console.log('an error ocurred extracting!');
} else {
recover.writeToDisk();
recover.copyAssets();
console.log(colors.green('resources copied!'));
recover.clean();
console.log(colors.green('source code recovered!'));
}
});
} else {
console.log('The given APK was not created using Appcelerator Titanium.');
}
});
});
} else {
console.log(colors.red('Usage: ti_recover apkfile.apk outputdirectory'));
}