Using Netcat for Im...
 
Notifications
Clear all

Using Netcat for Imaging Android phone to PC

7 Posts
3 Users
0 Likes
1,868 Views
 Aiza
(@aiza)
Posts: 35
Eminent Member
Topic starter
 

Netcat is used to write on Examiner's PC directly. It's working fine in Ubuntu Environment, but I am not able to figure out its use in Windows 7. When I try to give path it says

" /system/bin/sh c\Users not found "

I don't know where I am wrong in this. Google provides solution and guide but for Mac and Linux. I need to do this in Windows.

Phone is rooted, ADB shell and nc installed properly on Windows. Interrum Debugging is also on.

 
Posted : 19/08/2016 10:51 am
jaclaz
(@jaclaz)
Posts: 5133
Illustrious Member
 

What is the reference you are using as a guide?

Which specific (exact) version of netcat for Windows are you using?
(many Linux ports to Windows do not accept "standard" Windows paths)

What is the EXACT command line you are issuing?

jaclaz

 
Posted : 19/08/2016 12:49 pm
 Aiza
(@aiza)
Posts: 35
Eminent Member
Topic starter
 

What is the reference you are using as a guide?

Which specific (exact) version of netcat for Windows are you using?
(many Linux ports to Windows do not accept "standard" Windows paths)

What is the EXACT command line you are issuing?

jaclaz

Reference I am Using -> http//forum.xda-developers.com/showthread.php?t=1818321

I don't know about exact version, I have .exe file kn sdk/platform-tools directory.
I am issuing following commands
Terminal 1
adb forward tcp5555 tcp5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

Terminal 2
adb forward tcp5555 tcp5555

cd PATH/

nc 127.0.0.1 5555 > mmcblk0

But, right before I issue the commands in Terminal 2, Terminal 1 displays following message.
dd writing 'standard output' connection reset by peer
**** copied .. etc.

 
Posted : 19/08/2016 5:00 pm
jaclaz
(@jaclaz)
Posts: 5133
Illustrious Member
 

Your command

nc 127.0.0.1 5555 > mmcblk0

Command in the reference

nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

WHY did you change it?

Mind you possibly bypassing pv is OK, i.e. it is not the cause of an issue (though it is possible that it is actually NEEDED), anyway if you use a tutorial/reference you should follow it EXACTLY, to the letter, without changing even the slightest, little, minor thing.

But, right before I issue the commands in Terminal 2, Terminal 1 displays following message.
dd writing 'standard output' connection reset by peer
**** copied .. etc.

This seems to me like a different error from what you stated before, the former was path related, this latter seems like a connection issue.

In theory the connection made from dd should wait until the connection/pipe is established on the other side, but it seemingly does not (maybe it is a timing/timeout issue).

The busybox nc/netcat (evidently) must have a -e option and allow -l together with -p, like this
http//man.cx/netcat

And not like the "old" nc
http//linux.die.net/man/1/nc

Maybe the netcat version you are using has not the -l option working (I know, it's a mess) see
http//stackoverflow.com/questions/9702447/using-busybox-version-of-netcat-for-listening-tcp-port

Once you have run

/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

You should see (as described in the reference)

You will see the cursor blinking at the left. Now the phone is waiting to send the block over the network.

the cursor should blink and the nc wait "forever", i.e. until a connection is established, is this what happens (even if you don't open the second terminal/command window at all)?

There could be *anything else* (a background service, a firewall, an antivirus, etc.) that may be accessing the port 5555?

On the "other side", the reference talks specifically of the Cygwin port, and of three specific "packages" (netcat, pv and util-linux) how come you don't know the version of nc/netcat you are using?

jaclaz

 
Posted : 19/08/2016 6:00 pm
 Aiza
(@aiza)
Posts: 35
Eminent Member
Topic starter
 

I've reinstalled DD and then ir worked! But, after some bytes written on file, it gave error of

dd writing 'standard oputput' Broken Pipe

 
Posted : 20/08/2016 1:16 pm
 Aiza
(@aiza)
Posts: 35
Eminent Member
Topic starter
 

I also changed the port to 9999

 
Posted : 20/08/2016 1:20 pm
(@gorvq7222)
Posts: 229
Reputable Member
 

Hi Aiza,

I'm not sure what's wrong with your phone and workstation. My suggestion is to review your environment and make sure the reliability first.

You could take a look at my article as below link to see the command I use. Don't worry about those Chinese characters, all you need to do is to look at the command in the screenshots.

http//www.netadmin.com.tw/article_content.aspx?sn=1608050006

 
Posted : 21/08/2016 6:34 am
Share: