测试中,需要通过 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: 4, 8, 12, ...
  -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'

linux nc 命令使用详解

功能说明:功能强大的网络工具
语  法:nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p<通信端口>][-s<来源位址>][-v...][-w<超时秒数>][主机名称][通信端口...]
参  数:
-g<网关>        设置路由器通信网关,最大可设置8个。
-G<指向器数目>  设置来源路由指向器,其数值为4的倍数。
-h              在线帮助。
-i<延迟秒数>    设置时间间隔,以便传送信息及扫描通信端口。
-l              使用监听模式,管控传入的资料。
-n              直接使用IP地址,而不通过域名服务器。不能用 hostname。
-o<输出文件>    指定文件名称,把往来传输的数据以16进制字码文件保存。
-p<通信端口>    设置本地主机使用的通信端口。
-r              指定本地与远端主机的通信端口。
-s<来源位址>    设置本地主机送出数据包的IP地址。
-u              使用UDP传输协议。
-v              详细输出,用两个-v可得到更详细的内容。
-w<超时秒数>    设置等待连线的时间。
-z              使用输入/输出模式,只在扫描通信端口时使用。

5、使用普通用户登录 Linux,启动 netcat,测试使用

[atguigu@hadoop102 ~]$ nc -l -p 9999   #监听9999端口
hello world     #发送测试数据 我们监听服务器端的 ip 和端口号
[atguigu@hadoop102 ~]$ nc -nv 192.168.25.102 444

Linux学习_012_Centos 6.8 安装 Netcat的更多相关文章

  1. Linux 学习笔记 2 Centos 安装与网络的配置以及VI编辑器的使用

    前言 当然,还是觉得Centos 在众多的Linux 发行版中,还是很有地位的,好多的服务器大多沿用的都是一代的Centos 因为它开源(这是废话)而且稳定,这才是服务器沿用的最重要的一项指标. 镜像 ...

  2. Linux学习——卸载Ubuntu,安装CentOS,第一次使用命令

    最近,看了相关的资料,发现Ubuntu不是很利于学习Linux操作系统,而CentOS比较有利于学习Linux操作系统,就卸载了. 当然,对于菜鸟,自然是很没有主见. 卸载Ubuntu感觉很奇怪,下来 ...

  3. Linux学习2-云服务器上安装java和tomcat环境

    在linux上部署java的项目,首先要安装JDK和Tomcat,具体要求怎么操作呢,我们一起来学习吧! JDK的安装步骤如下: 1.首先我们从官网下载jdk-8u231-linux-x64.rpm安 ...

  4. linux学习笔记1-ubuntu的安装与基本设置

    ubuntu的安装 (1) 要装ubuntu首先当然得捣鼓一台机器,当然你用虚拟机也是可以的.本人的这台DELL品牌机是从某师兄脚底下挖出来的,大概很多年没人用了,内存1.25G|||- -,但是硬盘 ...

  5. Linux学习笔记:Tomcat安装与使用

    Tomcat是一个Servlet容器服务器,用java实现的. 目录结构 Tomcat的安装也很简单,从官网下载安装包.解压后的tomcat目录 apache-tomcat-7.0.92 下的子目录为 ...

  6. 【Linux学习七】软件安装

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 一.编译安装1.解压 源码文件是压缩包 要先解压tar -zxvf t ...

  7. Linux学习笔记之yum安装和卸载软件

    # yum -y install 包名(支持*) :自动选择y,全自动 # yum install 包名(支持*) :手动选择y or n # yum remove 包名(不支持*) # rpm -i ...

  8. Linux学习-开放源码的软件安装与升级简介

    什么是开放源码.编译程序与可执行文件 我们说过,在 Linux 系统上面,一个文件能不能被执行看的是有没有可执行的那个权限 (具有 x permission),不过,Linux 系统上真 正认识的可执 ...

  9. Linux学习笔记之ubuntu安装与配置

    1.打开虚拟机,点击新建虚拟机 2.安装向导 选择自定义安装 点击包含一个空白的硬盘 选择linux操作系统,版本是ubuntu 设置虚拟机的名称,可以自己写,还有保存的位置也可自选 根据自己电脑性能 ...

随机推荐

  1. 算法库中heap应用

    STL中make_heap 的接口为: default (1) template <class RandomAccessIterator> void make_heap (RandomAc ...

  2. tarjan算法讲解。

    tarjan算法讲解.   全网最详细tarjan算法讲解,我不敢说别的.反正其他tarjan算法讲解,我看了半天才看懂.我写的这个,读完一遍,发现原来tarjan这么简单! tarjan算法,一个关 ...

  3. Combination Sum Two

    Description: Given a collection of candidate numbers (C) and a target number (T), find all unique co ...

  4. ArcGis SOE(server object extensions)之REST Template初体验

    一.安装vs和arcgis server for .net(本例是vs2010.as 10),然后打开vs新建一个项目

  5. RabbitMQ Linux(Redhat6.5)安装(二 )

    一.安装erlang 由于RabbitMq的linux运行环境需要erlang环境,所以需要先安装erlang: 1.erlang下载: http://erlang.org/download/(我下载 ...

  6. mysql workbench EER图,里面的实线以及虚线的关系

    ERWin里面线代表实体间的三种关系:决定关系(Identifying Relationship),非决定关系(None-Identifying Relationship),多对多(Many-To-M ...

  7. java并发包java.util.concurrent详解

    线程池ThreadPoolExecutor的使用 并发容器之CopyOnWriteArrayList 并发容器之CopyOnWriteArraySet 数据结构之ConcurrentHashMap,区 ...

  8. vue入坑教程(一)

    1.脚手架搭配webpack的安装 (1)需要检查自己的电脑有没有安装node和npm 如果没有安装可以参考官网,以及安装的步骤 官方中文网地址:http://nodejs.cn/ (2)下载webp ...

  9. 自动化运维工具sshd,expect,pssh,rsync详解

    ssh secure shell,安全的远程登录:openssh和dropbear都是它的开源实现,ssh协议有v1和v2俩个版本,现在使用的都是v2版,v1已经不安全了:ssh基于DH算法做密钥交换 ...

  10. 写完批处理脚本,再写个Gradle脚本,解放双手

    前言 上一篇写个批处理来帮忙干活---遍历&字符串处理中,我们已经学习如何写批处理脚本来帮我们做一些简单的重复性工作,本篇继续来学习如何用 Gradle 写脚本,让它也来帮我们干活 Gradl ...