主动信息搜索 —二层发现

一、基本概念

二层发现,数据链路层,使用ARP协议

使用场景:已经取得一台主机,进入内网,对内网进行渗透

优点:扫描速度快,可靠

缺点:不可路由,只能扫同网段

掌握多种工具,以适应不同环境

二、工具介绍

1.1 arping

arping 192.168.42.1 -c  1 #-c 指定发包数量

arping 192.168.42.1 -d #发现重复响应,可发现ARP欺骗(若发现不同的mac地址)

1.2 arping.sh

#!/bin/bash

if [ "$#" -ne 1 ];then       #-ne 1 参数不等于为1

  echo "Usage - ./arping.sh [interface]"

  echo "Excample - ./arping.sh eth0"

  echo "Example will perform an ARP scan of the local subnet to which eth0 is assigned"

  exit

fi

interface=$1             #输入的一个值,,赋值给interface变量

prefix=$(ifconfig $interface | grep "inet " | cut -d 't' -f 2 | cut -d '.' -f 1-3)

                         #取IP地址的前缀,如:192.168.1          

for addr in $(seq 1 254);

do

arping -c 1 $prefix.$addr | grep "bytes from" | cut -d" " -f 5 | cut -d "(" -f 2 | cut -d")" -f 1 >>add.txt

                         #>>输出到一个文本文件

done

1.3 arcing1.sh

#!/bin/bash

if [ "$#" -ne 1 ];then

  echo "Usage - ./arping.sh [interface]"

  echo "Excample - ./arping.sh file"

  echo "Example will perform an ARP scan of the local subnet to which eth0 is assigned"

  exit

fi

file=$1

for addr in $(cat $file);do

   arping -c 1 $addr | grep "bytes from" | cut -d" " -f 5 | cut -d "(" -f 2 | cut -d")" -f 1

done

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值