File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -227,24 +227,44 @@ void JNICALL JvmTIAgent::HandleClassFileLoadHook(
227
227
```
228
228
229
229
##JVM TI Example
230
- 代码 [ github] ( )
230
+ 代码 [ github] ( https://github.com/zhuquanbin/note/tree/master/java/jvmti )
231
231
232
232
__ 注意__ jvm-tool-cpp 目录下的 makefile 中 ** INCLUDE** 参数修改为本地的JDK头文件的所在的目录
233
233
234
234
> 编译
235
235
``` bash
236
236
cd jvmti && make
237
237
```
238
- [ ![ ] ( /image/build.png " 编译 ")] [ build ]
238
+ ![ 编译 ] ( . /image/build.png " 编译 ")
239
239
240
- > 对JAR进行反编译
241
- [ ![ ] ( /image/before-encrypt.png " JD-GUI 反编译效果 ")] [ before-encrypt ]
242
- [ ![ ] ( /image/before-encrypt-01.png " JD-GUI 反编译效果 ")] [ before-encrypt-01 ]
240
+ > 使用JD-GUI 对JAR进行反编译
243
241
242
+ ![ ] ( ./image/before-encrypt.png " JD-GUI 反编译效果 ")
243
+ ![ ] ( ./image/before-encrypt-01.png " JD-GUI 反编译效果 ")
244
+
245
+ > 运行JAR包
244
246
245
247
``` bash
246
248
java -Djava.library.path=./ -cp jvm-ti.jar com.borey.JvmTITest
249
+ ```
250
+ ![ ] ( ./image/s1.png " JD-GUI 反编译效果 ")
251
+
252
+ > 对JAR包进行加密
253
+ ``` bash
247
254
java -Djava.library.path=./ -cp jvm-ti.jar com.tool.Encrypt jvm-ti.jar
255
+ ```
256
+ ![ ] ( ./image/e1.png " 加密 ")
257
+ ![ ] ( ./image/encrypted-01.png " JD-GUI 反编译效果 ")
258
+ ![ ] ( ./image/encrypted-02.png " JD-GUI 反编译效果 ")
259
+
260
+ > 正常运行加密后的JAR包,ClassFormatError错误
261
+ ``` bash
248
262
java -Djava.library.path=./ -cp jvm-ti-encrypted.jar com.borey.JvmTITest
263
+ ```
264
+ ![ ] ( ./image/err.png " ClassFormatError错误 ")
265
+
266
+ > 运行带Agent加密后的JAR包
267
+ ``` bash
249
268
java -Djava.library.path=./ -agentpath:./libagent.so=show -cp jvm-ti-encrypted.jar com.borey.JvmTITest
250
269
```
270
+ ![ ] ( ./image/success.png " ")
You can’t perform that action at this time.
0 commit comments