Hallo Zusammen,
folgenden Code habe ich mir testweise geschrieben um per VBA den HTML Quellcode einer Webseite auswerten zu können:
Wie man sieht ist die Zeile 12.
"Normal" ist der Zugriff über den Proxyserver im Internetexplorer vorkonfiguriert. (IE -> Einstellungen -> Verbindung -> LAN -> Script -> *.pac Datei)
Die Einstellungen im IE werden allerdings von Excel VBA ignoriert, da ich am Anfang ohne die 12. Zeile
Die Frage:
Wo könnten die Daten (Benutzername & Passwort) sonst noch gespeichert worden sein? Evtl. am Proxyserver (glaub ich eher nicht aber naja)?
Gruß, FireEmerald
Verweise - VBAProject:
- Microsoft WinHTTP Services, version 5.1 (C:\Windows\system32\winhttp.dll)
- Microsoft HTML Object Library (C:\Windows\SysWOW64\mshtml.tlb)
Microsoft Excel 2010
folgenden Code habe ich mir testweise geschrieben um per VBA den HTML Quellcode einer Webseite auswerten zu können:
Visual Basic-Quellcode
- Option Explicit
- Private Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 '// Default proxy setting. Equivalent to HTTPREQUEST_PROXYSETTING_PRECONFIG.
- Private Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 '// Indicates that the proxy settings should be obtained from the registry. This assumes that Proxycfg.exe has been run. If Proxycfg.exe has not been run and HTTPREQUEST_PROXYSETTING_PRECONFIG is specified, then the behavior is equivalent to HTTPREQUEST_PROXYSETTING_DIRECT.
- Private Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 '// Indicates that all HTTP and HTTPS servers should be accessed directly. Use this command if there is no proxy server.
- Private Const HTTPREQUEST_PROXYSETTING_PROXY = 2 '// When HTTPREQUEST_PROXYSETTING_PROXY is specified, varProxyServer should be set to a proxy server string and varBypassList should be set to a domain bypass list string. This proxy configuration applies only to the current instance of the WinHttpRequest object.
- Private Const CREDENTIALS_FOR_SERVER = 0
- Private Const CREDENTIALS_FOR_PROXY = 1
- Public Function GetInnerHtmlBody(ByVal Url As String) As HTMLDocument
- Dim ResponseDocument As New HTMLDocument
- Dim MyRequest As New WinHttpRequest
- With MyRequest
- .SetTimeouts 5000, 5000, 5000, 5000
- .SetProxy HTTPREQUEST_PROXYSETTING_PROXY, "<PROXY_SERVER_IP>:<PORT>", "*.domain.com"
- .Open "GET", Url, False
- '// Authentication for the proxy server
- '.SetCredentials "<USERNAME>", "<PASSWORD>", CREDENTIALS_FOR_PROXY
- .Send
- '// Debug
- MsgBox .ResponseText, vbInformation, .StatusText & " - " & .Status
- ResponseDocument.body.innerHTML = .ResponseText
- End With
- Set GetInnerHtmlBody = ResponseDocument
- End Function
Wie man sieht ist die Zeile 12.
.SetCredentials
auskommentiert. Diese wird benötigt um sich über einen Proxyserver mit dem Internet zu verbinden. In meinem Fall ist der Proxyserver zwingen erforderlich."Normal" ist der Zugriff über den Proxyserver im Internetexplorer vorkonfiguriert. (IE -> Einstellungen -> Verbindung -> LAN -> Script -> *.pac Datei)
Die Einstellungen im IE werden allerdings von Excel VBA ignoriert, da ich am Anfang ohne die 12. Zeile
.SetCredentials
nur Authorization Required
als Result zurück bekam.Die Frage:
- Ich benötigte die Zeile 12. nur genau 1x um mich am Proxyserver zu authentifizieren, alle nachfolgenden Verbindungsversuche mit auskommentierter 12. Zeile funktionierten!
- Ergo müssen die Credentials gespeichert worden sein, nur wo?
- Die Zugangsdaten wurden nicht in Windows gespeichert (
cmdkey /list
= Leer) - Die Zugangsdaten wurden nicht als Coockie o.ä. im IE gespeichert (Cache geleert)
- Die Zugangsdaten bleiben selbst nach mehreren Tagen erhalten (mehrere Neustarts vom Rechner)
Wo könnten die Daten (Benutzername & Passwort) sonst noch gespeichert worden sein? Evtl. am Proxyserver (glaub ich eher nicht aber naja)?
Gruß, FireEmerald
Verweise - VBAProject:
- Microsoft WinHTTP Services, version 5.1 (C:\Windows\system32\winhttp.dll)
- Microsoft HTML Object Library (C:\Windows\SysWOW64\mshtml.tlb)
Microsoft Excel 2010
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „FireEmerald“ ()