zone97 Posted March 30, 2012 Share Posted March 30, 2012 (edited) I want to be able to download super antispyware portable from this link http://www.superantispyware.com/portablescannertech.html.Problem is they have some sort of code so that if you try and get the file directly. IE: http://www.superantispyware.com/sasportable.php it will download the installable version instead. a ".EXE" not ".COM" the only way is to be on there site and click the link from there.My question is can autoit load the page in a suido browser and click the link to download? I have a script I modified that another user created that lets me download several files with one click but I can not add this one. Here is the code I am currently using.expandcollapse popup#include <StaticConstants.au3> #include <GUIConstants.au3> #include <GUIStatusBar.au3> ; 2D array to hold URL and filesize Dim $arrDownload[4][2] Dim $arrFilename[4][2] ; Put the number of elements into element [0][0] $arrDownload[0][0] = UBound($arrDownload)-1 $arrFilename[0][0] = UBound($arrFilename)-1 ; Setup the files to download $arrDownload[1][0] = "http://download.bleepingcomputer.com/protected/ComboFix.exe" $arrDownload[2][0] = "http://download.bleepingcomputer.com/grinler/rkill.com" $arrDownload[3][0] = "http://support.kaspersky.com/downloads/utils/tdsskiller.exe" $arrFilename[1][0] = "combofix.exe" $arrFilename[2][0] = "rkill.com" $arrFilename[3][0] = "tdsskiller.exe" ; ## GUI ###### $Form = GUICreate("Downloader", 400, 200) $butStart = GUICtrlCreateButton("Start", 150, 15, 100, 30) $txtCurrent = GUICtrlCreateLabel("Current File Progress:", 30, 55, 100, 20) $prgCurrent = GUICtrlCreateProgress(30, 75, 300, 10) $lblCurrent = GUICtrlCreateLabel("0%", 340, 72, 30, 15, $SS_RIGHT) $txtOverall = GUICtrlCreateLabel("Overall Progress:", 30, 105, 80, 20) $prgOverall = GUICtrlCreateProgress(30, 125, 300, 10) $lblOverall = GUICtrlCreateLabel("0%", 340, 122, 30, 15, $SS_RIGHT) $StatusBar = _GUICtrlStatusBar_Create($Form) _GUICtrlStatusBar_SetText($StatusBar, "Ready") GUISetState(@SW_SHOW) ; ## END GUI ##### While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit If $nMsg = $butStart Then doDownloads() WEnd Func doDownloads() ; Variables for calculating percentages Local $CurrentFileSize = 0 Local $TotalFileSize = 0 Local $currBytesDownloaded = 0 Local $overallBytesDownloaded = 0 Local $TotalBytesDownloaded = 0 Local $currPercent = 0 Local $overallPercent = 0 Local $Filename = "" Local $currDownload Local $CancelPressed = False ; Change the Start button to Cancel GuiCtrlSetData($butStart, "Cancel") ; Reset all progress data GUICtrlSetData($lblOverall, "0%") GUICtrlSetData($prgOverall, "0") GUICtrlSetData($lblCurrent, "0%") GUICtrlSetData($prgCurrent, "0") ; Loop through all the URLs to get all the FileSizes (this allows us to calculate overall progress of ALL downloads) For $i = 1 To UBound($arrDownload)-1 ; Get the filename from after the last forward slash $FileName = $arrFilename[$i][0] _GUICtrlStatusBar_SetText($StatusBar, 'Getting filesize for file "' & $arrFilename[$i][0] & '"...') ; Put the filesize into second column of array $CurrentFileSize = INetGetSize($arrDownload[$i][0]) ; We're going to use this filesize twice so put it in a variable so we only actually look it up once $arrDownload[$i][1] = $CurrentFileSize ; Add this to the total file size $TotalFileSize += INetGetSize($arrDownload[$i][0]) Next ; Now do the individual downloads For $i = 1 To UBound($arrDownload)-1 ; Reset current bytes $currBytesDownloaded = 0 ; Reset the current progress bar GUICtrlSetData($lblCurrent, "0%") GUICtrlSetData($prgCurrent, "0") ; Get the filename from after the last forward slash $Filename = $arrFilename[$i][0] _GUICtrlStatusBar_SetText($StatusBar, 'Downloading "' & $arrFilename[$i][0] & '" (' & $i & '/' & UBound($arrDownload)-1 & ')...') ; Start the download $currDownload = INetGet($arrDownload[$i][0], @ScriptDir & "" & $arrFilename[$i][0], 0, 1) Do ; Check for messages Local $dMsg = GUIGetMsg() ; If the press the 'Cancel button If $dMsg = $butStart Then ; Check they really want to cancel Local $Confirm_Cancel = MsgBox(4, "Downloader", "Do You Want To Cancel All Downloads?", 0, $Form) ; If they do want to cancel If $Confirm_Cancel = 6 Then ; stop the download INetClose($currDownload) ; notify the outer loop to exit $CancelPressed = True ExitLoop EndIf EndIf ; Get Current Bytes downloaded $currBytesDownloaded = INetGetInfo($currDownload, 0) ; Add current bytes downloaded to the total filesize of completed downloads $overallBytesDownloaded = $TotalBytesDownloaded + $CurrBytesDownloaded ; Get the current percentages $currPercent = ($currBytesDownloaded / $arrDownload[$i][1]) * 100 $overallPercent = ($overallBytesDownloaded / $TotalFileSize) * 100 ; Update the current progress bar GUICtrlSetData($prgCurrent, $currPercent) GUICtrlSetData($prgOverall, $overallPercent) ; Update the progress labels only if they have changed (to avoid flicker) If GUICtrlRead($lblCurrent) <> floor($currPercent) & "%" Then GUICtrlSetData($lblCurrent, Floor($currPercent) & "%") If GUICtrlRead($lblOverall) <> floor($overallPercent) & "%" Then GUICtrlSetData($lblOverall, floor($overallPercent) & "%") WinSetTitle($Form, "", floor($overallPercent) & "% - Downloader") EndIf Until INetGetInfo($currDownload, 2) If Not $CancelPressed Then ; Set current progress to 100% here (sometimes gets stuck at 99 with rounding) GUICtrlSetData($prgCurrent, 100) GUICtrlSetData($lblCurrent, "100%") EndIf ; Add the filesize of this completed download to the total bytes downloaded $TotalBytesDownloaded += $arrDownload[$i][1] ; User cancelled - don't download anything else If $CancelPressed Then ExitLoop Next ; Reset the GUI labels _GUICtrlStatusBar_SetText($StatusBar, "Ready") GUICtrlSetData($butStart, "Start") If $CancelPressed Then ; User cancelled MsgBox(48, "Downloader", "All downloads cancelled", 0, $Form) Else ; everything finished downloading ; Set current progress to 100% here (sometimes gets stuck at 99 with rounding) GUICtrlSetData($prgCurrent, 100) GUICtrlSetData($lblCurrent, "100%") MsgBox(64, "Downloader", "All downloads complete", 0, $Form) EndIf ; Reset the window title WinSetTitle($Form, "", "Downloader") EndFuncany help will be greatly appreciated. Edited March 30, 2012 by zone97 Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
DW1 Posted March 30, 2012 Share Posted March 30, 2012 You could use the _IE functions to click the download as you were asking. I wrote this a while back and used it to grab the latest version of SaS portable, feel free to use it if you would like: #include <Inet.au3> Global $sURL = 'http://www.superantispyware.com/downloads/temp/' $sHTML = _INetGetSource($sURL & '?M=A') $aFiles = StringRegExp($sHTML, '<A HREF="([^?/].*[^?/])">', 3) $sDownloadURL = $sURL & $aFiles[UBound($aFiles) - 1] MsgBox(0,'Download URL', $sDownloadURL) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
zone97 Posted March 30, 2012 Author Share Posted March 30, 2012 I tired your code, but still wants to download the EXE version (installer) they have made some changes to how you get the portable. Thanks however. Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
DW1 Posted March 30, 2012 Share Posted March 30, 2012 (edited) The EXE version that it is downloading is the "Tech Edition" AKA what they used to call portable... it did not launch an installer for me, simply asked a language and I was at the main GUI. EDIT: Did you actually try downloading the file from the URL that my code gives you or did you just see that it was an *.exe file and assumed it was not the portable version. Can somebody else please test my code, because for me, it gives me the url to the latest portable version. Edited March 30, 2012 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
zone97 Posted March 30, 2012 Author Share Posted March 30, 2012 (edited) I played with your script a bit more, some times it will pull the .com and others the .exe, the .exe for me atleast has always been the installer, the .com was indead the portable. could a loop be put in to check that it only gets the .com? Update: Here are 2 entries from the HTML you pull.. <IMG SRC="/icons/unknown.gif" ALT="[ ]"> <A HREF="SAS_9484.EXE">SAS_9484.EXE</A> 30-Mar-2012 16:51 14.9M <IMG SRC="/icons/unknown.gif" ALT="[ ]"> <A HREF="SAS_275A.COM">SAS_275A.COM</A> 30-Mar-2012 16:51 13.7M The size difference + the extention is what lets you know you have the portable vs the installer. Edited March 30, 2012 by zone97 Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
DW1 Posted March 31, 2012 Share Posted March 31, 2012 You can change the regex to get just *.com files, sure, but I am still confused as to how you are getting an installer downloading from my original code in post 2. Anyway, here is the code modified to grab only the com files and return the latest one: #include <Inet.au3> Global $sURL = 'http://www.superantispyware.com/downloads/temp/' $sHTML = _INetGetSource($sURL & '?M=A') $aFiles = StringRegExp($sHTML, '<A HREF="([^?/].*[^?/]COM)">', 3) $sDownloadURL = $sURL & $aFiles[UBound($aFiles) - 1] MsgBox(0,'Download URL', $sDownloadURL) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
zone97 Posted March 31, 2012 Author Share Posted March 31, 2012 Thank you, this resolved my issue. Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
DW1 Posted March 31, 2012 Share Posted March 31, 2012 I looked back at the files in the list and now I see what you are saying. I think the reason I thought that my exe was still the portable version is because I saved a com as sas.exe in my testing, which made me assume I downloaded the exe... oops. I must have just lucked out when I tested and a *.com must have been the latest file at that time. You were indeed correct Glad that it is working for you. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
zone97 Posted April 4, 2012 Author Share Posted April 4, 2012 (edited) Checked today and the code seems to be broken? UPDATE: I think they locked the temp folder as to not allow downloading of a list of files. So guess that goes back to my first request of spoofing IE to click there PHP downloader to get the latest version. Edited April 5, 2012 by zone97 Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
zone97 Posted April 5, 2012 Author Share Posted April 5, 2012 I may have to use this technique to make this work. #include <IE.au3> $oIE = _IECreate("http://www.superantispyware.com/portablescannertech.html") _IEImgClick($oIE, "Click here to scan your computer now", "alt") But i would like to not see the web page load, and when the link is clicked it would capture the filename for download like the original code worked? Any chance of this happening? Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
zone97 Posted April 9, 2012 Author Share Posted April 9, 2012 Anyone? I need help with this project. Thanks. Spoiler WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ] Link to comment Share on other sites More sharing options...
smartee Posted April 10, 2012 Share Posted April 10, 2012 hi zone97, try creating a WinHttpRequest Object and set the Referer header to http://www.superantispyware.com/portablescannertech.html you might have to follow a redirect or two, If you get stuck, come back with your attempt Link to comment Share on other sites More sharing options...
Sonny Posted December 10, 2012 Share Posted December 10, 2012 Zone97, But i would like to not see the web page load, and when the link is clicked it would capture the filename for download like the original code worked? Any chance of this happening? Like the blind man said, "I can't see that happening". If you want this to work, you need to focus on MouseClick, ControlSend, [/size][size=4]WinActivate[/size][size=4]. Here's a tip, you have to copy the PROCESSLIST.BIN file to the temp directory before running the .com file completely. Once that's done, you just re-package it. Sonny [font=arial, helvetica, sans-serif][quote]For every rule there's three ways around it.[/quote][/font] Link to comment Share on other sites More sharing options...
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