Gatos Posted October 19, 2012 Share Posted October 19, 2012 Hey 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. expandcollapse popup;--------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" DO ;-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 $string=FileOpen("C:\ARP.txt",0) $text=FileReadLine($string, 4) $text=StringTrimRight($text,15) $text=StringTrimLeft($text,24) ;-----check the original MAC $string=FileOpen("C:\ARPOG.txt",0) $text2=FileReadLine($string, 4) $text2=StringTrimRight($text2,15) $text2=StringTrimLeft($text2,24) ;-----Compares the two macs if $text=$text2 Then $time=5000 Else 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) sleep(5000) $comand=" /c arp " $comand=$comand&$IP&" -g>C:\ARP.txt" $time=100 EndIf 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? Link to comment Share on other sites More sharing options...
BrewManNH Posted October 19, 2012 Share Posted October 19, 2012 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Gatos Posted October 19, 2012 Author Share Posted October 19, 2012 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 Link to comment Share on other sites More sharing options...
JohnOne Posted October 19, 2012 Share Posted October 19, 2012 And you are re-declaring $time Global in the loop also. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now