centos安装netcat工具及测试
netcat是网络工具中的瑞士军刀,它能通过TCP和UDP在网卡中读写数据。通过与其他工具结合和重定向,你可以在脚本中以多种方式使用它。使用natcat命令所能完成的事情令人惊讶。
netcat所做的就是在两台电脑之间简历连接并返回两个数据流,在这之后所能作的事就看你的想法了。你能建立一个服务器,传输文件,与朋友聊天,传输流媒体或者用它作为其他协议的独立客户端。
1.下载
- $ wget https://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz<span style="font-family:Arial, Helvetica, sans-serif;padding:0px;color:rgb(63,63,63);font-size:14px;text-align:left;background-color:rgb(255,255,255);"></span>
如果下载不成功,请自行前往此地址下载:http://netcat.sourceforge.net/download.php
2.解压
- $ sudo tar -zxvf netcat-0.7.1.tar.gz -C /usr/local
查看解压后的文件
- $ cd /user/local/study
- $ ls
- netcat-0.7.1 php
- $ sudo mv netcat-0.7.1 netcat
- $ ls
- netcat php
netcat-0.7.1就是解压后的目录 将其重命名为netcat
3.切换到解压后的目录,查看编译配置文件
- $ cd /use/local/netcat
- $ ./configure
4.编译安装
- $ make && make install
5.配置
切换到/etc目录
编辑etc/profile;加入
export NETCAT_HOME=/usr/local/netcat-0.7.1
export PATH=$PATH:$NETCAT_HOME/bin
6.测试
- nc -help 或者 netcat -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'
如上即安装成功;
使用swoole写了一个udp的连接,测试
- $ netcat -u 127.0.0.1 5999
- hello
- Serverhello
- $ nc -u 127.0.0.1 5999
- hello
- Serverhello

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Linux根目录下各目录含义
Linux文件系统 /bin:也称二进制(binary)目录,包含了那些供系统管理员和普通用户 使用的重要的Linux命令的可执行文件。一些常用的命令有: bash、cat、chmod、cp、date、echo、kill、ln、mail、mkdir、more、mv、ps、pwd、rm、rmdir、sh、stty、su、tcsh、uname和vi。一些用于系统恢复的命令如:tar、gzip、gunzip和zcat。还有一些网络命令如: domainname、hostname、netstat和ping。目录/usr/bin下存放了大部分的用户命令。 /boot:在这个目录下存放系统启动时要用到的程序。包括Linux内核的二进制映像。内核文件名是vmlinux加上版本和发布信息。 /dev:dev 是设备(device)的英文缩写。在这个目录中包含了所有linux系统中使用的外部设备。但是这里并不是放的外部设备的驱动程序。 /etc:etc这个目录是linux系统中最重要的目录之一。在这个目录下存放了系统管理时要用到的各种配置文件和子目录。我们要用到的网络配置文件,文件系统,x系统配置文件,...
- 下一篇
CentOS7.4上搭建Samba,实现windows与Linux文件数据同步
一 环境介绍 1.本地win10 2.远程Linux (centos7.4) 二 安装Samba 1. 安装samba相关的服务 yum install -y samba* 2. 查看Samba是否安装成功 systemctl status smb 注:如果出现如下显示,说明Samba安装成功 三 配置Samba 1. 配置Samba配置文件 1.1 备份samba配置文件 cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 1.2 编辑smb.conf , 对samba进行配置,改为如下 [global] workgroup = WORKGROUP server string = Ted Samba Server %v netbios name = TedSamba security = user map to guest = Bad User passdb backend = tdbsam [Faraway] comment = project development directory path = /data v...
相关文章
文章评论
共有0条评论来说两句吧...