Skip to content

Commit

Permalink
fix bug and new features
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxhh committed May 19, 2019
1 parent c6efbda commit 4574a88
Show file tree
Hide file tree
Showing 20 changed files with 456 additions and 290 deletions.
13 changes: 7 additions & 6 deletions HTTPDecrypt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ def call():
if genv.script is None:
return "Export Script no load, please check."
# print(type(request.form.get('argsinfo')))

try:
jArgsInfo = json.loads(ArgsInfo, object_pairs_hook=OrderedDict)
argumentsinfo = jArgsInfo.values()
method_to_call = getattr(genv.script.exports, MethodTag)
# print("123")
# print(method_to_call(*argumentsinfo))
return method_to_call(*argumentsinfo)
# print(request.form)
method_to_call = getattr(genv.script.exports, MethodTag)(*argumentsinfo)
# print(method_to_call)
return method_to_call
except Exception as e:
return str(e)

Expand All @@ -53,9 +54,9 @@ def bcall():
jArgsInfo = json.loads(ArgsInfo, object_pairs_hook=OrderedDict)
argumentsinfo = [base64.b64decode(temp).decode('utf-8') for temp in jArgsInfo.values()]
# print(argumentsinfo)
method_to_call = getattr(genv.script.exports, MethodTag)
method_to_call = getattr(genv.script.exports, MethodTag)(*argumentsinfo)
# print(method_to_call(*argumentsinfo))
return method_to_call(*argumentsinfo)
return method_to_call
except Exception as e:
return str(e)

Expand Down
1 change: 0 additions & 1 deletion HTTPDecrypt/script/Export_Template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{ method_var }}: function({{ args }}){
Java.perform(function () {
// return method + arg;
try{
var {{ clazz_var }} = Java.use("{{clazz_name}}");
rpc_result = {{ clazz_var }}.{{ method_name }}({{ args }});
Expand Down
10 changes: 10 additions & 0 deletions HTTPDecrypt/script/Export_Template_Instance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ method_var }}: function({{ args }}){
Java.perform(function () {
try{
var {{ clazz_var }} = Java.use("{{clazz_name}}");
var temp{{ clazz_var }} = {{ clazz_var }}.$new();
rpc_result = temp{{ clazz_var }}.{{ method_name }}({{ args }});
}catch(e){console.log(e)}
});
return rpc_result;
},
4 changes: 2 additions & 2 deletions HTTPDecrypt/script/doburp.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function getDataType(data) {
}
}

setTimeout(function() {
setImmediate(function() {
Java.perform(function() {
console.log("In ..");
{{scripts}}
});
}, 0);
});


71 changes: 0 additions & 71 deletions HTTPDecrypt/script/find.js

This file was deleted.

6 changes: 3 additions & 3 deletions HTTPDecrypt/script/findhook.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var findhook_retval = null;
var findhook_sendback = {};
var findhook_returntype = null;


setTimeout(function() {
setImmediate(function() {
Java.perform(function() {
console.log("In ..");
{{scripts}}
});
}, 0);
});
6 changes: 3 additions & 3 deletions HTTPDecrypt/script/findhook_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var {{ index_var }} = {{ index }};
var {{ clazz_var }} = Java.use("{{ clazz_name }}");
var {{ clazz_var }}_{{ method_var }} = null;

var returntype = null;

{{ clazz_var }}_{{ method_var }} = eval('{{ clazz_var }}[{{ method_var }}].overloads[{{ index_var }}]');

{{ clazz_var }}_{{ method_var }}.implementation = function() {
Expand All @@ -19,9 +19,9 @@ var returntype = null;
findhook_arg_type += "," + String({{ clazz_var }}_{{ method_var }}.argumentTypes[index]["className"]);
}
}
returntype = String({{ clazz_var }}_{{ method_var }}.returnType['className']);
findhook_returntype = String({{ clazz_var }}_{{ method_var }}.returnType['className']);
findhook_retval = this[{{ method_var }}].apply(this, arguments);
findhook_sendback['Methodinfo'] = returntype + " {{ clazz_name }}.{{ method_name }}(" + findhook_arg_type + ")";
findhook_sendback['Methodinfo'] = findhook_returntype + " {{ clazz_name }}.{{ method_name }}(" + findhook_arg_type + ")";
findhook_sendback['Args'] = arguments;
findhook_sendback['Retval'] = findhook_retval;
findhook_sendback['methodtag'] = "{{ methodtag }}";
Expand Down
71 changes: 71 additions & 0 deletions HTTPDecrypt/script/finds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
var finds_index = null;
var finds_pkgname = null;
var finds_classname = null;
var finds_methodname = null;
var finds_hook = null;
var finds_methods = null;
var finds_Fields = null;
var finds_Modifier = null;
var finds_Accesspermissions = null;
var finds_cell = null;

function enumtrace(pattern){
// var className = null;
Java.enumerateLoadedClasses({
onMatch: function(aClass) {
if (aClass.match(pattern) {{ options }} ) {
console.log(aClass);
traceClass(aClass);
}
},
onComplete: function() {}
});
}

function traceClass(targetClass)
{

try {
finds_hook = Java.use(targetClass);
finds_methods = finds_hook.class.getDeclaredMethods();
finds_Fields = finds_hook.class.getDeclaredFields();
finds_Modifier = Java.use("java.lang.reflect.Modifier");
finds_Accesspermissions = finds_Modifier.toString(finds_hook.class.getModifiers());
// console.log(finds_Accesspermissions);
finds_hook.$dispose;
// var parsedMethods = [];
// finds_Fields.forEach(function(Field) {
// console.log(Field);
// });
finds_methods.forEach(function(method) {

finds_index = targetClass.lastIndexOf('.');
finds_pkgname = targetClass.substr(0,finds_index);
finds_classname = targetClass.substr(finds_index + 1);
finds_methodname = method.toString().replace(targetClass + ".", "TOKEN").match(/\sTOKEN(.*)/)[1];

finds_cell = { "pkgname": finds_pkgname, "fullclassname":targetClass, "classname": finds_classname, "methodname": finds_methodname, "methodinfo": method.toString(),"Accesspermissions":finds_Accesspermissions};
// sendback = JSON.stringify(finds_cell) + "-fO0ioon00ds-";
// console.log(sendback);
send(JSON.stringify(finds_cell) + "-fO0ioon00ds-");
});
}catch (err) {}
}

setImmediate(function() {
Java.perform(function() {
// enumerate all classes
console.log("In ..");

var x = {{ matchfindtext }};
var val = ""
for(var item = 0; item < x.length; item++){
val = x[item];
if (0 == item || "" != val ){
//除第一个为空外,其他为空不执行。
// console.log(item);
enumtrace(val);
}
}
});
});
Loading

0 comments on commit 4574a88

Please sign in to comment.