erifash Posted May 31, 2005 Posted May 31, 2005 (edited) For all of you who are too lazy to download McAfee Stinger yourself (like me ), this will download the latest version for you: expandcollapse popupIf 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 May 31, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
busysignal Posted June 1, 2005 Posted June 1, 2005 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..
powaking Posted February 6, 2006 Posted February 6, 2006 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.. 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.
erifash Posted February 6, 2006 Author Posted February 6, 2006 It probably has been updated. Things like that can frequently break if they change the page layout... My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
BigDod Posted February 6, 2006 Posted February 6, 2006 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
erifash Posted February 6, 2006 Author Posted February 6, 2006 (edited) 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 February 6, 2006 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
powaking Posted February 6, 2006 Posted February 6, 2006 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
erifash Posted February 6, 2006 Author Posted February 6, 2006 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. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now