chiners_68 Posted October 18, 2007 Posted October 18, 2007 (edited) Hi Guys, im writing a script to automatically download the mcafee Sdat files for me daily but the inetget command isnt working. I recon its because my proxy requires authentication. is there away to do proxy Authentication within autoit..? Edited October 18, 2007 by chiners_68
Moderators SmOke_N Posted October 18, 2007 Moderators Posted October 18, 2007 chiners_68 said: Hi Guys, im writing a script to automatically download the mcafee Sdat files for me daily but the inetget command isnt working. I recon its because my proxy requires authentication. is there away to do proxy Authentication within autoit..?Have you looked at FTP.au3 in the Example scripts forum, or maybe just using IE.au3? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
chiners_68 Posted October 19, 2007 Author Posted October 19, 2007 SmOke_N said: Have you looked at FTP.au3 in the Example scripts forum, or maybe just using IE.au3?Hi SmOke_N, i have looked at the FTP script but it only seems to have login & connection sections for connecting to an FTP site. I can connect to the ftp site ok in IE. i just need a part of a script to do proxy Authentication so i can then access the open ftp site.Ive done several searches but cannot find the IE.au3 script you mentioned. that may well have the answer im looking for.
lod3n Posted October 19, 2007 Posted October 19, 2007 You can use the WinHttpRequest COM object and do it via COM. Here's my Sdat downloader. expandcollapse popup;set parameters for using Global $UseIntegratedSecurity = True Global $ProxyServer = "10.0.0.1:8080" Global $ProxyUser = "username" ;if $UseIntegratedSecurity is true (and working), these can be blank Global $ProxyPass = "password" ;create WinHttpRequest object for downloading config info Global $oHttp = ObjCreate ("WinHttp.WinHttpRequest.5.1") Global $oBinaryStream = ObjCreate("ADODB.Stream") $oHttp.SetProxy(2,$ProxyServer) ; PRECONFIG = 0 (default), DIRECT = 1, PROXY = 2 ConsoleWrite("Downloading update.ini..." & @TAB) $sINI = httpget("http://download.nai.com/products/datfiles/4.x/nai/update.ini") ConsoleWrite("Complete" & @CRLF) FileDelete("update.ini") FileWrite("update.ini",$sINI) $curSdat = IniRead("update.ini","SuperDat-IA32","FileName","") $sdatUrl = "http://download.nai.com/products/licensed/superdat/english/intel/" & $curSdat ConsoleWrite("Downloading " & $curSdat & "..." & @TAB) $sdataBin = httpget($sdatUrl,@ScriptDir & "\" & $curSdat) ConsoleWrite("Complete" & @CRLF) func httpget($url,$filename="") $COMerrnotify = false If $UseIntegratedSecurity Then $oHttp.SetAutoLogonPolicy(0) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 Else $oHttp.SetAutoLogonPolicy(2) ; Always = 0, OnlyIfBypassProxy = 1, Never = 2 EndIf $status = $oHttp.Open("GET", $url,false) If Not $UseIntegratedSecurity Then $oHttp.SetCredentials($ProxyUser,$ProxyPass,0) ; HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0 EndIf $oHttp.Send() if $oHttp.Status <> "200" then $status = $oHttp.Status $StatusText = $oHttp.StatusText Consolewrite("Status: " & $status & @crlf) Consolewrite("StatusText: " & $StatusText & @crlf) $COMerrnotify = true SetError(1) return $status & " - " & $StatusText Else $COMerrnotify = true SetError(0) Consolewrite("Response Headers: " & $oHttp.GetAllResponseHeaders & @crlf) If $filename <> "" Then $adTypeBinary = 1 $adSaveCreateOverWrite = 2 FileDelete($filename) $oBinaryStream.Type = $adTypeBinary $oBinaryStream.Open $oBinaryStream.Write($oHttp.ResponseBody) $oBinaryStream.SaveToFile($filename, $adSaveCreateOverWrite) Return $oHttp.Status EndIf return $oHttp.ResponseText EndIf EndFunc ;_IEErrorHandlerRegister("ComErrFunc") $oIEErrorHandler = ObjEvent("AutoIt.Error","ComErrFunc") global $COMerrnotify = true Func ComErrFunc() If IsObj($oIEErrorHandler) Then if $COMerrnotify then ConsoleWrite("--> ComErrFunc: COM Error Encountered in " & @ScriptName & @CR) ConsoleWrite("----> Scriptline = " & $oIEErrorHandler.scriptline & @CR) ConsoleWrite("----> Number Hex = " & Hex($oIEErrorHandler.number, 8) & @CR) ConsoleWrite("----> Number = " & $oIEErrorHandler.number & @CR) ConsoleWrite("----> Win Description = " & StringStripWS($oIEErrorHandler.WinDescription, 2) & @CR) ConsoleWrite("----> Description = " & StringStripWS($oIEErrorHandler.description, 2) & @CR) ConsoleWrite("----> Source = " & $oIEErrorHandler.Source & @CR) ConsoleWrite("----> Help File = " & $oIEErrorHandler.HelpFile & @CR) ConsoleWrite("----> Help Context = " & $oIEErrorHandler.HelpContext & @CR) ConsoleWrite("----> Last Dll Error = " & $oIEErrorHandler.LastDllError & @crlf) EndIf $HexNumber = Hex($oIEErrorHandler.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
dewild1 Posted October 19, 2007 Posted October 19, 2007 download.exe best one, free, works well, can work with proxy and pw
dewild1 Posted October 19, 2007 Posted October 19, 2007 (edited) dewild1 said: download.exe best one, free, works well, can work with proxy and pwForgot to add.... I also like it better because it has options like /update (only downloads newer files) and /subdir (sub directories) "c:\program files\your folder\download.exe" [url="ftp://somedomain.com/a"]ftp://somedomain.com/a[/url] subfolder name/def/*.* username password /delete /output:"C:\Program Files\your folder name" /subdir /overwrite /update Edited October 19, 2007 by dewild1
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