background preloader

Ssh-udp

Facebook Twitter

Netcat: The TCP/IP Swiss army knife. Posted by Steve on Thu 16 Dec 2004 at 11:28 Of all the networking tools I'm familiar with I use four more than any other; ping, traceroute, nmap, and netcat. The first two utilities are standard on many operating systems. nmap is a port scanner which makes it simple to identify the services running on a machine. Netcat? That's a general purpose tool described by its author as a TCP/IP swiss army knife. The utility of netcat comes from its extreme simplicity, it does one simple job very well. It's almost the same as a telnet client, but much more scriptable. For example we can connect to a webserver using netcat and send a command to it - getting the result piped back to us. skx@lappy:~$ echo -e "HEAD / HTTP/1.0\n" | nc www.foo.com 80 Date: Wed, 15 Dec 2004 23:05:36 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.8 X-Powered-By: PHP/4.3.8 X-Accelerated-By: PHPA/1.3.3r2 Location: Connection: close Content-Type: text/html skx@lappy:~$ nc -l -p 2000 -e /usr/bin/uptime.

Linux Tips & Tricks : How to do UDP wrapping (syslog via ssh)? Netcat – a couple of useful examples. One of the Linux command line tools I had initially under-estimated is netcat or just nc. By default, netcat creates a TCP socket either in listening mode (server socket) or a socket that is used in order to connect to a server (client mode). Actually, netcat does not care whether the socket is meant to be a server or a client. All it does is to take the data from stdin and transfer it to the other end across the network. The simplest example of its usage is to create a server-client chat system. . $ nc -l 3333 On the other end, connect to the server with the following: $ nc 192.168.0.1 3333 In this case, the keyboard acts as the stdin. Transfering Files In the very same way it can be used to transfer files between two computers. . $ cat backup.iso | nc -l 3333 Receive backup.iso on the client machine with the following: $ nc 192.168.0.1 3333 > backup.iso As you may have noticed, netcat does not show any info about the progress of the data transfer.

. $ cat backup.iso | pv -b | nc -l 3333 Security. Performing UDP tunneling through an SSH connection. Intro The Swiss ISP Bluewin sucks. Their DNS are often down. A friend even received advice from Bluewin technicians to not use their own DNS!... But then, it is quite hard to gain access to another DNS for free, if you don't have access to a co hosted machine. In this document, we'll access another machine's network internal DNS services (UDP port 53) with only SSH access to it. Step by step Open a TCP forward port with your SSH connection On your local machine (local), connect to the distant machine (server) by SSH, with the additional -L option so that SSH will TCP port-forward: local# ssh -L 6667:localhost:6667 server This will allow TCP connections on the port number 6667 of your local machine to be forwarded to the port number 6667 on server through the secure channel.

Setup the TCP to UDP forward on the server On the server, we open a listener on the TCP port 6667 which will forward data to UDP port 53 of a specified IP. Setup the UDP to TCP forward on your machine # host m6.fr 127.0.0.1.