Copy app binary file using adb shell

Copy app binary file using adb shell

Sometimes it is very useful to copy binary file from Android back to host OS. For example you can copy application database.

I used the following method to copy binary file out of Android in one line shell command.

This method requires app to be compiled in debug mode. You will also need to enable debug access for your mobile device.

adb -d shell 'run-as com.appname od -An -vtx1 /data/user/0/com.appname/files/file.bin' | xxd -r -p > file.bin

The above command translate files to hex stream of bytes, pipes it to shell and then turns back hex text stream back to binary.

About the author

Yuli Stremovsky
Yuli StremovskyParanoid Security Guy
For the past 15 years I’ve been leading the evolution of startups and enterprises to achieve the highest level of security and compliance. Throughout my career I’ve been a Cyber Security expert and advanced solutions architect with many years of hands on experience both on offensive and defensive side. Knowledgeable at the highest level in application development, networking, data and databases, web applications, large scale Software as a Service solutions, cloud security and blockchain technologies.

I’ve been working with CISO’s of international enterprises, helping them set Information Security strategy, and overseeing the implementation of these recommendations. As part of these projects, I’ve been assisting companies to achieve compliance in GDPR, PCI, HIPAA and SOX.

Among my credits, I was a founder of a database security company GreenSQL/Hexatier which was acquired by Huawei and I’ve co-founded Kesem.io, Secure multi-signature Crypto wallet.

Specialties: Software and cloud architecture, Compliance (GDPR, HIPAA, PCI, SOX), blockchain technologies, software development, secure architectures, project management and low level research.