Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement batch processing to prevent arp spoofing and automatically bind gateways

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to implement batch processing to prevent arp spoofing and automatically bind gateways. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Put the following code. Save as doarp.bat and add to autorun.

The code is 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

A detailed description is attached below:

This script is an anti-ARP attack. Add native ip, mac and gateway ip and mac programs manually

If% ~ n0==arp exit

If% ~ n0==Arp exit

If% ~ n0==ARP exit / / decide to quit if it has been infected

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%

/ / as prompted above, get native IP and mac. Arp-s% IP%% MAC% adds native ip/mac to the corresponding table of native 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%

/ / this is the ip/mac address of the gateway, where arp-s% GateIP%% GateMAC% loads the ip and mac of the gateway into the local corresponding table.

Thank you for reading! On "how to achieve anti-arp spoofing and automatic binding gateway batch processing" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report