parameters - NMAP 连续 ping

标签 parameters cycle ping continuous nmap

我需要实现一个代码,它能够每秒向一定数量的目的地发送 ping 数据包。问题是我想在 1 秒窗口内 ping 尽可能多的目的地。出于这个原因,我在想是否有一种方法可以将循环强加到 nmap [我的意思是 -cycle nmap 参数] 这样套接字只会打开一次并在循环 ping 结束时关闭,这比使用 a “观看nmap”方法!

最佳答案

Nmap 项目的一部分是 Nping tool .它旨在完全满足您的需求,并且非常可配置。这是一个示例运行:

$ sudo nping --rate 4 --icmp 192.168.1.4/30

Starting Nping 0.6.26SVN ( http://nmap.org/nping ) at 2013-02-08 11:53 CST
SENT (0.0192s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (0.2692s) ICMP 192.168.1.142 > 192.168.1.6 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (0.5193s) ICMP 192.168.1.142 > 192.168.1.7 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (0.7695s) ICMP 192.168.1.142 > 192.168.1.4 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (1.0196s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (1.2701s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
RCVD (1.2707s) ICMP 192.168.1.5 > 192.168.1.142 Echo reply (type=0/code=0) ttl=64 id=34160 iplen=28 
SENT (1.5206s) ICMP 192.168.1.142 > 192.168.1.7 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (1.7708s) ICMP 192.168.1.142 > 192.168.1.4 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (2.0209s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (2.2712s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
RCVD (2.2717s) ICMP 192.168.1.5 > 192.168.1.142 Echo reply (type=0/code=0) ttl=64 id=34161 iplen=28 
SENT (2.5216s) ICMP 192.168.1.142 > 192.168.1.7 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (2.7717s) ICMP 192.168.1.142 > 192.168.1.4 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (3.0219s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
SENT (3.2724s) ICMP 192.168.1.142 > 192.168.1.5 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
RCVD (3.2730s) ICMP 192.168.1.5 > 192.168.1.142 Echo reply (type=0/code=0) ttl=64 id=34162 iplen=28 
SENT (3.5230s) ICMP 192.168.1.142 > 192.168.1.7 Echo request (type=8/code=0) ttl=64 id=53659 iplen=28 
^C 
Statistics for host 192.168.1.4:
 |  Probes Sent: 4 | Rcvd: 0 | Lost: 4  (100.00%)
 |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
Statistics for host 192.168.1.5:
 |  Probes Sent: 4 | Rcvd: 3 | Lost: 1  (25.00%)
 |_ Max rtt: 0.391ms | Min rtt: 0.263ms | Avg rtt: 0.332ms
Statistics for host 192.168.1.6:
 |  Probes Sent: 4 | Rcvd: 0 | Lost: 4  (100.00%)
 |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
Statistics for host 192.168.1.7:
 |  Probes Sent: 3 | Rcvd: 0 | Lost: 3  (100.00%)
 |_ Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
Raw packets sent: 15 (420B) | Rcvd: 3 (138B) | Lost: 12 (80.00%)
Tx time: 3.57078s | Tx bytes/s: 117.62 | Tx pkts/s: 4.20
Rx time: 3.57078s | Rx bytes/s: 38.65 | Rx pkts/s: 0.84
Nping done: 4 IP addresses pinged in 3.59 seconds

关于parameters - NMAP 连续 ping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14777840/

相关文章:

c# - 如何为类集属性传递参数(不是类声明)

c# - 无法将 C# 字典作为参数传递给 ironPython 方法

c++ - 如何在图中找到 3 条边的负加权循环?

java - isReachable 给出奇怪的结果

linux - 为什么我无法使用静态 ip ping 到任何地址?

matlab - 在 Matlab 中传递参数

Python:(显式)字符串参数会损害性能吗?

C# 以编程方式执行 TNSPing

javascript - 使下一个按钮从当前 "number"继续

oracle - 即使指定了 STARTWITH 100,序列也会在达到 MAXVALUE 后从 1 开始