ARP virus prevents ARP virus Batch Processing

Source: Internet
Author: User

CopyCode The Code is as follows: @ echo off
:::::::::::::::::::::::::::::::::::::::: ::::::::::::
: Batch Processing of binding local hosts, gateway IP addresses, and MAC addresses Program ::
:::::::::::::::::::::::::::::::::::::::: ::::::::::::
ARP-d
:::::::::: Read the MAC address of the Local Machine
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 the IP address of the Local Machine
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 the local IP address and MAC address
ARP-S % IP % Mac %
:::::::::: Read the gateway address
If exist already ip.txt del already ip.txt
Find "Default Gateway" ipconfig.txt> gateip.txt
For/F "Skip = 2 tokens = 13" % G in (ip.txt) do set destination IP = % G
:::::::::: Get the MAC address of the Gateway
Ping 192.168.0.1-N 1
:::::::::: Read the MAC address of the gateway.
If exist gatemac.txt del gatemac.txt
ARP-A % slave IP %> gatemac.txt
For/F "Skip = 3 tokens = 2" % H in (gatemac.txt) do set hosts MAC = % H
::::::::: Bind the gateway MAC address and IP address
ARP-S % gateip % gatemac %
Del paiip.txt
Del gatemac.txt
Del ipaddr.txt
Del ipconfig.txt
Del phyaddr.txt
Exit

Copy the above Code and save it as a bat file. Load it to the startup item, so that it can be protected!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.