一.基礎(chǔ)概念
二層發(fā)現(xiàn),數(shù)據(jù)鏈路層滋早,使用ARP協(xié)議
使用場景:已經(jīng)取得一臺主機(jī)榄审,進(jìn)入內(nèi)網(wǎng),對內(nèi)網(wǎng)進(jìn)行滲透
優(yōu)點:掃描速度快杆麸,可靠
缺點:不可路由搁进,只能掃同網(wǎng)段
掌握更多工具,以適應(yīng)不同環(huán)境
二.工具使用
- arping
arping 192.168.1.1 -c 1 #-c 指定發(fā)包數(shù)量
arping 192.168.1.1 -d #發(fā)現(xiàn)重復(fù)響應(yīng)昔头,可發(fā)現(xiàn)ARP欺騙(若發(fā)現(xiàn)不同的mac地址)
arping -c 1 192.168.1.1 | grep "bytes from" | cut -d" " -f 5 | cut -d "(" -f 2 | cut -d")" -f 1 #只保留ip信息
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 #掃描一個ip范圍
2.shell腳本
#!/bin/bash
if [ "$#" -ne 1 ];then
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
prefix=$(ifconfig $interface | grep "inet " | cut -d 't' -f 2 | cut -d '.' -f 1-3)
done
從文件中讀取ip
#!/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
3.nmap
nmap -sn 192.168.1.0/24 #-sn 不做端口掃描拷获,不僅僅發(fā)arp包,還會做ptr記錄解析
nmap -iL arp.txt -sn #指定文件掃描
4.Netdiscover
主動式
netdiscover -i eth0 -r 1.1.1.0/24 #-i指定網(wǎng)卡
netdiscover -l iplist.txt #指定文件
被動式
避免被發(fā)現(xiàn)减细,不主動發(fā)arp包匆瓜,原理:使用混雜模式,收取非本網(wǎng)卡IP/MAC的數(shù)據(jù)包,基于廣播驮吱,默默等待并記錄茧妒。準(zhǔn)確程度與主動無差,響應(yīng)速度慢些(但網(wǎng)絡(luò)中左冬,主機(jī)發(fā)arp包的次數(shù)比較常見桐筏,時間不會太久)
netdiscover -p #使用被動模式