Archive

Archive for November, 2011

Authenticating to your proxy when your application does not have the ability – option 2

November 16th, 2011 No comments

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.

  1. head over to http://www.fiddler2.com/fiddler2/ and install the latest version of fiddler
  2. close IE etc – so no web requests are running
  3. Launch fiddler (using the standard configuration)
  4.  Start IE and make an HTTP-request to an external web-site.
  5. At this point, the proxy authorization dialogue pops up
  6. Fill in your credentials
  7. Go back to fiddler and run a search for “Proxy-Authorization”.
  8. click on any of the (recent) found lines in the left hand pane, then click “headers” from the buttons on the right
  9. Look through the text fpor a header value like “Basic  ArBiTaRy64BaSeEnCode==”
  10. Copy the string to your clipboard
  11. To edit your rules go Rules > Customize Rules (Or hit Ctrl-R)
  12. 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

 

Categories: Toolbox Tags:

Updated ADDM query using Powershell.

November 7th, 2011 No comments

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>

Categories: ADDM Tags: