Nmap Development mailing list archives
Re: netcat missing example (is this even possible?)
From: David Burrows <snadge () gmail com>
Date: Wed, 2 Jun 2010 03:42:53 +1000
Hello again! Sorry to reply to my own post so soon, but it appears that I have found a solution that could save someone the trouble of what I just went though. (on server) socat /dev/urandom TCP4-LISTEN:9999 (on client - substitute localhost for the servers ip if not localhost) socat TCP4:localhost:9999 PTY,link=/dev/newrandom,raw,echo=0 The server socat command can be substituted with: ncat -l -k 9999 -c 'cat /dev/urandom' I'm not sure if there would be a netcat equivalent of the client connection. Now you can "dd bs=nnn count=1 /dev/newrandom of=/dev/null" and cat, etc all works as expected with the newly cloned device. I'm assuming raw is needed to not process the EOF characters, and echo=0 stops the client from constantly reading from the socket. This can be useful for boxes in a data centre, or on a network that do not have a good source of random entropy, to collect that data from a box that has a proper RNG or a better entropy source. Regards, David. On Tue, Jun 1, 2010 at 11:33 PM, David Burrows <snadge () gmail com> wrote:
Hi all, I wish to use netcat to connect /dev/random to a tcp socket, and then connect the other end of that socket to a pty device, such that reads from the pty device, are tunneled through the tcp socket. Eg. Host A -> /dev/random -> tcp socket -> ... Host B -> tcp socket -> /dev/newrandom. For testing purposes, it is easiest to use /dev/urandom and localhost. At first it would appear you could use netcat or socat to do this, but if baffles me as to how. I have tried the following with socat, somewhat unsuccesfully: socat /dev/urandom TCP4-LISTEN:12345 (in another terminal) socat TCP4:localhost:12345 PTY,link=/dev/newrandom,wait-slave This sort of works, in the sense that I can open /dev/newrandom, and get data from it, but the reads return short and the first socat starts continuously flooding the tcp socket as long as there is data in /dev/urandom (which is always true). I'm likely going about this entirely the wrong way, which is why I am appealing for someone more knowledgeable to point out a better way to achieve this? Curiously, David.
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- netcat missing example (is this even possible?) David Burrows (Jun 01)
- Re: netcat missing example (is this even possible?) David Burrows (Jun 01)
- Re: netcat missing example (is this even possible?) David Fifield (Jun 01)
- Re: netcat missing example (is this even possible?) David Burrows (Jun 01)
- Re: netcat missing example (is this even possible?) David Fifield (Jun 02)
- Re: netcat missing example (is this even possible?) David Burrows (Jun 03)
- Re: netcat missing example (is this even possible?) David Fifield (Jun 01)
- Re: netcat missing example (is this even possible?) David Burrows (Jun 01)