Last active
May 7, 2021 08:40
-
-
Save James-E-A/b32d1e8f107968ad6113fbadca412f95 to your computer and use it in GitHub Desktop.
Block ARP poisioning (Win10)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo OFF | |
rem TODO: testing on XP and 7 | |
rem TODO: robustness checking | |
rem YOU MUST EDIT THE 3 VARIABLES BELOW TO BE CORRECT: | |
set C_IFACE="Ethernet (1)" | |
set R_MAC="46-7f-2c-af-e2-2b" | |
set R_IP="192.168.0.1" | |
echo Current ARP entry for %R_IP% on "%C_IFACE%": | |
rem TODO: Should I remove the interface= flag and just show all entries? It might make troubleshooting easier in the event that there are some stale static entries stored after the user changes NICs | |
netsh interface ipv4 show neighbors interface=%C_IFACE% | findstr -c:%R_IP% | |
set r=N | |
echo Would you like to delete the static entry? | |
set /p r=(y/N) | |
if /I NOT %r:~0,1% == Y goto skipdel | |
echo Deleting current entry... | |
netsh interface ipv4 delete neighbors %C_IFACE% %R_IP% | |
:skipdel | |
set r=N | |
echo Would you like to add the static entry? | |
set /p r=(y/N) | |
if /I NOT %r:~0,1% == Y goto skipadd | |
echo Adding new entry... | |
netsh interface ipv4 add neighbors %C_IFACE% %R_IP% %R_MAC% | |
:skipadd | |
echo Current ARP entry for %R_IP%: | |
netsh interface ipv4 show neighbors address=%R_IP% | findstr -c:%R_IP% | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment