Simplify CureIt update process with AutoIt


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.

Creating wrapper

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

Initial setup:

  • 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[0]&"/"&$f[1]&"/"&$f[2]&' '&$f[3]&':'&$f[4]&':'&$f[5]
    $since = _DateDiff("h", $f, _NowCalc())
    TrayTip("CureIt", "Last updated " & $since & " hours ago", 10)

If CureIt executable is present then calculate how long ago it was last modified.

If Not FileExists($cureit) Or $since >= $update Then
    TrayTip("CureIt", "Attempting update", 10)
    If InetGet($url, $cureit, 1) Then
        TrayTip("CureIt", "Update succesful", 10)
        TrayTip("CureIt", "Update failed", 10)

If CureIt not present or update is needed then back it up and attempt to download latest version.

If FileExists($cureit) Then ShellExecute($cureit)

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.

Script https://www.rarst.net/script/cureitupdater.au3

Related Posts


  • Altiris_Grunt #

    Awesome script! I'm gonna try it with "Portable AutoIt": http://www.softpedia.com/get/PORTABLE-SOFTWARE/System/System-Enhancements/Windows-Portable-Applications-Portable-AutoIt.shtml This combo promises to be a great addition to my thumb-drive tool box!
  • Rarst #

    @Altiris_Grunt Glad you like it. :) Actually AutoIt is natively portable, version with install is just for convenience and setting file associations (myself I do that manually). By the way you can simply compile this script into executable and it won't need AutoIt to run at all.