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

安全
fping是一款类似ping(1)(ping(1)是通过ICMP(网络控制信息协议Internet Control Message Protocol)协议回复请求以检测主机是否存在)的程序。

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 <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

责任编辑:佟健 来源: 飞诺网
相关推荐

2019-04-25 05:35:30

ping网络命令

2023-04-04 12:24:10

2010-05-06 16:40:47

Unix SUID

2020-06-12 07:53:56

程序员语言代码

2020-02-22 21:51:43

程序员Microsoft SServerSQL

2023-03-10 13:38:00

Python文档扫描器

2015-05-06 13:39:15

Windows系统复杂

2019-03-06 09:15:11

ping网络华云数据

2011-08-17 10:28:53

多对多查询SQL Server

2020-11-10 07:13:44

端口号进程

2021-04-19 11:16:17

小程序微信开发

2011-05-11 10:58:39

iOS

2014-01-06 09:33:32

程序员管理

2015-03-06 09:44:11

微软Azure谷歌云谷歌应用引擎

2010-03-02 13:35:59

Fedora apac

2021-09-28 09:07:21

云计算主机托管云服务

2009-10-14 09:58:43

VB.NET程序

2012-10-29 09:51:17

科技公司创业程序员

2020-10-05 21:13:37

程序员技能开发者

2018-04-20 09:24:08

Hbase存储注意点
点赞
收藏

51CTO技术栈公众号