TCPDUMP as Application Framework
- An app with UI get packets form binder service by JNI invoking of servicemanager
- A native service using binder and get packets by libpcap api
- Download AOSP and put
tcpdumpclient
tcpdumpservice
toexternal
folder of AOSP. - Build and run your AOSP
- Download AOSP and put
tcpdumpclient
tcpdumpservice
toexternal
folder of AOSP. - Use the script in the folders to build only the app or native app
- Push native app to /data/local/tmp and run it
- Make a project in eclipse ADT and copy app code to ADT
- Make a
lib
folder in eclipse ADT project and copylibtcpdumpclient.so
to it
Wrap up TCPDUMP program to provide necessary APIs
`Bool getDataPacketFromIP (char *ip, char *packet)`
`Bool getDataPacketToIP (char *ip, char *packet)`
`Bool getDataPacketFromIPAndPort (char *ip, char *port, char *packet)`
`Bool getDataPacketFromPort (char *port, char *packet)`
`Bool getDataPacketToPort (char *port, char *packet)`
`Bool getDataPacketFromIPToIP (char *srcip, char *dstip char *packet)`
`Bool getDataPacketFromMac (char* mac, char* packet)`
`Bool getDataPacketToMac (char* mac, char* packet)`
`Bool getDataPacketFromMacToMac (char *srcmac, char *desmac, char *packet)`
`Bool getDataPacketWithProtocol (protocolType type, char* packet)`
- Open
/system/core/rootdir/init.rc
- Add this
service tcpdumpservice /system/bin/tcpdumpservice
class main
user root
group root