Sign in to follow this  
Followers 0
chaos945

File Updater

5 posts in this topic

I had this idea today but I don't have time to make it. Perhaps someone with more time wants to try.

I have a USB drive with lots of misc tools on it. Lots of them require constant updates. The idea is to create either a GUI based list, that can easily be added to. Inputting the URL of the location to check for updates, and the location of the current copy of the file on the USB drive. Comparing the file size difference between the two, then downloading the updated file if a size difference is detected. Alternatively one could skip the GUI and just run a simpler script, modifying the list using an INI.

Here is an example of how one might approach the above idea. I created this script to update my portable copy of AntiVir because the build-in updater breaks if the program is not correctly installed. The script checks the URL for a difference in size, it utilizes IZARCE.exe to then extract the ZIP'd file.

If NOT FileGetSize("ivdf_fusebundle_nt_en.zip") = InetGetSize("http://dl.antivir.de/down/vdf/ivdf_fusebundle_nt_en.zip") Then

MsgBox(0, "Avira AntiVir Updater", "Updates found. Please wait...", 5)

FIleDelete("ivdf_fusebundle_nt_en.zip")

InetGet("http://dl.antivir.de/down/vdf/ivdf_fusebundle_nt_en.zip", "ivdf_fusebundle_nt_en.zip", 1, 1)

While @InetGetActive

TrayTip("Downloading AntiVir Updates...", "Bytes = " & @InetGetBytesRead, 10, 16)

Sleep(250)

WEnd

RunWait('IZARCE -e -o "ivdf_fusebundle_nt_en.zip"')

Else

MsgBox(0, "Avira AntiVir Updater", "No updates available.", 5)

EndIf

Run("avcenter.exe")

Exit

Also here are some misc URL's I've collected that I was considering to use with the tool.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

kinda like....

Dim $Ini_File = @ScriptDir & "\YOUR_FILE.ini"
Dim $rFile, $rMsg, $rURL, $rRun, $rExe

$var = IniReadSectionNames($Ini_File)
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
    Exit
Else
    For $i = 1 To $var[0]
        
        $rFile = IniRead($Ini_File, $var[$i], "File", "error") ; "ivdf_fusebundle_nt_en.zip"
        $rMsg = IniRead($Ini_File, $var[$i], "Message", "error") ; "Avira AntiVir"
        $rURL = IniRead($Ini_File, $var[$i], "URL", "error") ; "http://dl.antivir.de/down/vdf/ivdf_fusebundle_nt_en.zip"
        $rRun = IniRead($Ini_File, $var[$i], "Run", "error") ; 'IZARCE -e -o "ivdf_fusebundle_nt_en.zip"'
        $rExe = IniRead($Ini_File, $var[$i], "Exe", "error") ; "avcenter.exe"
        _Check_Updates()
    Next
EndIf

Func _Check_Updates()
    If Not FileGetSize($rFile) = InetGetSize($rURL) Then
        MsgBox(0, $rMsg, "Updates found. Please wait...", 5)
        FileDelete($rFile)
        InetGet($rURL, $rFile, 1, 1)
        While @InetGetActive
            TrayTip("Downloading " & $rMsg & " Updates...", "Bytes = " & @InetGetBytesRead, 10, 16)
            Sleep(250)
        WEnd
        If $rRun <> "error" Then RunWait($rRun)
    Else
        MsgBox(0, $rMsg & " Updater", "No updates available.", 5)
        Return
    EndIf

    If $rExe <> "error" Then Run($rExe) ; maybe RunWait() here

EndFunc   ;==>_Check_Updates

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

That is pretty slick. Thanks.

It took me a minute to wrap my brain around your script, below is an example INI.

[setup]

File=ivdf_fusebundle_nt_en.zip

Message=Avira AntiVir

URL=http://dl.antivir.de/down/vdf/ivdf_fusebundle_nt_en.zip

Run=IZARCE -e -o "ivdf_fusebundle_nt_en.zip

Exe=avcenter.exe

[setup2]

File=ComboFix.exe

Message=ComboFix

URL=http://download.bleepingcomputer.com/sUBs/ComboFix.exe

Run=

Exe=

Share this post


Link to post
Share on other sites

Perfect!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Have a look at InetFileUpdate in my siggy. It may be able to provide some help/ideas.

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  
Followers 0