LanYunのBlog

LanYunのBlog

马上订阅 LanYunのBlog RSS 更新: https://lanyundev.com/atom.xml

Mac下ARP攻击浅记

2022年4月13日 00:33

前言

本教程以Macos环境为例,其他操作系统请自行参考.以下内容写的比较顺我的心.言外之意:我随便写的,为的是方便我自己

另外如果你是Mac用户,你需要有相应的系统环境,如果你环境从来没有安装过或者没有,需要进行以下操作:

  1. 安装 macports (macports官网)

  2. 更新 macports , sudo port -d selfupdate

  3. 安装 arspoof , curl -LJO https://github.com/YeautyYE/arpspoof/releases/download/2.4b1%2Bdebian-29/arpspoof && chmod a+x arpspoof && mv arpspoof /usr/local/bin/ && sudo arpspoof项目链接 # 后面内容可以不用看.如果可以 也安装 dsniff(包含 arp 攻击的工具)sudo port install dsniff`就安装吧,kail下有dsniff工具,但这个工具太远古了,本人MBP装不上垃圾东西,我尝试过修复,但修不好..所以这里选择#前的替代方案.

  4. 安装 ettercap , brew install ettercap && brew install adwaita-icon-theme # 可选:adwaita-icon-theme # 如果你觉得按钮有问题无所谓的话,也可以选择不安装 adwaita-icon-theme.

  5. 安装 nmap , brew install nmap

上面👆的内容看不懂?对不起,这个不是纯小白能看的内容,如果你连homebrew都没装,ARP协议及欺骗原理,网关等等都不知道的话,建议你还是马上关闭这个网页吧.会浪费你的时间.


开启网卡(一般不需要)

1
sudo chmod 777 /dev/bpf*

查看目标主机的ARP缓存记录的网关IP以及mac地址(顺便看一下en*端口): 如果出现批量重复mac地址,很有可能你在运行或运行过arpspoof命令,出现这种情况时mac地址不采用(因为不可信,nmap查出来的较为可信)

1
arp -a

查询本机各个网卡名的mac地址,本机IP等信息

1
ifconfig

以网关192.168.1.1为例,使用 ping 方式扫描(不准确,但快),192.168.1.1/24”表示扫描”192.168.1.1-192.168.1.254”这个网段的所有机器。

1
nmap -sP 192.168.31.1/24

注:nmap功能非常强大,这里不详细说.

Mac下查询本机地址及网关地址(顺带看一下子网掩码):
Linux呢?我不知道🤷‍♂️诶才怪,Linux的是 route -n

1
netstat -nr # 或者ifconfig +网络接口名 eg: ifconfig en0

Routing table flags

The following table describes the Flags column in the netstat -rn output:

FlagDescription
UUp—Route is valid
GGateway—Route is to a gateway router rather than to a directly connected network or host
HHost name—Route is to a host rather than to a network, where the destination address is a complete address
RReject—Set by ARP when an entry expires (for example, the IP address could not be resolved into a MAC address)
DDynamic—Route added by a route redirect or RIP (if routed is enabled)
MModified—Route...

剩余内容已隐藏

查看完整文章以阅读更多