Jump to content

Stinger Downloader


erifash
 Share

Recommended Posts

For all of you who are too lazy to download McAfee Stinger yourself (like me :( ), this will download the latest version for you:

If not _INetActive() Then Exit
If not FileExists("version.log") Then FileWrite("version.log", " ")

$html = _Download("http://vil.nai.com/vil/stinger/")
$i_version = _Parse($html, ".exe</a> v", " [")
$a_version = _ReadFile("version.log")
$exe = _Parse($html, '<li><a href="http://download.nai.com/products/mcafee-avert/', '">Download')

If $a_version = $i_version Then Exit
INetGet("http://download.nai.com/products/mcafee-avert/" & $exe, @ScriptDir & "\" & $exe)

FileDelete("version.log")
FileWrite("version.log", $i_version)

MsgBox(0, "Stinger Downloader", "McAfee AVERT Stinger v" & $i_version & " has been downloaded to:" & @CRLF & @CRLF & @ScriptDir & "\" & $exe)



Func _INetActive()
    If @IPAddress1 <> "127.0.0.1" Then Return 1
    SetError(1)
    Return 0
EndFunc  ;==>_INetActive()

Func _Parse($sz_str, $sz_before, $sz_after)
    Local $sz_sp1 = StringSplit($sz_str, $sz_before, 1), $sz_sp2 = StringSplit($sz_sp1[$sz_sp1[0]], $sz_after, 1)
    Return $sz_sp2[1]
EndFunc  ;==>_Parse()

Func _Download($sz_url)
    Local $sz_tmpfile = @TempDir & "\~idload.txt"
    If _INetActive() and INetGet($sz_url, $sz_tmpfile) Then
        Local $sz_readtext = _ReadFile($sz_tmpfile)
        FileDelete($sz_tmpfile)
        Return $sz_readtext
    EndIf
    Return ""
EndFunc

Func _ReadFile($sz_filepath)
    If FileExists($sz_filepath) Then Return FileRead($sz_filepath, FileGetSize($sz_filepath))
    SetError(1)
    Return ""
EndFunc

Ahhhh... I love _Parse! :(

Questions/comments are greatly appreciated!

Edited by erifash
Link to comment
Share on other sites

For all of you who are too lazy to download McAfee Stinger yourself (like meĀ  :( ), this will download the latest version for you:

Nice script.. I don't use McAfee products but I like the concept of what you have created. I can be adapted for may other programs to DL.

Cheers.. :(

Link to comment
Share on other sites

  • 8 months later...

Nice script.. I don't use McAfee products but I like the concept of what you have created. I can be adapted for may other programs to DL.

Cheers.. :lmao:

This downloads the version for epo. Has this been updated? Been trying to tweak it to get it to download stng260.exe but it keeps downloading ePOStg256.Zip for what ever reason.

Link to comment
Share on other sites

Link to comment
Share on other sites

This downloads the version for epo. Has this been updated? Been trying to tweak it to get it to download stng260.exe but it keeps downloading ePOStg256.Zip for what ever reason.

If you look at the Avert Tools web page there is no version 2.6 just 2.5.9


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

For some reason my string parsing function was broken when I updated quite a while ago. This one works now for some reason:

#cs
    Positive occurance means search from left
    Zero occurance means last occurance
    Negative occurance means search from right

    ex: MsgBox(0, "expect c", _StringParse("[a][b][c][d][e][f]", "[", "]", -4))
#ce

Func _StringParse( $sString, $sStart, $sEnd, $iOccurance = 0 )
    Local $aA = StringSplit($sString, $sStart, 1), $aB = StringSplit($aA[__Test($iOccurance, __Test($iOccurance > 0, $iOccurance + 1, $aA[0] + $iOccurance + 1), $aA[0])], $sEnd, 1)
    Return $aB[1]
EndFunc

Func __Test( $bBool, $vTrue, $vFalse )
    If $bBool Then Return $vTrue
    Return $vFalse
EndFunc

Just use:

_StringParse($html, '<li><a href="http://download.nai.com/products/mcafee-avert/', '">Download', 1)
Edited by erifash
Link to comment
Share on other sites

For some reason my string parsing function was broken when I updated quite a while ago. This one works now for some reason:

#cs
    Positive occurance means search from left
    Zero occurance means last occurance
    Negative occurance means search from right

    ex: MsgBox(0, "expect c", _StringParse("[a][b][c][d][e][f]", "[", "]", -4))
#ce

Func _StringParse( $sString, $sStart, $sEnd, $iOccurance = 0 )
    Local $aA = StringSplit($sString, $sStart, 1), $aB = StringSplit($aA[__Test($iOccurance, __Test($iOccurance > 0, $iOccurance + 1, $aA[0] + $iOccurance + 1), $aA[0])], $sEnd, 1)
    Return $aB[1]
EndFunc

Func __Test( $bBool, $vTrue, $vFalse )
    If $bBool Then Return $vTrue
    Return $vFalse
EndFunc

Just use:

_StringParse($html, '<li><a href="http://download.nai.com/products/mcafee-avert/', '">Download', 1)

Cool this works. I had modified one for my PE cd which prompted user if proxy was needed. I seemed to have lost my source code for that. This will come in handy. Not even going to attempt to figure out your parser function :lmao:

Link to comment
Share on other sites

Cool this works. I had modified one for my PE cd which prompted user if proxy was needed. I seemed to have lost my source code for that. This will come in handy. Not even going to attempt to figure out your parser function ;)

I'm glad it worked out. My parser function might be complicated, but it gets the job done. :lmao:
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...