Previously,
I dropped a post on here on using a squid proxy tp get around the issue where your network needs Proxy authentication, but you application does not support it.
http://www.get-virtual.info/2011/01/20/authenticating-through-a-proxy-when-the-app-has-no-option-to-do-so/
I was actually at the time working on gathering some info during web requests – using Fiddler – and figured that as Fiddler was proxying my requests, it may be able to manage my authentication for me and save some pain.
well here is a quick way to do this.
- head over to http://www.fiddler2.com/fiddler2/ and install the latest version of fiddler
- close IE etc – so no web requests are running
- Launch fiddler (using the standard configuration)
- Start IE and make an HTTP-request to an external web-site.
- At this point, the proxy authorization dialogue pops up
- Fill in your credentials
- Go back to fiddler and run a search for “Proxy-Authorization”.
- click on any of the (recent) found lines in the left hand pane, then click “headers” from the buttons on the right
- Look through the text fpor a header value like “Basic ArBiTaRy64BaSeEnCode==”
- Copy the string to your clipboard
- To edit your rules go Rules > Customize Rules (Or hit Ctrl-R)
- In the section : “OnBeforeRequest” add the following (using the values you captured above):
// Add proxy auth header
oSession.oRequest["Proxy-Authorization"] = “Basic ArBiTaRy64BaSeEnCode==”;
13. Restart Fiddler – Enjoy
This has been updated to allow qu9ick access to ADDM views for people who live in their Powershell Shells.
So a quick – “get-addm myserver – launch” opens the URL – I have not found a way to post the credsa to the logon page yet – as I do not want to depends on simulated keypresses.
</pre>
Function get-Addm ($addmserver="MyAddmServer.mydomain.local", $hostname, [string]$query="SEARCH Host WHERE name MATCHES '(?i)$hostname'", $username, $password, $proxy="myproxy:8080", [switch]$resetpwd, [switch]$launch)
{
# Use system reflection to convert string to URL.
[System.Reflection.Assembly]::LoadWithPartialName("System.Web") | out-null
$query = [System.Web.HttpUtility]::UrlEncode($query)
# Check for password / gather password info
If ($resetpwd)
{del $env:userprofile\$username.txt}
If (!$username)
{
write-host "No Username specified - using $env:username" -fore Green
$username = $env:username
}
if (test-path $env:userprofile\$username.txt)
{
write-host "Stored creds found for $username" -fore Green
}
else
{
write-host "No Password saved for $username - please specify a valid pwd" -fore Green
read-host -assecurestring | convertfrom-securestring | out-file $env:userprofile\$username.txt
}
$password = get-content $env:userprofile\$username.txt | convertto-securestring
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password
# Decrypt stored creds
$pw = $credentials.GetNetworkCredential().password
# Create Web request
$proxy = new-object System.Net.WebProxy $proxy
# $proxy.credentials = $proxycred.GetNetworkCredential()
$WebClient = New-Object System.Net.WebClient
$webclient.proxy = $proxy
$url = "<a href="https://$addmserver/ui/api/CsvApi?query=$query&username=$username&password=$pw">https://$addmserver/ui/api/CsvApi?query=$query&username=$username&password=$pw</a>"
$Webclient.DownloadFile($url, "$env:temp\tmp.csv")
#Import captured CSV
$csv = import-csv "$env:temp\tmp.csv"
If ($launch){ie "<a href="https://$addmserver/ui/NodeSearch?query=SEARCH%20Host%20WHERE%20name%20MATCHES%20%27%28%3Fi%29$Hostname%27">https://$addmserver/ui/NodeSearch?query=SEARCH%20Host%20WHERE%20name%20MATCHES%20%27%28%3Fi%29$Hostname%27</a>"}
return $csv
}
<pre>