Skip to content

Commit 9d195cb

Browse files
committed
1.9.1版本源码
0 parents  commit 9d195cb

File tree

269 files changed

+33208
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+33208
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/libraries
5+
/.idea/modules.xml
6+
/.idea/workspace.xml
7+
.DS_Store
8+
/build
9+
/captures
10+
.externalNativeBuild
11+
/app/.idea

README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# ReflectMaster2
2+
Xposed模块 反射大师
3+
4+
5+
1.9_2019-1-27
6+
7+
8+
1.更换格格脚本为FakeScript
9+
2.替换五角星为六芒星
10+
3.显示系统应用
11+
4.新增若干未知bug
12+
13+
14+
### 一.脚本编写
15+
16+
1.hook脚本
17+
18+
在定义hook里添加要hook的函数,编写代码
19+
可以使用!开头直接指定路径 或者 写下面的:
20+
func hook(obj)
21+
22+
end
23+
24+
obj为MethodHookParam param,通过obj获取hook的函数的参数
25+
var para = fld(obj,"args [Ljava.lang.Object;")
26+
io.xplog(para)
27+
28+
函数说明,io类下的
29+
xplog(Object obj)使用XposedBridge.log打印日志到logcat
30+
readbytes(String path)读取文件内容,返回byte数组
31+
readstring(String path)读取文件内容,返回string
32+
exists(Object path)判断文件存在,返回1存在
33+
writefile(String path,Object obj) 写入文件,任意类型,第一个参数为路径
34+
sleep(millis)休眠毫秒,1秒=1000毫秒,在反射大师的设置里开启在新线程执行后使用
35+
36+
rf类下(在脚本里执行,hook里用不了)
37+
public static Object getThis()获取当前对象
38+
public static Context getAct()获取当前context
39+
public static void copy(Object string) 复制到剪切板
40+
public static void print(Object obj) 输出到脚本执行的结果
41+
public static Object getTempVar(int position)获取临时保存的变量,position保存在列表的哪里的
42+
43+
44+
2.测试脚本
45+
46+
同上,入口函数为main,无参数
47+
func main()
48+
rf.print("123456")
49+
end
50+
51+
52+
3.内置函数
53+
54+
setarray设置数组的值 setarray(obj,1,value)
55+
56+
clsname(obj) 获取对象类名
57+
58+
sfld(obj,name) 获取静态变量,name由 name+" "+type组成
59+
60+
fld(obj,name) 获取普通变量
61+
con(string or obj, 参数...)通过类名调用构造函数
62+
63+
new(类名) new 一个对象
64+
65+
imp(类名)导入类的所有方法,要通过对象:方法 调用方法,必须先导入
66+
setfld(obj,"名字 类型)
67+
setfld(cls or obj, '名字 类型')
68+
69+
### 二.脚本来自项目
70+
https://github.com/esrrhs/fakescript-java/
71+

ScriptParser/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

ScriptParser/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
**旧版使用的脚本引擎,已丢弃**
2+
3+
2018-5-30
4+
5+
1.修复对比null时的对比错误的bug,对比不了
6+
7+
FScriptParser
8+
9+
10+
11+
简单脚本解析执行
12+
13+
14+
15+
一、介绍
16+
17+
一个简单的脚本解析,采用正则表达式解析代码,逐行分解,遇到函数时再交由内置的函数监听和用户自定义的函数监听执行,支持if,for赋值,函数定义,总体来说比较鸡肋
18+
19+
二、代码结构
20+
21+
![img](README/clip_image002.gif)
22+
23+
FParser类为解析的主类
24+
25+
26+
27+
```
28+
FParser parser = new FParser();
29+
```
30+
31+
直接构造,,不写了,直接看Test.java那个测试类
32+
33+
三、语法
34+
35+
四、函数监听扩展

ScriptParser/README/clip_image002.gif

42.6 KB
Loading

ScriptParser/build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apply plugin: 'java-library'
2+
3+
dependencies {
4+
implementation fileTree(dir: 'libs', include: ['*.jar'])
5+
compile 'junit:junit:4.12'
6+
}
7+
8+
sourceCompatibility = "1.7"
9+
targetCompatibility = "1.7"

ScriptParser/doc.docx

97.9 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package plugin.kpa.scriptparser;
2+
3+
import java.io.File;
4+
import java.lang.reflect.Constructor;
5+
import java.lang.reflect.Field;
6+
import java.lang.reflect.Method;
7+
import java.util.regex.Matcher;
8+
import java.util.regex.Pattern;
9+
10+
import plugin.kpa.scriptparser.Script.Dog;
11+
import plugin.kpa.scriptparser.Script.FParser;
12+
13+
public class Main {
14+
15+
public static void main(String[] args)
16+
{
17+
18+
//
19+
20+
for(Method m:Dog.class.getMethods())
21+
System.out.println(m.toGenericString());
22+
for(Field m:Dog.class.getDeclaredFields())
23+
System.out.println("ddd:"+m.toGenericString());
24+
25+
26+
Pattern pattern = Pattern.compile("a([+|\\-|*|/|>|<])(.*)");
27+
Matcher test = pattern.matcher("a*_b");
28+
if(test.find()) {
29+
System.out.println(test.group());
30+
// return;
31+
}else
32+
{
33+
34+
}
35+
36+
FParser parser = new FParser();
37+
parser.addScriptListener(new TestScript());
38+
39+
40+
41+
try {
42+
parser.parse(" a=1+3");
43+
parser.parse("b=4*99");
44+
parser.parse("if _a==4 :print('test')");
45+
parser.parse("if _a==4 :print('nice');print('jjj')");
46+
parser.parse("getPath=getMethod('java.io.File','public java.lang.String java.io.File.getPath()')");
47+
parser.parse("construct=getConstruct('java.io.File','public java.io.File(java.lang.String)')");
48+
parser.parse("file=constructObject(_construct,'\\/sdcard\\/file')");
49+
// //函数二级嵌套失败..
50+
// parser.parse("result=invokeMethod(_getPath,_file)");
51+
// parser.parse("print(_result)");
52+
53+
parser.parse("method mymethod(str,yyy):print('test'+_str);print(33+_yyy)end");
54+
parser.parse("mymethod('ddd',44)");
55+
// parser.parse("b=1");
56+
// parser.parse("_b=_b+1");
57+
// parser.parse("print(_b)");
58+
// parser.parse("for(a=0;_a<5;_a=_a+1):print('heooe');print('dd'+_a)");
59+
60+
Dog dog = new Dog("formatfa",20);
61+
dog.setName("lf");
62+
dog.setAge(10);
63+
//set field test
64+
//private java.lang.String plugin.kpa.scriptparser.Script.Dog.name
65+
parser.getVm().setValue("dog",dog);
66+
System.out.println(dog.toString());
67+
parser.parse("setField('plugin.kpa.scriptparser.Script.Dog','private java.lang.String plugin.kpa.scriptparser.Script.Dog.name',_dog,'dragon')");
68+
parser.parse("print(_dog)");
69+
System.out.println(dog.toString());
70+
71+
// parser.parse("stop");
72+
73+
parser.parse("test=getField('plugin.kpa.scriptparser.Script.Dog','private java.lang.String plugin.kpa.scriptparser.Script.Dog.name',_dog)");
74+
75+
parser.parse("print('dd'+_test)");
76+
77+
78+
79+
parser.parse("kk=10");
80+
parser.parse("print('ttt'+_kk)");
81+
82+
83+
parser.parse("method add(a,b):print(_a+_b)end");
84+
85+
parser.parse("add(2,8)");
86+
// parser.parse("print('第一个参数的值是:'+_arg0)");
87+
} catch (Exception e) {
88+
System.out.println(e.toString());
89+
e.printStackTrace();
90+
}
91+
92+
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package plugin.kpa.scriptparser.Script;
2+
3+
/**
4+
* Created by formatfa on 18-5-1.
5+
*/
6+
7+
public class BooleanVar extends FVar {
8+
public BooleanVar(int type, Object object) {
9+
super(type, object);
10+
}
11+
12+
public static FVar parseBoolean(String code)
13+
{
14+
if("true".equals(code))
15+
{
16+
return new BooleanVar(FVar.TYPE_BOOLEAN,true);
17+
}
18+
else
19+
{
20+
return new BooleanVar(FVar.TYPE_BOOLEAN,false);
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package plugin.kpa.scriptparser.Script;
2+
3+
4+
5+
/**
6+
* Created by formatfa on 18-4-22.
7+
*/
8+
9+
public abstract class CodeItem {
10+
public abstract CodeItem parse(String code);
11+
12+
public CodeItem(String pattern)
13+
{
14+
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package plugin.kpa.scriptparser.Script;
2+
3+
/**
4+
* Created by formatfa on 18-4-29.
5+
*/
6+
7+
public class Dog {
8+
9+
private String name;
10+
private int age;
11+
12+
@Override
13+
public String toString() {
14+
return "Dog{" +
15+
"name='" + name + '\'' +
16+
", age=" + age +
17+
'}';
18+
}
19+
20+
public String getName() {
21+
return name;
22+
}
23+
24+
public void setName(String name) {
25+
this.name = name;
26+
}
27+
28+
public int getAge() {
29+
return age;
30+
}
31+
32+
public void setAge(int age) {
33+
this.age = age;
34+
}
35+
36+
public Dog(String name, int age) {
37+
this.name = name;
38+
this.age = age;
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package plugin.kpa.scriptparser.Script;
2+
3+
import java.util.regex.Matcher;
4+
import java.util.regex.Pattern;
5+
6+
/**
7+
* Created by formatfa on 18-4-22.
8+
*/
9+
10+
public class FInvokeMethod {
11+
12+
private String name;
13+
private String params;
14+
15+
public String getName() {
16+
return name;
17+
}
18+
19+
public void setName(String name) {
20+
this.name = name;
21+
}
22+
23+
public String getParams() {
24+
return params;
25+
}
26+
27+
public void setParams(String params) {
28+
this.params = params;
29+
}
30+
31+
String[] getParamsArray()
32+
{
33+
return params!=null?params.split(","):null;
34+
}
35+
public static FInvokeMethod parseMethod(String code) {
36+
FInvokeMethod method = new FInvokeMethod();
37+
Pattern pattern = Pattern.compile(FParser.methodPattern);
38+
Matcher matcher = pattern.matcher(code);
39+
if (matcher.find()) {
40+
method.setName(matcher.group(1));
41+
method.setParams(matcher.group(2));
42+
43+
}
44+
System.out.println("parseMethod Result:" + method.toString());
45+
return method;
46+
}
47+
48+
@Override
49+
public String toString() {
50+
return "FInvokeMethod{" +
51+
"name='" + name + '\'' +
52+
", params='" + params + '\'' +
53+
'}';
54+
}
55+
}

0 commit comments

Comments
 (0)