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. json字符串转为json对象-jQuery.parseJSON()

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. IDEA下配置Spring Boot的热部署

    © 版权声明:本文为博主原创文章,转载请注明出处 devtools简介 spring-boot-devtools会监听classpath下的文件变动,并且会立即重启应用(发生在保存时机),因为其采用的 ...

  3. 【HBase基础教程】1、HBase之单机模式与伪分布式模式安装(转)

    在这篇blog中,我们将介绍Hbase的单机模式安装与伪分布式的安装方式,以及通过浏览器查看Hbase的用户界面.搭建hbase伪分布式环境的前提是我们已经搭建好了hadoop完全分布式环境,搭建ha ...

  4. C语言学习笔记(七)——其它运算符

     第七章                          其它运算符   逗号运算符 逗号运算符:即顺序点,逗号前先运行.后再运行. for循环的运行次数: for(i=n; i<m; + ...

  5. HTML5 2D平台游戏开发#5攻击

    目前为止,角色除了基本的移动外还什么都不能做,于是我打算先实现角色的攻击动画.角色的普通攻击一共可以分为三个阶段: 一段斩 二段斩 三段斩 移动攻击 跳跃攻击 触发方式为角色站立时按下J(攻击)键,角 ...

  6. 数据库操作事物的四大特性以及MySQL数据库的四种隔离级别

    1 .事物操作数据库的四大特性(ACID) 1.原子性 (Atomicity) 原子性:就是事物的所包含的所有操作,要么全部成功,要么全部失败回滚. 2.一致性 (Consistency) 一致性:简 ...

  7. Apache配置压缩优化时报错——undefined symbol: inflateEnd

    Apache配置压缩优化时报错——undefined symbol: inflateEnd 环境:CentOS 6.4 软件版本:httpd-2.4.6 apr-1.4.8 apr-util-1.5. ...

  8. 玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert=&quot;false&quot; update=&quot;fal

    近期用JPA遇到这样一个问题:Repeated column in mapping for entity: com.ketayao.security.entity.main.User column: ...

  9. Spring Cloud 微服务五:Spring cloud gateway限流

    前言:在互联网应用中,特别是电商,高并发的场景非常多,比如:秒杀.抢购.双11等,在开始时间点会使流量爆发式地涌入,如果对网络流量不加控制很有可能造成后台实例资源耗尽.限流是指通过指定的策略削减流量, ...

  10. nginx 不能解析php怎么办

    在服务器下源码安装了 mysql php  nginx,结果nginx不支持php.解决方法,在nginx配置文件中添加: ocation ~ .*\.php?$ { fastcgi_pass 127 ...