Jump to content
Sign in to follow this  

Anti ARP spoofing

Recommended Posts



I'm trying to make a simple script that will protect my computers against ARP spoofing and avoiding dowloading third party programs like Xarp.

I've managed to write the script but now I'm having the problem that when the script runs it accumulates space usage on the RAM.

The scrip is only 4Kb (compared to Xarp@4mb) and uses at first 2-3mb of ram but after a while it grows to 15mb++. it seems to grow after every cmd comands so that might be the problem, since I'm new to autoit, I don't know what to do.

;--------Run the script when you are pretty sure you are not being poisoned
$comand=" /c arp "
$IP=InputBox("Routers IP","Please enter the Routers IP:","","",177,130)
$comand=$comand&$IP&" -g>C:\ARPOG.txt"

;Sets the comand string to create the second text file
$cmd = Run(@Comspec & $comand, "", @SW_HIDE)
$comand=" /c arp "
$comand=$comand&$IP&" -g>C:\ARP.txt"

;-This will create a secon txt file for detecting any MAC adress changes
$cmd = Run(@Comspec & $comand, "", @SW_HIDE)
global $time
sleep ($time)
;---Reads the new text to compare it with the Original MAC
$text=FileReadLine($string, 4)

;-----check the original MAC
$text2=FileReadLine($string, 4)

;-----Compares the two macs
if $text=$text2 Then
MsgBox(0,"ALERT!","Original Routers MAC was:"&$text2&": now :"&$text&" Cleaning ARP table and checking if it still doesn't maches")
$comand=" /c arp "
$comand=$comand&$IP&" -d"
$cmd = Run(@Comspec & $comand, "", @SW_HIDE)
$comand=" /c arp "
$comand=$comand&$IP&" -g>C:\ARP.txt"
local $exit=0
until $exit=1

Is there a way to make it stop using RAM space?, or is it because of the way it's coded?

Share this post

Link to post
Share on other sites

Well one thing I see is you're opening the files every time through the loop using FileOpen, you should only need to do this one time for each file, just open it and then read from it. Also, if you can't do it that way, then you need to use FileClose at the end of the loop before it goes back to the start of it, you're never closing the files you just opened.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post

Link to post
Share on other sites

hehe yeah sorry about that, a few minutes after I posted that I thought of that and yeah it was because I was opening the files witouth closing them.

Thanks anyways :D

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this