This article references: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jdb.html
Jdb in the source code can be implemented to debug the remote machine Java program, but in reverse the source is difficult to analyze, but still can debug to get a part of the information
This article mainly obtains two information
1. Dynamically call the methods in the obfuscation class, because it is difficult for us to manually complete the relevant code during the practice
2. Print the Call stack
The following example takes the debug Zkm.jar as an example
JDB Passive Code Debug Call method
Start Xdebug Debugging
Java-xdebug-xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000-jar ZKM.jar
JDB Passive Code Connection (if it is the same computer, a new cmd is required)
Jdb-connect com.sun.jdi.socketattach:hostname=localhost,port=8000
Set breakpoints in the A method of the Com.zelix.lh class
Stop in COM.ZELIX.LH.A
Run command, and running to a breakpoint will stop
Run
Enter next step execution
Next
Use the clear command to clear the breakpoint just now
Clear COM.ZELIX.LH.A
To invoke the A method using the Print command
Print com.zelix.lh.a ("Bzlj70ifahjaw", 1881109385)
The above demonstrates the invocation of a static class method, and a dynamic class can also
Print new java.lang.String ("Hello"). Length ()
Print the call stack where (Wherei can also, multi-print PC register value)
Quit debugging using quit
Quit
Note When calling a method, the related class must already be loaded, and the breakpoint hit in the method must be cleared, or an exception will be thrown.
Confusing code generally removes debug information locals view local variables, stop at line breakpoints These are basically unable to output valid information
JDB dynamic debugging of Java Reverse Foundation