-
Notifications
You must be signed in to change notification settings - Fork 42
/
proxytest.au3
112 lines (94 loc) · 3.39 KB
/
proxytest.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <XML.au3>
#include <Array.au3>
#include <String.au3>
#include <Array.au3>
Global $X
Opt("WinTitleMatchMode", 2)
dim $aAttName[1],$aAttVal[1]
HotKeySet("{PAUSE}", "PauseProg")
HotKeySet("{HOME}", "ConProg")
$FilePath = "C:\Users\Bennet van der Gryp\My Documents\192.168.xml"
$XML = _XMLFileOpen($FilePath)
$ret = _XMLGetValue("/network-scanner-results/items/item/ip-address")
For $IP in $ret
;set parameters for using
Global $UseIntegratedSecurity = True
Global $ProxyServer = $IP & ":80"
Global $ProxyUser = "SBICZA01/a159994" ;if $UseIntegratedSecurity is true (and working), these can be blank
Global $ProxyPass = "AA!(19"
;create WinHttpRequest object for downloading config info
Global $oHttp = ObjCreate ("WinHttp.WinHttpRequest.5.1")
$oHttp.SetProxy(2,$ProxyServer) ; PRECONFIG = 0 (default), DIRECT = 1, PROXY = 2
$sHTML = httpget("http://www.google.com")
ConsoleWrite($IP & @CRLF)
Next
Func Auth()
Send("SBICZA01\a159994")
Send("{TAB}")
Send("AA{!}{(}19")
Send("{Enter}")
Sleep(2000)
If WinExists("Authentication Required") Then
Auth()
EndIf
EndFunc
Func PauseProg()
$X = 1
While $X = 1
Sleep(200)
WEnd
EndFunc
Func ConProg()
$X = 0
EndFunc
func httpget($url)
$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)
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