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

Function ParseMailAppAccount

osxauditor.py:965–1013  ·  view source on GitHub ↗

Parse a Mail Account plist

(MailAccountPlistPath)

Source from the content-addressed store, hash-verified

963 PrintAndLog(AirportPrefPlistPath + u' is empty (no WiFi AP saved)', 'INFO')
964
965def ParseMailAppAccount(MailAccountPlistPath):
966 ''' Parse a Mail Account plist '''
967
968 MailAccountPlist = False
969 NbMailAccounts = 0
970 NbSmtpAccounts = 0
971
972 PrintAndLog(MailAccountPlistPath, 'DEBUG')
973
974 MailAccountPlist = UniversalReadPlist(MailAccountPlistPath)
975
976 if MailAccountPlist:
977 PrintAndLog(u'Email accounts', 'SUBSECTION')
978 if 'MailAccounts' in MailAccountPlist:
979 MailAccounts = MailAccountPlist['MailAccounts']
980 for MailAccount in MailAccounts:
981 MAccountPref = ''
982 if 'AccountName' in MailAccount:
983 MAccountPref = 'AccountName: ' + MailAccount['AccountName'] + ' - '
984 if 'AccountType' in MailAccount: MAccountPref += 'AccountType: ' + MailAccount['AccountType'] + ' - '
985 if 'SSLEnabled' in MailAccount: MAccountPref += 'SSLEnabled: ' + MailAccount['SSLEnabled'] + ' - '
986 if 'Username' in MailAccount: MAccountPref += 'Username: ' + MailAccount['Username'] + ' - '
987 if 'Hostname' in MailAccount: MAccountPref += 'Hostname: ' + MailAccount['Hostname'] + ' - '
988 if 'PortNumber' in MailAccount: MAccountPref += '(' + str(MailAccount['PortNumber']) + ') - '
989 if 'SMTPIdentifier' in MailAccount: MAccountPref += 'SMTPIdentifier: ' + MailAccount['SMTPIdentifier'] + ' - '
990 if 'EmailAddresses' in MailAccount:
991 for EmailAddresse in MailAccount['EmailAddresses']:
992 MAccountPref += 'EmailAddresse: ' + EmailAddresse + ' - '
993 PrintAndLog(MAccountPref.decode('utf-8'), 'INFO')
994 NbMailAccounts += 1
995 if NbMailAccounts == 0:
996 PrintAndLog(u'No email account)','INFO')
997
998 PrintAndLog(u'SMTP accounts', 'SUBSECTION')
999 if 'DeliveryAccounts' in MailAccountPlist:
1000 DeliveryAccounts = MailAccountPlist['DeliveryAccounts']
1001 for DeliveryAccount in DeliveryAccounts:
1002 DAccountPref = ''
1003 if 'AccountName' in DeliveryAccount:
1004 DAccountPref = 'AccountName: ' + DeliveryAccount['AccountName'] + ' - '
1005 if 'AccountType' in DeliveryAccount: DAccountPref += 'AccountType: ' + DeliveryAccount['AccountType'] + ' - '
1006 if 'SSLEnabled' in DeliveryAccount: DAccountPref += 'SSLEnabled: ' + DeliveryAccount['SSLEnabled'] + ' - '
1007 if 'Username' in DeliveryAccount: DAccountPref += 'Username: ' + DeliveryAccount['Username'] + ' - '
1008 if 'Hostname' in DeliveryAccount: DAccountPref += 'Hostname: ' + DeliveryAccount['Hostname'] + ' - '
1009 if 'PortNumber' in DeliveryAccount: DAccountPref += '(' + str(DeliveryAccount['PortNumber']) + ') - '
1010 PrintAndLog(DAccountPref.decode('utf-8'), 'INFO')
1011 NbSmtpAccounts += 1
1012 if NbSmtpAccounts == 0:
1013 PrintAndLog(u'No SMTP account)','INFO')
1014
1015def ParseUsersRecentItems(RecentItemsAccountPlistPath):
1016 ''' Parse users' recents items'''

Callers 1

ParseUsersAccountsFunction · 0.85

Calls 2

PrintAndLogFunction · 0.85
UniversalReadPlistFunction · 0.85

Tested by

no test coverage detected