问题
I want to create a module that capture packets ( like Shark for Root app in Android).
Can i use JPCAP library (Java)? Do i need to root my Android phone to capture packets?
回答1:
Can i use JPCAP library (Java)?
Not directly. It relies upon JNI, presumably for accessing libpcap
. You would need to modify the build process to use Android's NDK. It is conceivable that this would require no code changes, but that's far from certain.
Also, it is possible that the Java code for JPCAP requires classes that are not in Android.
Do i need to root my Android phone to capture packets?
Most likely. Everything else that uses libpcap
on Android (e.g., Shark for Root) needs it. Even desktop Linux kinda needs it.
来源:https://stackoverflow.com/questions/8260977/is-it-possible-to-use-jpcap-with-android