netcat小工具使用

接收端:nc -l 1789 > test1.txt

发送端:nc 1.1.1.1 1789 < test1.txt

使用nc传文件要比scp快不少,当然,安全性低了.

[root@12]# nc -h
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
 [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
 [-x proxy_address[:port]] [hostname] [port[s]]
Command Summary:
-4 Use IPv4
-6 Use IPv6
-D Enable the debug socket option
-d Detach from stdin
-h This help text
-i secs Delay interval for lines sent, ports scanned
-k Keep inbound sockets open for multiple connects
-l Listen mode, for inbound connects
-n Suppress name/port resolutions
-p port Specify local port for remote connects
-r Randomize remote ports
  -S Enable the TCP MD5 signature option
-s addr Local source address
-T ToS Set IP Type of Service
-C Send CRLF as line-ending
-t Answer TELNET negotiation
-U Use UNIX domain socket
-u UDP mode
-v Verbose
-w secs Timeout for connects and final net reads
-X proto Proxy protocol: "4", "5" (SOCKS) or "connect"
-x addr[:port] Specify proxy address and port
-z Zero-I/O mode [used for scanning]
Port numbers can be individual or ranges: lo-hi [inclusive]

用来测试upd端口是否正常
a端:nc -ul 161
b端: nc -u a.a.a.a 161
在b端随便输入字符,看是否能够传到a端。 

1.扫描TCP端口.

[root@lo ~]# nc -v -z -w2 172.20.9.30 3388-3390
nc: connect to 172.20.9.30 port 3388 (tcp) failed: Connection refused
Connection to 172.20.9.30 3389 port [tcp/ms-wbt-server] succeeded!
nc: connect to 172.20.9.30 port 3390 (tcp) failed: Connection refused

2.扫描UDP端口.

[root@lo ~]# nc -u -v -z -w2 172.20.5.5 160-163
Connection to 172.20.5.5 161 port [udp/snmp] succeeded!
Connection to 172.20.5.5 162 port [udp/snmptrap] succeeded!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值