Molet

Fping:一个多主机同时ping扫描程序

Molet 安全防护 2023-01-10 371浏览 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地址按每行一个的格式写入,如下所示:

192.168.51.1 
192.168.51.2 
192.168.51.3 
... 
192.168.51.253 
192.168.51.254

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

[root]$fping–a–fin.txt 
192.168.1.254isalive 
192.168.1.227isalive 
192.168.1.224isalive 
... 
192.168.1.3isalive 
192.168.1.2isalive 
192.168.1.1isalive 
192.168.1.190isalive

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:

[root@Meil_88root]#vihosts 
 
172.19.148.1 
172.19.148.2 
172.19.148.3 
172.19.148.18

参数:

fping Option Description
-a Lists targets that responded
-A Lists targets by address instead of hostname
-b <num> Sends <num> bytes of data per ICMP packet (default 56)
-B <f> Tells fping to wait <f> times longer for a reply after each successive failed request (default 1.5)
-c <num> Number of Pings to send to each target (default 1)
-C <num> Same as above but prints additional statistics for each host
-e Displays elapsed time on return packets
-f <file> Reads the target list from <file> (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 <num> 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 <num> 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 <num> Same as -q, but show summary every <num> seconds
-r <num> When a host doesn’t respond, retries the host <num> times (default 3)
-s Displays summary statistics
-t <num> Timeout (in milliseconds) for individual targets (default 500)
-u Displays targets that are unreachable
-v Displays version number

继续浏览有关 安全 的文章
发表评论