Put the following code. Save as Doarp.bat to add to Autorun.
Copy Code code as follows:
@echo off
If%~n0==arp exit
If%~n0==arp exit
If%~n0==arp exit
Echo is getting native information .....
: IP
for/f "skip=13 tokens=15 usebackq"%%i in (' Ipconfig/all ') do Set ip=%%i && GOTO MAC
: MAC
Echo ip:%ip%
for/f "skip=13 tokens=12 usebackq"%%i in (' Ipconfig/all ') do Set mac=%%i && GOTO Gateip
: Gateip
Echo mac:%mac%
Arp-s%ip%%mac%
ECHO is getting gateway information .....
for/f "skip=17 tokens=13 usebackq"%%i in (' Ipconfig/all ') do Set gateip=%%i && GOTO Gatemac
: Gatemac
Echo ip:%gateip%
for/f "skip=3 tokens=2 usebackq"%%i in (' Arp-a%gateip% ') do Set gatemac=%%i && GOTO Start
: Start
Echo mac:%gatemac%
Arp-d
Arp-s%gateip%%gatemac%
echo Operation completed!!!
Exit
Attached below is a detailed description:
This script is an anti-ARP attack, manually adding native IP, mac and gateway IP, MAC program
If%~n0==arp exit
If%~n0==arp exit
If%~n0==arp exit//judgment if the infection has been exited
Echo is getting native information .....
: IP
for/f "skip=13 tokens=15 usebackq"%%i in (' Ipconfig/all ') do Set ip=%%i && GOTO MAC
: MAC
Echo ip:%ip%
for/f "skip=13 tokens=12 usebackq"%%i in (' Ipconfig/all ') do Set mac=%%i && GOTO Gateip
: Gateip
Echo mac:%mac%
Arp-s%ip%%mac%
Get the native IP and Mac, as indicated above. where Arp-s%ip%%mac% to add native Ip/mac to the native ip/mac corresponding table.
ECHO is getting gateway information .....
for/f "skip=17 tokens=13 usebackq"%%i in (' Ipconfig/all ') do Set gateip=%%i && GOTO Gatemac
: Gatemac
Echo ip:%gateip%
for/f "skip=3 tokens=2 usebackq"%%i in (' Arp-a%gateip% ') do Set gatemac=%%i && GOTO Start
: Start
Echo mac:%gatemac%
Arp-d
Arp-s%gateip%%gatemac%
This is the IP/MAC address of the gateway, where Arp-s%gateip%%gatemac% is loading the IP and Mac of the gateway into the native counterpart table.