Jump to content

Getting latest software versions


Recommended Posts

I'm planning on writing a script that will check to see if my installer library of several dozen programs (I do a lot of installs for clients >.>) is up to date. I've been looking at using _IEBodyReadText and regular expressions to determine the latest version available, then comparing that against the current installer version. I'm sitting here thinking that this is way too complicated, and that there has to be an easier way to do it...but I can't find anything that fits. I figured I'd ask here and see if anybody had an idea or two that'd be helpful xD

Link to comment
Share on other sites

I'm planning on writing a script that will check to see if my installer library of several dozen programs (I do a lot of installs for clients >.>) is up to date. I've been looking at using _IEBodyReadText and regular expressions to determine the latest version available, then comparing that against the current installer version. I'm sitting here thinking that this is way too complicated, and that there has to be an easier way to do it...but I can't find anything that fits. I figured I'd ask here and see if anybody had an idea or two that'd be helpful xD

One thing you could do is replace _IE functions with INetRead. Which will be an improvement in terms of speed.

Options to make the script less complicated depend largely on how new releases of each program become public and as such It's hard to help you with it without knowing which programs you want to check.

If you could post the programs you want to automate here you might get some thoughts on them.

A few things that you might be able to use are:

RSS feeds for releases.

A structured FTP site. Like this

It's not uncommon for websites to have a current version file somewhere. Finding it is often problematic though.

Link to comment
Share on other sites

The way i do this is with this

http://ketarin.canneverbe.com/

I can set my programs in the program even with file renaming and 7zip unpacking via cmdline and just whack the update button and your done.

Then i have a non changing name with always updatable file so easy to work with.

Then i have my autoit install scripts work from there

Chimaera

Link to comment
Share on other sites

The way i do this is with this

Yep I do most of mine that way as well. Ketarin is a great program!!!

But sometimes you want the script to do it for you.

This script extract gives the latest version of MalwareBytes as long as they don't change their site.

Func MalwareBytes_GetNewVerison()
    ; Failure:  returns ""
    ;           @error = 1 - Unable to read page
    ;           @error = 1 - Unable to extract Version number
    Local $sPageSource
    Local $asNewversion
    Static $newVersion = ""
    If $newVersion = "" Then
        ;Get Current Version From The WebSite
        $sPageSource = INetRead("http://www.malwarebytes.org/mbam.php",1)
        If @error Then
            Return SetError(1, 0, "")
        EndIf

        ;<li><b>Version:</b> 1.50</li>
        $asNewVersion = StringRegExp(BinaryToString($sPageSource), '(?s)(?i)<b>Version:</b> (.*?)</li>', 3)
        If @error Then
            Return SetError(2, 0, "")
        EndIf
        $newVersion = $asNewVersion[0]
    EndIf
    Return $newVersion
EndFunc

Good Luck

John Morrison

Drop me an IM if you need any help.

Link to comment
Share on other sites

This script extract gives the latest version of MalwareBytes as long as they don't change their site.

That was exactly the problem that started me using Ketarin

At least the program can cope with changes to filenames for eg AVG with the revisions in the filename and it can be used from filehippo which helps

Just a damn good program

Link to comment
Share on other sites

That was exactly the problem that started me using Ketarin

At least the program can cope with changes to filenames for eg AVG with the revisions in the filename and it can be used from filehippo which helps

Just a damn good program

Do you mean like this :)

YUCK..... just realised it does need work done to it and now that I know how to do "some" (very little regex) it can be streamlined..

Double YUCK..... it needs a LOT of work... sigh.. well at least it works. :)

When I've got some time I'll clean it up... :P

Func FileHippoDownload($sProgramTitle, $sDownloadPathAndName)
    ; John Morrison AKA Storm-E
    ; $sProgramTitle    - the title of the program as it appears in the URL
    ;                   - "malwarebytes_anti_malware" from http://filehippo.com/download_malwarebytes_anti_malware/
    ; $sDownloadPathAndName - the full path and name for the file to be downloaded to
    Local $_DownloadUrl1
    Local $sBaseSite = 'http://filehippo.com'
    Local $sBaseFolder = '/download_' & $sProgramTitle & '/'
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sBaseFolder = ' & $sBaseFolder & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

    Local $_String = _GetSourceCode($sBaseSite & $sBaseFolder)
    If Not @error Then
        ;<a href="/download_malwarebytes_anti_malware/download/f9c81a8e689661f472f47aa7a0b12ada/"><img src="http://cache.filehippo.com/img/down5.png" alt="Download"/></a>
        $_DownloadUrl1 = StringMid($_String, StringInStr($_String, '<a href="' & $sBaseFolder & 'download/') + 9)
        $_DownloadUrl1 = StringLeft($_DownloadUrl1, StringInStr($_DownloadUrl1, '"><img src="http:') - 1)
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_DownloadUrl1 = ' & $_DownloadUrl1 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
        $_String = _GetSourceCode($sBaseSite & $_DownloadUrl1) ; downlaod page
        If Not @error Then
            ;<a id="_ctl0_contentMain_lnkURL" class="black" href="/download/file/de709ff1117ec419609d7fceecd86e625fe523b1385fa00515aa824249206a40/">If not then please click this link</a>
            $_DownloadUrl1 = StringMid($_String, StringInStr($_String, 'href="/download/file/') + 6)
            $_DownloadUrl1 = StringLeft($_DownloadUrl1, StringInStr($_DownloadUrl1, '">If not then please click this link</a>') - 1)
            ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_DownloadUrl1 = ' & $_DownloadUrl1 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Consol       Else

            ; DOWNLOAD FILE
            Local $hDownload = InetGet($sBaseSite & $_DownloadUrl1, $sDownloadPathAndName, 1, 0)
            If @error Then
                MsgBox(0, "ERROR:", "Download Failed" & @CR & "URL = " & $sBaseSite & $_DownloadUrl1 & @CR & "Path = " & $sDownloadPathAndName)
            EndIf
        Else
            ; Unable to access download page
            MsgBox(0, "ERROR:", "Unable to access Download page")
            Exit
        EndIf
    Else
        ; Unable to download first page
        MsgBox(0, "ERROR:", "Unable to access first page")
        Exit
    EndIf

EndFunc   ;==>FileHippoDownload

Func _GetSourceCode($_Url)
    Local $_InetRead = InetRead($_Url)
    If Not @error Then
        Local $_BinaryToString = BinaryToString($_InetRead)
        If Not @error Then Return $_BinaryToString
    EndIf
EndFunc   ;==>_GetSourceCode

and here is the download for MalwareBytes

Func MalwareBytes_Download()
    Return FileHippoDownload("malwarebytes_anti_malware", $downloadFolder & "\mbam-setup.exe")
EndFunc   ;==>MalwareBytes_incDownload

I found out about FileHippo after I had created the version function. I haven't had the time or reason to move the code over to useing FileHippo but it would be a good idea...

ALSO I only found filehippo from Ketarin. :D

That being siad I use Ketarin myself. This is more for the situation where you send a script out into the big wide world and it has to fend for itself.

John Morrison

aka

Storm-E

Edited by storme
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...