netcat | nc -v -z localhost 22 | nc -l 1111 - nc 192.168.184.130 1111 | echo -n "GET / HTTP/1.0\r\n\r\n" | nc host.example.com 80

client
#nc 192.168.184.130 1111
fdf
fd
hello

server
#nc -l 1111
fdf
fd
hello
==================
client

doc1@ubuntu:~$ cat testfile 
Sat Nov  4 10:13:01 PDT 2017
doc1@ubuntu:~$ cat testfile | nc 192.168.184.130 1111

server
[root@localhost docker-compose-ex1]# nc -l 1111
Sat Nov  4 10:13:01 PDT 2017
==================
options on server
$ nc -l 2389 > test
client timeout
$ nc -w 10 localhost 2389
server up after client disconnect
$ nc -k -l 2389
PORT SCANNING
 nc -v -z localhost 22

Connection to localhost 22 port [tcp/ssh] succeeded!

doc1@ubuntu:~$ nc -zv 192.168.184.130 1100-1111
nc: connect to 192.168.184.130 port 1100 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1101 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1102 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1103 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1104 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1105 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1106 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1107 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1108 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1109 (tcp) failed: Connection refused
nc: connect to 192.168.184.130 port 1110 (tcp) failed: Connection refused
Connection to 192.168.184.130 1111 port [tcp/*] succeeded!

doc1@ubuntu:~$

============================

TALKING TO SERVERS
It is sometimes useful to talk to servers "by hand" rather than through a user interface. It can aid in troubleshooting, when it might be necessary to verify what data a server is sending in response to commands issued by the client. For example, to retrieve the home page of a web site:
$ echo -n "GET / HTTP/1.0\r\n\r\n" | nc host.example.com 80
Note that this also displays the headers sent by the web server. They can be filtered, using a tool such as sed(1), if necessary.
More complicated examples can be built up when the user knows the format of requests required by the server. As another example, an email may be submitted to an SMTP server using:
$ nc localhost 25 << EOF
HELO host.example.com
MAIL FROM: <user@host.example.com>
RCPT TO: <user2@host.example.com>
DATA
Body of email.
.
QUIT
EOF




===========
- p - source port

-T ToS


-X proxy_version
Requests that nc should use the specified protocol when talking to the proxy server. Supported protocols are "4" (SOCKS v.4), "5" (SOCKS v.5) and "connect" (HTTPS proxy). If the protocol is not specified, SOCKS version 5 is used.
-x proxy_address[: port]
Requests that nc should connect to hostname using a proxy at proxy_address and port. If port is not specified, the well-known port for the proxy protocol is used (1080 for SOCKS, 3128 for HTTPS).

server UDP port
$ nc -4 -u -l 2389

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all