PoshCode Archive  Artifact [1ac678b20a]

Artifact 1ac678b20adea88821a4da76efb94f1b3897ac59b5443bb6b319e4522fcfbc0d:

  • File LookUp-WirelessLocation.ps1 — part of check-in [0f6a2b4518] at 2018-06-10 14:02:16 on branch trunk — This simple function translates a wireless AP’s BBID (mac) through the SkyhookWireless API’s to return location information… (user: CrazyDave size: 1189)

# encoding: ascii
# api: powershell
# title: LookUp-WirelessLocation
# description: This simple function translates a wireless AP’s BBID (mac) through the SkyhookWireless API’s to return location information…
# version: 2.6
# type: function
# author: CrazyDave
# license: CC0
# function: LookUp-Location
# x-poshcode-id: 5831
# x-archived: 2015-04-20T01:13:13
# x-published: 2015-04-17T14:02:00
#
# Currently the output is just the raw XML response from the server…
#
function LookUp-Location {
param([String] $mac)
$mac = $mac.Replace(":","").Replace("-","")

$wClient = New-Object System.Net.WebClient
$body = "<?xml version='1.0'?><LocationRQ xmlns='http://skyhookwireless.com/wps/2005' version='2.6' street-address-lookup='full'><authentication version='2.0'><simple><username>beta</username><realm>js.loki.com</realm></simple></authentication><access-point><mac>#{mac}</mac><signal-strength>-50</signal-strength></access-point></LocationRQ>"
$url = "https://api.skyhookwireless.com/wps2/location"
$wClient.Headers.Add("Content-Type:text/xml")
$body = $body.Replace("#{mac}", $mac)

$response = $wClient.UploadString($url, $body)
return $response
}