Fping:一个多主机同时ping扫描程序
创始人
2024-07-19 22:40:30
0

fping是一款类似ping(1)(ping(1)是通过ICMP(网络控制信息协议Internet Control Message Protocol)协议回复请求以检测主机是否存在)的程序。Fping与ping不同的地方在于,您可以在命令行中指定要ping的主机数量范围,也可以指定含有要ping的主机列表文件。与ping要等待某一主机连接超时或发回反馈信息不同,fping给一个主机发送完数据包后,马上给下一个主机发送数据包,实现多主机同时ping。如果某一主机ping通,则此主机将被打上标记,并从等待列表中移除,如果没ping通,说明主机无法到达,主机仍然留在等待列表中,等待后续操作。

下载链接:http://down.51cto.com/data/158562

>>去网络安全工具百宝箱看看其它安全工具

PS:本文没有涉及到windows下面的fping.

功能

fping - send ICMP ECHO_REQUEST packets to network hosts

UNIX和Windows环境都有许多可以用来进行ICMP ping扫描的工具。fping(http://packetstorm.securify.com/ Exploit_Code__Archive/ fping.tar.gz)是UNIX环境里久经考验的ping扫描工具之一。早期的ping扫描工具大都需要等待前一个被探测主机返回某种响应消息之后才能继续探测下一台主机是否存在,但fping却能以轮转方式并行地发出大量的ping请求。这么一来,用fping工具去扫描多个IP地址的速度要比ping快很多。fping工具有两种用法:既可以通过标准输入设备(stdin)向它提供一系列IP地址作为输入,也可以让它去读取某个文件。让fping工具去读取一个文件是件很简单的事情:创建一个文本文件并把IP地址按每行一个的格式写入,如下所示:

  1. 192.168.51.1   
  2. 192.168.51.2   
  3. 192.168.51.3   
  4. ...   
  5. 192.168.51.253   
  6. 192.168.51.254 

然后使用“-f”参数读入这个文件,如下所示:

  1. [root]$ fping –a –f in.txt   
  2. 192.168.1.254 is alive   
  3. 192.168.1.227 is alive   
  4. 192.168.1.224 is alive   
  5. ...   
  6. 192.168.1.3 is alive   
  7. 192.168.1.2 is alive   
  8. 192.168.1.1 is alive   
  9. 192.168.1.190 is alive 

fping工具的“-a”选项表示只在输出报告里列出当前正在运行的系统。如果你愿意,还可以同时使用这个工具的“-d”选项去解析主机名。笔者比较喜欢使用fping工具的“-a”选项配合shell脚本和“-d”选项去扫描那些有着***的主机名的系统。在编写进行ping扫描的脚本时,“-f”和fping工具的其他几个选项也很有用。fping工具的可用选项的完整清单可以通过执行“fping -h”命令来查看。

Unix 版本相关网站:http://www.fping.com/

Windows版本相关网站:http://www.kwakkelflap.com/ 
 
实现机制:

Fping sends ICMP echo requests to a list of IP addresses, provided either on standard input or from a file, in a parallelized fashion. It sends out Pings in a "round-robin" fashion without waiting for a response. When responses are eventually returned, fping notes whether the host is alive or not and waits for more responses, all the while continuing its Ping sweep.

跟普通shell批量ping脚本相比,具有并行,结果易读的优点。   #p#
 
fping -a -g 172.19.148.1 172.19.148.255 -s -n  >hosts
 
执行结果,显示通的IP: 

  1. [root@Meil_88 root]# vi hosts    
  2.     
  3. 172.19.148.1   
  4. 172.19.148.2   
  5. 172.19.148.3   
  6. 172.19.148.18  

参数:

fping Option Description
-a Lists targets that responded
-A Lists targets by address instead of hostname
-b Sends bytes of data per ICMP packet (default 56)
-B Tells fping to wait times longer for a reply after each successive failed request (default 1.5)
-c Number of Pings to send to each target (default 1)
-C Same as above but prints additional statistics for each host
-e Displays elapsed time on return packets
-f Reads the target list from (use "-" for standard input)
-g Tells fping to generate a target list by specifying the start and end address (ex. ./fping -g 192.168.1.0 192.168.1.255) or an IP/subnet mask (ex. ./fping -g 192.168.1.0/24)
-i Interval (in milliseconds) to wait between Pings (default 25)
-l Sends Pings forever
-m Pings multiple interfaces on target host
-n Displays targets by name (-d is equivalent)
-p Interval (in milliseconds) between Pings to an individual target (in looping and counting modes, default 1000)
-q Doesn't show per-target/per-Ping results
-Q Same as -q, but show summary every seconds
-r When a host doesn't respond, retries the host times (default 3)
-s Displays summary statistics
-t Timeout (in milliseconds) for individual targets (default 500)
-u Displays targets that are unreachable
-v Displays version number

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...