netcat

in ubuntu, uninstall the netcat-openbsd version by running:
sudo apt-get remove –purge netcat-openbsd

then run:
sudo apt-get install netcat-traditional

verify the traditional netcat version is installed by running:
nc -h
if the -e option is listed then traditional is installed

port scanning:
nc -v -w 1 192.168.1.10 -z 1-1000
mirabox.local [192.168.1.10] 53 (domain) open
mirabox.local [192.168.1.10] 22 (ssh) open
^the 1-1000 portion indicates the port range

banner grabbing:
nc 192.168.1.1 80
HTTP/1.1 200
HTTP/1.0 400 Bad Request
Server: httpd/2.0

nc -nv 10.0.2.7 80
(UNKNOWN) [10.0.2.7] 80 (http) open
HTTP/1.1 200
Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28

nc -nv 10.0.2.7 21
(UNKNOWN) [10.0.2.7] 21 (ftp) open
220-FileZilla Server version 0.9.41 beta

nc 192.168.1.10 22
SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u4

nc -nv 10.0.2.7 143
(UNKNOWN) [10.0.2.7] 143 (imap2) open
* OK localhost IMAP4rev1 Mercury/32 v4.62 server ready.

transferring a file:
nc -v -w 30 -p 3333 -l < mytext.txt (sending)
nc -v -w 2 192.168.1.50 3333 > mytext.txt (receiving)
-or-
nc -nv 10.0.2.7 3333 < mytext.txt
nc -nlvp 3333 > mytext.txt

server/client chat:
nc -nlvp 4000 (server)
listening on [any] 4000 …
connect to [10.0.2.7] from (UNKNOWN) [10.0.2.8] 44010
test
test2

nc -nv 10.0.2.7 4000 (client)
(UNKNOWN) [10.0.2.7] 4000 (?) open
test
test2

This entry was written by resinblade , posted on Thursday January 05 2017at 11:01 pm , filed under IT . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

Comments are closed.