Server anti-arp spoofing batch processing ARP dual-binding script without temporary files (LZ-Myst Version)

Source: Internet
Author: User

ARP dual-binding script. No temporary files (LZ-Myst version) are listed below and saved as BAT format. Copy codeThe Code is as follows: for/f "tokens = 13" % I in ('ipconfig/all ^ | find "Default Gateway" ') do set GatewayIP = % I
For/f "tokens = 1, 2" % I in ('Arp-a ^ | find "% GatewayIP % "') do if % I = % GatewayIP % arp-s % I % J
For/f "tokens = 15" % I in ('ipconfig/all ^ | find "IP Address" ') do set ip = % I
For/f "tokens = 12" % I in ('ipconfig/all ^ | find "Physical Address" ') do set mac = % I
Arp-s % ip % mac %

Note: The above code may cause some problems in actual application, because if there is an ARP virus machine in the LAN, it will continuously send spoofing packets, therefore, a problem occurs when the gateway is automatically obtained. For this reason, another code is modified to write the MAC address of the real gateway. You do not need to write the IP address of the real gateway. The Code is as follows.

Change the red letter in the following code box to your real MAC address !!!
The MAC address format is: 00-14-78-32-14-f2, which is the format displayed by ARP-.Copy codeThe Code is as follows: for/f "tokens = 13" % I in ('ipconfig/all ^ | find "Default Gateway" ') do set GatewayIP = % I
Arp-s % GatewayIP % real gateway MAC
For/f "tokens = 15" % I in ('ipconfig/all ^ | find "IP Address" ') do set ip = % I
For/f "tokens = 12" % I in ('ipconfig/all ^ | find "Physical Address" ') do set mac = % I
Arp-s % ip % mac %

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.