首页 > Web开发 > 详细

Linux学习_012_Centos 6.8 安装 Netcat

时间:2019-04-28 17:52:01      阅读:176      评论:0      收藏:0      [点我收藏+]

测试中,需要通过 Netcat 发送数据。

配置环境:CentOS 6.8

1、下载安装包到指定目录,例如本博主的是:/opt/software/

wget https://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz

2、解压缩文件到指定目录(注意:要先创建 /opt/module/netcat/ 目录)

tar -zxf /opt/software/netcat-0.7.1.tar.gz -C /opt/module/netcat

3、使用 root 用户,先切换至 /opt/module/netcat/netcat-0.7.1/ 该目录

[root@hadoop102 netcat-0.7.1]# pwd
/opt/module/netcat/netcat-0.7.1
[root@hadoop102 netcat-0.7.1]# ./configure 
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
......
......
[root@hadoop102 netcat-0.7.1]# make && make install  #进行编译安装

4、配置,打开 /etc/profile

[root@hadoop102 netcat-0.7.1]# vim /etc/profile

添加内容如下:
#NETCAT_HOME
export NETCAT_HOME=/opt/module/netcat/netcat-0.7.1
export PATH=$PATH:$NETCAT_HOME/bin
[root@hadoop102 netcat-0.7.1]# source /etc/profile  #生效配置
[root@hadoop102 netcat-0.7.1]# nc -help     #出现以下信息表明配置已生效
GNU netcat 0.7.1, a rewrite of the famous networking tool.
Basic usages:
connect to somewhere:  nc [options] hostname port [port] ...
listen for inbound:    nc -l -p port [options] [hostname] [port] ...
tunnel to somewhere:   nc -L hostname:port -p port [options]

Mandatory arguments to long options are mandatory for short options too.
Options:
  -c, --close                close connection on EOF from stdin
  -e, --exec=PROGRAM         program to exec after connect
  -g, --gateway=LIST         source-routing hop point[s], up to 8
  -G, --pointer=NUM          source-routing pointer: 4812, ...
  -h, --help                 display this help and exit
  -i, --interval=SECS        delay interval for lines sent, ports scanned
  -l, --listen               listen mode, for inbound connects
  -L, --tunnel=ADDRESS:PORT  forward local port to remote address
  -n, --dont-resolve         numeric-only IP addresses, no DNS
  -o, --output=FILE          output hexdump traffic to FILE (implies -x)
  -p, --local-port=NUM       local port number
  -r, --randomize            randomize local and remote ports
  -s, --source=ADDRESS       local source address (ip or hostname)
  -t, --tcp                  TCP mode (default)
  -T, --telnet               answer using TELNET negotiation
  -u, --udp                  UDP mode
  -v, --verbose              verbose (use twice to be more verbose)
  -V, --version              output version information and exit
  -x, --hexdump              hexdump incoming and outgoing traffic
  -w, --wait=SECS            timeout for connects and final net reads
  -z, --zero                 zero-I/O mode (used for scanning)

Remote port number can also be specified as range.  Example: ‘1-1024‘

5、启动 netcat

[root@hadoop102 netcat-0.7.1]# nc -l 9999   #监听9999端口

Linux学习_012_Centos 6.8 安装 Netcat

原文:https://www.cnblogs.com/chenmingjun/p/10785438.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!