• arping


    arping实现了简单的二层发现,即基于物理层和链路层的发现。由于没有ip层的参与,所以是不可路由的。优点是速度快,准确性高;缺点是不可路由,无法发现局域网以外的主机。

    命令基本格式:arping 192.168.1.1 -c n

    -c参数指定发送arp数据包的个数。

    arping命令无法一次性实现多个ip的扫描,但是可以配合shell脚本实现整个局域网的扫描。

     1 #!/bin/bash
     2 if [ "$#" -ne 1 ];then
     3     echo "Usage ./arping.sh [interface]"
     4     echo "Example: ./arping.sh eth0"
     5     echo "Example will perform an ARP scan of the loal subnet to while eth0 is assigned"
     6     exit
     7 fi
     8 interface=$1
     9 prefix=$(ifconfig $interface | grep "inet" | grep "broadcast" | cut -d " " -f 10 | cut -d "." -f 1-3)
    10 for addr in $(seq 1 254);do
    11     arping -c 1 $prefix.$addr | grep "Unicast" | cut -d " " -f 4
    12 done
    查看代码

    其中取出本地ip时要注意根据ifconfig eth0的输出来定制切割语句。

  • 相关阅读:
    (原创) mac 10.9.2 eclipse 的 CDT 的 异常的修复
    (转) Virtual function
    (转) ROS NAMING AND NAMESPACES
    (转) Data structures
    (转) Dynamic memory
    java string类
    eclipse 的快捷键
    java抽象类和接口
    面向对象的三大特征
    Java 中的多态
  • 原文地址:https://www.cnblogs.com/angiejc/p/9383798.html
Copyright © 2020-2023  润新知