JDB dynamic debugging of Java Reverse Foundation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.