Tag Info

Hot answers tagged

17

Copying from source to target where target has sshd running: dd if=/dev/sda | gzip | ssh root@target 'gzip -d | dd of=/dev/sda' Copying from source to target via sshd_host when target is not running sshd. Target: nc -l -p 62222 | dd of=/dev/sda bs=$((16 * 1024 * 1024)) Source: ssh -L 62222:target:62222 sshd_host & Source: dd if=/dev/sda | nc ...


15

nc doesn't do https. openssl s_client is as close as you'll get. Do something like this: $ cat request.txt | openssl s_client -connect server:443


10

To quote the nc man page: -l Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host. It is an error to use this option in conjunction with the -p, -s, or -z options. Additionally, any timeouts specified with the -w option are ignored. The key here is that -p cannot be combined ...


9

My understanding is that a TCP socket consists of the IP+port number, so changing the IP breaks that connection. nc has no way of knowing the IP changed, so it continues sending data to the original IP until the session times out. See RFC 793 (Transmission Control Protocol), specifically section 2.7: 2.7. Connection Establishment and Clearing To identify ...


8

Ick. You're going to have to base64 encode the attachment and create the MIME headers. Rather than generating a new message "on the fly" each time, it would probably be easier just to email yourself a very short example message from a "real" email program (leveraging the work that the people who wrote it did to put the attachment into the proper encoding ...


8

