I had previously covered (and numerously mentioned) DrWeb CureIt which is one of the core anti-malware tools for me. Since it is free promotional tool from company that is in the business of selling software there are some limitations in place.
One of them is having to download CureIt to update it. So I made script in AutoIt to help with that.
CureIt update scheme
App is provided as single executable (which is actually self-extracting and self-running RAR archive) by developer. Version is not encoded in file name so link is always the same.
If app is over few days old on run it will present dialog offering to go and download latest executable. Downloading that file all the time gets boring very fast.
Messing with CureIt package is no use – it just not designed to have update capabilities. So I decided to create wrapper – separate small script that will take care of checking how outdated CureIt is and re-downloading it.
Step by step
#include "Date.au3" $path = @ScriptDir $cureit = $path & "\cureit.exe" $old = $path & "\cureit_old.exe" $update = 24 $url="ftp://ftp.drweb.com/pub/drweb/cureit/cureit.exe"
- going to use some date calculations;
- working in same directory where script is placed;
- two paths for CureIt executable and backup of it (just in case);
- update every 24 hours;
- URL to download CureIt from.
If FileExists($cureit) Then $f = FileGetTime($cureit) $f = $f&"/"&$f&"/"&$f&' '&$f&':'&$f&':'&$f $since = _DateDiff("h", $f, _NowCalc()) TrayTip("CureIt", "Last updated " & $since & " hours ago", 10) EndIf
If CureIt executable is present then calculate how long ago it was last modified.
If Not FileExists($cureit) Or $since >= $update Then FileCopy($cureit,$old,1) TrayTip("CureIt", "Attempting update", 10) If InetGet($url, $cureit, 1) Then TrayTip("CureIt", "Update succesful", 10) Else FileCopy($old,$cureit,1) TrayTip("CureIt", "Update failed", 10) EndIf EndIf
If CureIt not present or update is needed then back it up and attempt to download latest version.
If FileExists($cureit) Then ShellExecute($cureit) Sleep(3*1000) Exit
Launch CureIt and pause for a while so tray message with information doesn’t disappear too fast.
No more rummaging through bookmarks to find that FTP link and download file. :) As always I only show core function and there is lot of potential here – CureIt can be unpacked and after that it supports quite a few command line arguments that can be used to make it do more stuff fully automated.