• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java program help : netcat and dd utility + socket programming

 
indeewari akarawita
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my java program I am trying to collect some raw data from Android device connected to PC. In a terminal I do following:

Session0:
adb forward tcp:31337 tcp:31337

Session 1: In a adb shell,
dd if=/dev/block/mtd27 bs=4096 | nc -l -p 31337

Session0:
nc 127.0.0.1 31337 > dd of=data.dd bs=4096

Please help and guide me to accomplish this using java.

Thanks a lot in advance

Edit: As this is using netcat it is required socket programming to accomplish this. I am totally lost here, please help
 
indeewari akarawita
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No one have an ides ,

This is mostly about socket programming
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to do this in Java? It seems that a shell script that automates the steps you now execute manually would be better suited. And you can execute the script from within Java via the ProcessBuilder class.
 
indeewari akarawita
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I could not get it work. .dd file is not created. Could you please help with this?

Many thanks

Problem is with:
runnning "dd if=/dev/block/mtd27 bs=4096 | nc -l -p 31337" command is adb shell.
How can I do it.

in Mannully I do as below.
Phone is connected to Ubuntu VM.
in a terminal I type adb shell and hit enter.

It takes me to the adb shell. Then I type there dd if=/dev/block/mtd27 bs=4096 | nc -l -p 31337

How to do this in as you suggested.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!