Get Mystery Box with random crypto!

[NETCAT] Keep on hand a swiss army knife! Netcat is a good old | LinuxCheatSheet

[NETCAT] Keep on hand a swiss army knife!
Netcat is a good old tool that you can use in many situations, from testing to prototyping a service. The name describe it well: it is a 'cat' over network. The simplest use you can do with it is to connect to a remote service and sending commands to it. For example, to make a HTTP request, open
nc -C www.google.com 80
and paste the lines
GET / HTTP/1.1
Host: www.google.com
Connection: close
This kind of use make nc a replacement for telnet to test some services (i.e. SMTP by sending HELO, RCPT TO and similar commands). The advantage of netcat over telnet is the ability to use UDP and other options like timeout control, the possibility to read input from another socket and more (see man nc). But the real power of netcat is that it can also listen on a port. Using it you can ever write a simple daemon with bash that can receive commands from a remote host and do some stuff. Look at this small example
If you run it on your pc (after installing netcat, of course), you can then open another shell and try to write to it.
]$ echo "test" | nc localhost 1234
]$ echo "q" | nc localhost 1234
Last but not least, please note that there are different flavours of netcat: gnu netcat, bsd netcat (the one used in this example) and nmap netcat (can do a lot of stuff!).

If you like it please vote the post and share the channel with your friends: http://t.me/linuxcheatsheet
Bye!
G.
(p.s. You can now assign a simple vote for the post, like with stars, from 3 to 1)