Objective
Very early to know that with NetBeans can be single-step debugging Smali, has been dragged until now the real self-realization of the ~ below is the detailed steps!
0x1
Environment and tools
a.apktool_2.0.0b9:http://connortumbleson.com/2014/02/apktool-2-0-0-beta-9-released/
B.netbeans 6.8 Version: Http://dlc.sun.com.edgesuite.net/netbeans/6.8/beta/bundles/netbeans-6.8beta-ml-windows.exe
C. A simulator
0x2
Detailed steps: (Take test.apk as an example)
Part I: Generating an apk for debugging
A. Add-d parameter to decompile
1 |
Java -jar apktool_2. 0.0b9.jar D -d test. APK -o out |
B. Get the entry activity by looking at Androidmanifest.xml and then find the OnCreate () function. In
1 |
invoke-super {p0 p1}, landroid/app /activity; ->oncreate (landroid /os/Bundle v |
After adding:
1 |
Invoke-static {}, landroid/os/Debug; -Waitfordebugger()V |
C. Re-packaging
1 |
Java -jar apktool_2. 0.0b9.jar b -D out -o debug. APK |
D. Sign, then install debug.apk
Successfully generated an APK file that supports debugging
Part II: NetBeans settings
A. Delete the build folder under the Out directory
B. Open NetBeans and choose File-New project-Java project based on existing source code
C. Select the Out directory at "project folder"
D. In the "Source Package folder" Out Select the Smali folder under the Out directory
E. Click Finish, Project creation complete
Part III: Start debugging
A. Run the debug.apk you just installed in the emulator and the program is in a pending state.
B. Find the OnCreate function of the ingress activity in NetBeans, just invoke-static {}, Landroid/os/debug;->waitfordebugger () V
Next line down Breakpoint
C. In NetBeans, choose Debug-Connect Debugger
D. Set up in turn:
Debugger: JPDA
Connector: Socketattach
Transmission: Dt_socket
Host: 127.0.0.1
Port: 8700 (port number can be seen through DDMS)
Timeout: [optional]
E. OK, that is, to complete the connection debugging, you can find that the IP stopped in the place just below the breakpoint.
F. You can see that the Apktool2.0+netbeans 6.8 supports displaying the value of the register.
To view the port number:
Debug Successful:
0x3
Single-step Debugging an instance
A good breakpoint in a line in the Challenge1verifier.java file
F5 let the program run, select Level 1 in the simulator, random input:
Click on the button, the program will be broken in just a good breakpoint, you can see the program has obtained the user name and registration code
One step can clearly see the process of the program, here is not the specific writing process. To the last comparison place:
It is clear to see that the value calculated by the user name ' 38808 ' and the registration code for comparison!
Correct group:
Abcd
38808
Written in the last
Dynamic debugging Smali Online data A lot, if you like to play algorithm, dynamic tracking Smali is a very good choice ~
Related articles:
Debug Smali with Netbean and Apktool
Apktool 2.0+netbeans 7.3 Debug APK
Smali Commissioning
Debugging Smali code with Apk-tool and NetBeans works!
This article is from 0n1y3nd's Blog, please indicate the source and the corresponding link when reproduced.
Permanent link to this article: http://0nly3nd.sinaapp.com/?p=576
Netbeans 6.8 + apktool_2.0.0b9 dynamic Debug Smali file