Concept

The concept for this came from the book Violent Python: A Cookbook for Hackers, Forensic Analysts, Penetration Testers and Security Engineers
.  The python solution was pretty complex and his approach was Windows specific.  In my case I wanted to run the OSX variant command to get my SSID history.  I got the string to do so, and used RegEX I found online to pull out the BSSID (mac address).  I iterate over the collection and output each mac address found… I also repeat to iterate through all SSIDStrings (ssid names) as well.

While I could have done it in Python, doing this in Groovy is so much easier, imo.

Code

def results = "defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences RememberedNetworks | grep BSSID".execute().text

regex = /(?:[A-Za-z0-9]{2}[:-]){5}(?:[A-Za-z0-9]{2})/
regexSsidstring = /(?:)SSIDString = (.*)/

matcher = (results =~ regex)
matcher.each { match ->
    println match
    // Post to Google's geolocate based on mac address: https://developers.google.com/maps/documentation/business/geolocation
}
matcherSSID = (results =~ regexSsidstring)
matcherSSID.each { ssidString ->
    println ssidString[1]
}

Leave a Reply

Your email address will not be published. Required fields are marked *