MCPcopy
hub / github.com/jipegit/OSXAuditor / ParseAirportPrefs

Function ParseAirportPrefs

osxauditor.py:928–963  ·  view source on GitHub ↗

Parse Airport preferences and try to extract geolocation information

()

Source from the content-addressed store, hash-verified

926 return u'Latitude: ' + Latitude + u' Longitude: ' + Longitude
927
928def ParseAirportPrefs():
929 ''' Parse Airport preferences and try to extract geolocation information '''
930
931 global HTML_LOG_FILE
932 AirportPrefPlist = False
933 NbAirportPrefs = 0
934
935 PrintAndLog(u'Airport preferences', 'SECTION')
936
937 AirportPrefPlistPath = os.path.join(ROOT_PATH, 'Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist')
938
939 PrintAndLog(AirportPrefPlistPath, 'DEBUG')
940 AirportPrefPlist = UniversalReadPlist(AirportPrefPlistPath)
941
942 if AirportPrefPlist:
943 if 'KnownNetworks' in AirportPrefPlist:
944 KnownNetworks = AirportPrefPlist['KnownNetworks']
945 for KnownNetwork in KnownNetworks: #TODO: Add ChannelHistory
946 if GEOLOCATE_WIFI_AP:
947 Geolocation = GeomenaApiLocation(KnownNetworks[KnownNetwork]['SSIDString'])
948 else:
949 Geolocation = 'N/A (Geolocation disabled)'
950
951 print sys.getsizeof(KnownNetworks[KnownNetwork]['SSID'])
952 AirportPref = u'SSID: ' + KnownNetworks[KnownNetwork]['SSIDString'].decode('utf-8') + u' - SSID: ' + str(KnownNetworks[KnownNetwork]['SSID'])
953
954 if KnownNetworks[KnownNetwork]['LastConnected']:
955 AirportPref = AirportPref + u' - Last connected: '+ str(KnownNetworks[KnownNetwork]['LastConnected'])
956
957 AirportPref = AirportPref + u' - Security type: ' + KnownNetworks[KnownNetwork]['SecurityType'] + u' - Geolocation: ' + Geolocation
958
959 PrintAndLog(AirportPref, 'INFO')
960 NbAirportPrefs += 1
961
962 if NbAirportPrefs == 0:
963 PrintAndLog(AirportPrefPlistPath + u' is empty (no WiFi AP saved)', 'INFO')
964
965def ParseMailAppAccount(MailAccountPlistPath):
966 ''' Parse a Mail Account plist '''

Callers 1

MainFunction · 0.85

Calls 3

PrintAndLogFunction · 0.85
UniversalReadPlistFunction · 0.85
GeomenaApiLocationFunction · 0.85

Tested by

no test coverage detected