Not able to run executable file from adb shell

Harshal Kshatriya picture Harshal Kshatriya · Oct 4, 2012 · Viewed 31.2k times · Source

I've added tcpdump binary file to my android device using this command

./adb push ~/tcpdump-4.2.1/tcpdump /data/local

The binary is added to the android device successfully. But, when I try to execute the tcpdump file from the adb shell, using following commands

./adb shell
cd data/local
./tcpdump

It gives me this error

/system/bin/sh: ./tcpdump: not executable: magic 7F45

I've also tried changing permissions using chmod 777 tcpdump but in vain. How do I overcome this issue? Thanks.

Answer

Alex Cohn picture Alex Cohn · Oct 4, 2012

You can find an Android version of tcpdump here. This build is somewhat outdated, and only relevant for ARM devices. You should follow these instructions to build the binary from official source.

There are detailed instructions re how to run tcpdump on Android. Note that you need a rooted device to begin with.