简介:
网络瑞士军刀NetCat,黑客常用来抓包
在网络工具中有“瑞士军刀”美誉的NetCat,它能通过TCP和UDP在网络中读写数据。通过与其他工具结合和重定向,你可以在脚本中以多种方式使用它。使用netcat命令所能完成的事情令人惊讶。
netcat所做的就是在两台电脑之间建立链接并返回两个数据流,在这之后所能做的事就看你的想像力了。你能建立一个服务器,传输文件,与朋友聊天,传输流媒体或者用它作为其它协议的独立客户端。
qq功能:Chat聊天,传文件(2001年)。在qq有传文件之前,NetCat就已经实现。飞秋和qq是同一时代的产品。
安装:
安装时发生如下报错
[root@hadoop01 software]# rpm -ivh nc-1.84-24.el6.x86_64.rpm
Preparing... ########################################### [100%]
file /usr/bin/nc from install of nc-1.84-24.el6.x86_64 conflicts with file from package netcat-0.7.1-1.i386
[root@hadoop01 software]#
是安装包冲突,把冲突的包卸载
[root@hadoop01 software]# yum -y remove netcat-0.7.1-1.i386
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package netcat.i386 0:0.7.1-1 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Removing:
netcat i386 0.7.1-1 installed 385 k
Transaction Summary
==========================================================================================================================
Remove 1 Package(s)
Installed size: 385 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs
Erasing : netcat-0.7.1-1.i386 1/1
Verifying : netcat-0.7.1-1.i386 1/1
Removed:
netcat.i386 0:0.7.1-1
Complete!
再次安装:
[root@hadoop01 software]# rpm -ivh nc-1.84-24.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:nc ########################################### [100%]
运行:
nc –lk 9999 #启动NC
ps –ef|grep nc #检查NC是否启动
如下启动后写数据,就模拟使用tcp协议,通过检测端口(此处为9999)可以获取它的数据
[root@hadoop01 software]# nc -lk 9999
asdf
监控:
spark中:
val lines = ssc.socketTextStream("192.168.1.106",9999, StorageLevel.MEMORY_AND_DISK_SER)