Server anti-ARP spoofing batch ARP Double bind script no temporary files (lz-myst version) _dos/bat

Source: Internet
Author: User
ARP double bind script, no temporary file (lz-myst version) horizontal below, save in BAT format can be used.
Copy Code code 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
for/f "Tokens=15"%%i in (' Ipconfig/all ^|find IP addresses ') do set ip=%%i
for/f "Tokens=12"%%i in (' Ipconfig/all ^|find ' Physical address ') do set mac=%%i
Arp-s%ip%%mac%

Note that the above code in the actual application will have some problems, because if the local area network if there is an ARP virus in the machine, he will continue to send cheat packets, so the automatic access to the gateway will be problematic, to modify another piece of code, handwritten real Gateway MAC address. You do not need to write the IP address of the real gateway. The code is as follows.

Change the red word in the following code box to your real MAC address!!!
The MAC address format is: 00-14-78-32-14-F2 is the ARP-A display format.
Copy Code code as follows:

for/f "tokens=13"%%i in (' Ipconfig/all ^|find ' Default Gateway ') do set Ga Tewayip=%%i
Arp-s%gatewayip% Real Gateway mac
for/f "Tokens=15"%%i in (' Ipconfig/all ^|find IP address ') do set ip=%%i
F or/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.