Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to run executable file from adb shell

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.

like image 521
Harshal Kshatriya Avatar asked Oct 04 '12 07:10

Harshal Kshatriya


People also ask

Why adb shell not working?

Make sure USB debugging is enabled and USB is physically plugged in. Make sure everything is ok with the ADB drivers, double-check the device manager. Check if the device appears in "adb devices", make sure its authorized on the device. Try actual adb shell and other relevant adb stuff.

How do I access adb shell on Android?

To use ADB with your Android device, you must enable a feature called “USB Debugging.” Open your phone's app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.


1 Answers

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.

like image 193
Alex Cohn Avatar answered Sep 20 '22 19:09

Alex Cohn