测试中,需要通过 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. Kotlin : Retrofit + RxAndroid + Realm

    https://jqs7.com/kotlin-retrofit-rxandroid-realm/ 原作者:Ahmed Rizwan 原文链接:Kotlin : Retrofit + RxAndroi ...

  2. Django Web项目部署参考

    环境准备:1.Python 2.7.*]2.pip3.sudo pip install django4.sudo aptitude show python-setuptools5.sudo aptit ...

  3. 通过Django Channels设计聊天机器人WEB框架

    这两个月都在忙着设计针对银联客服业务的智能聊天机器人,上一周已经交完设计报告,这一周还和部门同事一起分享了系统设计及运行效果.因为时间的关系,系统原型我使用了Flask+jQuery的组合,感觉用以原 ...

  4. ASP.NET MVC中的路由IRouteConstraint方法应用实例

    在如下代码的写法中: public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { ro ...

  5. yii2实战之初见端倪

    PHP框架大PK php框架有很多种,在国内应用较多的有:Thinkphp, Yii, Laravel, Codeigniter等.关于这些框架,孰优孰劣,是一个极具争议性的话题.各方支持者总能拿出自 ...

  6. Download and Install Apache Zookeeper on Ubuntu

    http://www.techburps.com/misc/download-and-install-apache-zookeepr/36 In previous article of this Bi ...

  7. Python2.7和3.5双版本共存和pip的使用

    1. Python2.7和3.5并存 1.1 安装 安装自不必多说,先装2.7,再装3.5. 说下安装的目录:Py3.5和Py2.7默认的安装目录是不一样的,按默认的来就好,不用管. Python2. ...

  8. SQL的操作方法

    1 SQL介绍 SQL 是用于访问和处理数据库的标准的计算机语言.关于SQL的具体介绍,我们通过回答如下三个问题来进行. SQL 是什么? SQL,指结构化查询语言,全称是 Structured Qu ...

  9. select case when与IF的用法

    case when概述 sql语句中的case语句与高级语言中的switch语句,是标准sql的语法,适用于一个条件判断有多种值的情况下分别执行不同的操作. case when示例 有一张表,里面有3 ...

  10. 【转】IntelliJ IDEA中文乱码问题

    1.首先是编辑器的乱码,这个很好解决,file->settings->appearence里面有个Name设置成支持中文的字 体(这个很重要) 同样还要再settings中的Eidtor- ...