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 realize batch processing to prevent arp virus

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to achieve batch processing to prevent arp virus, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The code is as follows:

@ echo off

:::

Native and gateway IP and MAC address binding batch programs:

:::

Arp-d

Read native Mac address

If exist ipconfig.txt del ipconfig.txt

Ipconfig / all > ipconfig.txt

If exist phyaddr.txt del phyaddr.txt

Find "Physical Address" ipconfig.txt > phyaddr.txt

For / f "skip=2 tokens=12"% M in (phyaddr.txt) do set Mac=%%M

Read native ip address

If exist IPAddr.txt del IPaddr.txt

Find "IP Address" ipconfig.txt > IPAddr.txt

For / f "skip=2 tokens=15"% I in (IPAddr.txt) do set IP=%%I

Bind native IP address and MAC address

Arp-s% IP%% Mac%

Read gateway address

If exist GateIP.txt del GateIP.txt

Find "Default Gateway" ipconfig.txt > GateIP.txt

For / f "skip=2 tokens=13" G in (GateIP.txt) do set GateIP=%%G

: get the gateway MAC address

Ping 192.168.0.1-n 1

Read gateway Mac address

If exist GateMac.txt del GateMac.txt

Arp-a% GateIP% > GateMac.txt

For / f "skip=3 tokens=2"% H in (GateMac.txt) do set GateMac=%%H

Bind gateways Mac and IP

Arp-s% GateIP%% GateMac%

Del GateIP.txt

Del GateMac.txt

Del IPAddr.txt

Del ipconfig.txt

Del phyaddr.txt

Exit

Thank you for reading this article carefully. I hope the article "how to achieve batch processing to prevent arp virus" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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