root@10.1.1.43:~# nc -h
[v1.10-38]
connect to somewhere: nc [-options] hostname port[s] [ports] ...
listen for inbound: nc -l -p port [-options] [hostname] [port]
options:
-c shell commands as `-e'; use /bin/sh to exec [dangerous!!]
-e filename program to exec after connect [dangerous!!]
-b allow broadcasts
-g gateway source-routing hop point[s], up to 8      设置路由器跃程通信网关,最高可设置8个。
-G num source-routing pointer: 4, 8, 12, ...        设置来源路由指向器,其数值为4的倍数。
-h this cruft
-i secs delay interval for lines sent, ports sca       延时的间隔
-k set keepalive option on socket
-l listen mode, for inbound connects           监听模式,入站连接
-n numeric-only IP addresses, no DNS          直接使用ip地址,而不用域名服务器
-o file hex dump of traffic                   指定文件名称,把往来传输的数据以16进制字码倾倒成该文件保存。
-p port local port number                   本地端口
-r randomize local and remote ports               随机本地和远程端口
-q secs quit after EOF on stdin and delay of secs
-s addr local source address
-T tos set Type Of Service
-t answer TELNET negotiation
-u UDP mode udp                      模式
-v verbose [use twice to be more verbose]            显示过程,vv 更多
-w secs timeout for connects and final net reads       等待连接超时
-z zero-I/O mode [used for scanning]            使用输入/输出模式,只在扫描通信端口时使用。

1.监听本地端口

root@10.1.1.43:~# nc -l -p 1234
root@10.1.1.43:~# netstat -tunlp | grep 1234
tcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN 15543/nc

2.端口扫描

root@10.1.1.43:~# nc -v -w 10 10.1.1.180 80
(UNKNOWN) [10.1.1.180] 80 (www) open

root@10.1.1.43:~# nc -v -w 10 10.1.1.180 -z 80-30000
(UNKNOWN) [10.1.1.180] 22000 (?) open
(UNKNOWN) [10.1.1.180] 80 (www) open

3.文件传出

源10.1.1.43 text.txt

目的 10.1.1.180

root@10:~# nc -l -p 1234 > test.txt           #开10.1.1.180:1234端口监听,并将socket传输过来的数据重定向到test.txt文件 test 43 nc
root@10.1.1.43:~#cat test.txt

root@10.1.1.43:~# nc 10.1.1.180 1234 < test.txt      #连接远程的10.1.1.180,从test.txt的路径从定向到socket,从而将文件传输到远方。
root@10:~# cat test.txt

4.目录传输

源10.1.1.43 python_program

目的 10.1.1.180

root@10:~# nc -l -p 1234 | tar xzvf -

root@10.1.1.43:~# tar czvf - python_program | nc 10.1.1.180 1234
python_program/
python_program/1.py
python_program/4.py
python_program/3.py

5.测试UDP端口

root@172.16.211.34:web# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1111/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 887/dhclient

root@172.16.211.35:~# nc -vuz 172.16.211.34 68
Connection to 172.16.211.34 68 port [udp/bootpc] succeeded!

nc命令用法的更多相关文章

  1. nc命令用法举例

    什么是nc nc是netcat的简写,有着网络界的瑞士军刀美誉.因为它短小精悍.功能实用,被设计为一个简单.可靠的网络工具 nc的作用 (1)实现任意TCP/UDP端口的侦听,nc可以作为server ...

  2. Linux nc命令用法收集

    ps.ubuntu自带的nc是netcat-openbsd版,不带-c/-e参数. pss.在线Markdown编辑器的bug是怎么回事...“#”号依然显示着 ##参数 想要连接到某处: nc [- ...

  3. nc命令用法举

    什么是nc nc是netcat的简写,有着网络界的瑞士军刀美誉.因为它短小精悍.功能实用,被设计为一个简单.可靠的网络工具 nc的作用 (1)实现任意TCP/UDP端口的侦听,nc可以作为server ...

  4. nc工具用法

    http://man.linuxde.net/nc_netcat nc命令用法举例 什么是nc

  5. 12. nc/netcat 用法举例

    nc命令用法举例 什么是nc nc是netcat的简写,有着网络界的瑞士军刀美誉.因为它短小精悍.功能实用,被设计为一个简单.可靠的网络工具 nc的作用 (1)实现任意TCP/UDP端口的侦听,nc可 ...

  6. Linux nc命令详解

    NetCat,在网络工具中有“瑞士军刀”美誉,其有Windows和Linux的版本.因为它短小精悍(1.84版本也不过25k,旧版本或缩减版甚至更小).功能实用,被设计为一个简单.可靠的网络工具,可通 ...

  7. Linux Shell脚本编程--nc命令使用详解

    linux nc命令使用详解     功能说明:功能强大的网络工具 语 法:nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>] ...

  8. nc命令总结

    1.远程拷贝文件从server1拷贝文件到server2上.需要先在server2上,用nc激活监听,server2上运行: 引用 [root@hatest2 tmp]# nc -l 1234 > ...

  9. linux nc命令使用详解

    功能说明:功能强大的网络工具 语 法:nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p ...

随机推荐

  1. PHP面试题及答案解析(7)—Linux系统命令

    1.请解释下列10个shell命令的用途.top.ps.mv.find.df.cat.chmod.chgrp.grep.wc top:该命令提供了实时对系统处理器状态的监控,它能够实时显示系统中各个进 ...

  2. POJ 1731 Orders(STL运用)

    题目地址:POJ 1731 这题能够直接用STL函数做,非常轻松..next_permutation函数非常给力.. 代码例如以下: #include <algorithm> #inclu ...

  3. SpringBoot项目的云服务器部署

    1.场景还原 springboot配置相当简单,人人皆知.怎么把springboot工程部署到云服务器上呢?可能有人会说,博主你前篇不是讲了java工程的云部署把:但是我想澄清一点的是,我前篇的工程都 ...

  4. iOS tableView Section圆角方案

    给tableView的section设置圆角 首先给让cell左右偏移一点的距离,通过重写cell的setframe方法来实现 -(void)setFrame:(CGRect)frame{ CGFlo ...

  5. 交易应用及网站驱动不兼容Windows 10的解决方案

        微软公司于2015年7月29日正式发布了Windows 10操作系统.全球范围内已有数以千万计的用户踊跃地升级到了Windows 10,在新用户享受Windows 10所带来的全新使用体验的同 ...

  6. Java线程—-Runnable和Callable的区别和联系

    Java 提供了三种创建线程的方法 1.继承Thread接口 public class Thread2Thread { public static void main(String[] args) { ...

  7. iOS 启动页放大淡出效果

    //屏幕宽度#define kWIDTH [UIScreen mainScreen].bounds.size.width//屏幕高度 #define kHEIGHT [UIScreen mainScr ...

  8. Tomcat的目录结构(tomcat 7)

    /bin                存放在Windows平台以及Linux平台上启动和关闭Tomat的脚本文件 /conf              存放关于Tomcat服务器的全局配置. /li ...

  9. Q: Why can't I access the Site Settings of my SharePoint site? 'File Not Found'

    Q: I am trying to access the Site Settings of my SharePoint site, but I get a File Not Found error, ...

  10. java.util包下面的类---------01---示意图

    一直在使用util包下面的这些类,甚至有些没用过的,想要都去认识认识他们!也许在未来的一天可以用到! 图太大不好截图!部分没有截全!