Okay, so using everyone's comments as a starting point I came up with this silly mess :-) ... { sleep 5; echo 'ehlo'; sleep 3; echo 'MAIL FROM:<Test@test.com>'; sleep 3; echo 'RCPT TO: <kyle@test_dest.com>'; sleep 3; echo 'DATA'; sleep 3; echo -e 'To:kyle@testdest.com\nMIME-Version: 1.0 (mime-construct ...


8

Send the dd process a USR1 signal: $ dd if=/dev/urandom of=/dev/null & [1] 977 $ $ kill -USR1 977 274647+0 records in 274646+0 records out 140618752 bytes (141 MB) copied, 17.3286 s, 8.1 MB/s $


7

Don't bother with sniffing the network connection; as @voretaq7 explained, you can't. Instead, have postfix log the connection by adding the IP address of the remote SMTP server to debug_peer_list. And if that doesn't get you enough detail to understand what's going on, you can set smtp_tls_loglevel 4 to get a complete dump of everything that went over the ...


6

While hand testing SMTP servers by hand is possible and viable, using a tool designed for this will be much easier. This article explains SWAKS. swaks is designed for smtp server testing. Supports attachments, authentication and encryption!


6

Another netcat-like tool is the nmap version, ncat, that has lots of built in goodies to simplify things like this. This would work: ncat -e /bin/cat -k -u -l 1235 -e means it executes /bin/cat (to echo back what you type) -k means keep-alive, that it keeps listening after each connection -u means udp -l 1235 means that it listens on port 1235


6

The -k option should do the trick. From the manpage of nc(1): -k Forces nc to stay listening for another connection after its current connection is completed. It is an error to use this option without the -l option. Alternatively, use socat, which is more targeted to your usecase of a proxy server. A random TCP-forwarder example ...


6

You should use openssl s_client -connect server:port to debug applications over SSL connections.


6

For me this very simple solution works: nc -l 192.168.2.1 3000 And -p does not work with -l (according to my man page and testing).


6

This appears to be a bug in nc. The nc command uses the poll system call to wait until input is received from either stdin or the socket. When a UDP packet has been send to a closed UDP port on the receiving end, an error message is send back. The poll call will return this status to the nc command, but nc does not actually process the error. Instead nc ...


5

To open a port 12345 on your local machine that, when connected to, will connect to a port 54321 on remotemachine (the machine you're SSH'd into): ssh -L 12345:localhost:54321 remotemachine


5

-p might be wrong.. This will work on redhat based distros.. nc -u -l 2115


5

That is part of the header. "The Priority value is calculated by first multiplying the Facility number by 8 and then adding the numerical value of the Severity." So 134 / 8 = 16 (facility local0) remainder 6 (severity Informational: informational messages). SYSLOG-MSG = HEADER SP STRUCTURED-DATA [SP MSG] HEADER = PRI... PRI = ...


5

Apache docs: http://httpd.apache.org/docs/2.2/logs.html#piped Apache will start the piped-log process when the server starts, and will restart it if it crashes while the server is running. (This last feature is why we can refer to this technique as "reliable piped logging".) NC docs: man nc -w timeout Connections which cannot be ...


4

┬┐have you tried pv? http://www.ivarch.com/programs/pv.shtml dd bs=16M if=/dev/sda|bzip2 -c| pv | nc serverB.example.net 19000 nc -l -p 19000| pv | bzip2 -d| dd bs=16M of=/dev/sdb good luck!


4

socat can do serial line stuff, netcat cannot. socat can do fairly advanced functionality, like having multiple clients listen on a port, or reusing connections.


4

The author of the ncat tool, in his page for netcat users notes that: By default, Ncat will accept 100 simultaneous connections, instead of 1 like the original netcat. Use -m to specify the maximum number of simultaneous connections. I rather suspect this means that netcat won't do what you want, but there's a simple drop-in replacement tool ...


4

Try it like this: nc -u -l 7777 > newfile.jpg #on the destination machine cat file.jpg | nc -u 192.168.x.x 7777 #on the source machine Usually you want the machine getting the file to "listen" (run that first), and when it's listening, send the data over udp. UDP does not have a 'handshake' sequence, and packets are sent immediately, even if noone is ...


4

Allow me to rephrase your question: I want to stick something in the middle of an TLS-encrypted connection that shows me the cleartext that's being sent. . . . Well it wouldn't be very secure now, would it? I mean the whole point of TLS is to prevent exactly what you're trying to do! -- So no, what you're asking for is NOT possible, nor is it ...


3

This works for me on debian using both nc.openbsd and nc.traditional: echo -e "stats\nquit" | nc 10.251.170.80 11211 your netcat appears to be closing the connection on EOF on stdin and not waiting for output.. you can try -q 1 or so.. -q seconds after EOF on stdin, wait the specified number of seconds and then quit. If seconds is negative, wait ...


3

It is not a standard program, but "socat tcp:your-host:1234 exec:bash,pty" will do the work. You can also secure your communication with OpenSSL with socat: # Your side: openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem socat `tty`,raw,echo=0 openssl-listen:1237,reuseaddr,cert=cert.pem,verify=0 # Their side: socat ...


3

If you wanna use netcat without ssh. I presume that is the fastest way and not the secure one, you can copy and restore the whole disk like this: On computer A with IP 192.168.0.1 cat /dev/hdb | nc -p 9000 On computer B nc -l 192.168.0.1 9000 > /dev/hdb Remember that according to man nc the -l option is: -l Used to specify that nc should listen for an ...


3

With the caveat that unencrypted shells across the Internet are a bad thing, this pentestmonkey post has some techniques that can be used to get a TTY over an existing shell session. The most likely to work on any system uses Python: python -c 'import pty; pty.spawn("/bin/sh")' Replace the shell with one of your choice.


3

Find the PID of the process that you want to check the I/O for in your case the dd on server b would be a good place to look then cat /proc/<PID>/io look at the value for wchar which should be the bytes written value. For future reference you can insert pv into one (or both) of the pipes and it will tell you how much data has passed through it. ...


3

Check the man page for dd on your OS, but is should support a USR1 signal which will give you a progress check. If you know the pid of you process, just send it a "kill -USR1 $pid" and it will show you how far it is.


3

nc has -w option for tuning the timeout. Try time nc -w 1 -z 1.2.3.4 1234



Only top voted, non community-wiki answers of a minimum length are eligible