()
Parse the system users db
Parse the system users db
Parse the system users db
def ParseSysUsers():
    ''' Parse the system users db '''

    global ADMINS

    PrintAndLog(u'System\'s users', 'SUBSECTION')
    for User in os.listdir(os.path.join(ROOT_PATH, 'private/var/db/dslocal/nodes/Default/users')):
        if User[0] != '.':
            SysUserPlistPath = os.path.join(ROOT_PATH, 'private/var/db/dslocal/nodes/Default/users', User)
            PrintAndLog(User[:-6] + u'\'s system account details', 'SUBSECTION')

            SysUserPlist = UniversalReadPlist(SysUserPlistPath)

            UserDetails =''
            if SysUserPlist:
                if 'name' in SysUserPlist:
                    Names = u''
                    for Name in SysUserPlist['name']:
                        Names += Name
                        if Name in ADMINS:
                            Names += u' (is Admin)'
                        Names += u'\n'
                    UserDetails += u'Name(s): ' + Names

                if 'realname' in SysUserPlist:
                    UserDetails += u'Real Name(s): ' + StringFromDic(SysUserPlist['realname'])

                if 'shell' in SysUserPlist:
                    UserDetails += u'Shell(s): ' + StringFromDic(SysUserPlist['shell'])

                if 'home' in SysUserPlist:
                    UserDetails += u'Home(s): ' + StringFromDic(SysUserPlist['home'])

                if 'uid' in SysUserPlist:
                    UserDetails += u'UID(s): ' + StringFromDic(SysUserPlist['uid'])

                if 'gid' in SysUserPlist:
                    UserDetails += u'GID(s): ' + StringFromDic(SysUserPlist['gid'])

                if 'generateduid' in SysUserPlist:
                    Generateduids = u''
                    for Generateduid in SysUserPlist['generateduid']:
                        Generateduids += Generateduid
                        if Generateduid in ADMINS:
                            Generateduids += u' (is Admin)'
                        Generateduids += u'\n'
                    UserDetails += u'generated UID(s): ' + Generateduids

                if 'LinkedIdentity' in SysUserPlist:
                    UserDetails += u'LinkedIdentities have been found. Extraction of LinkedIdentities is not implemented yet.'

                PrintAndLog(UserDetails, 'INFO_RAW')
def ParseSysUsers ( ) : global ADMINS PrintAndLog ( u'System\'s users' , 'SUBSECTION' ) for User in os . listdir ( os . path . join ( ROOT_PATH , 'private/var/db/dslocal/nodes/Default/users' ) ) : if User [ 0 ] != '.' : SysUserPlistPath = os . path . join ( ROOT_PATH , 'private/var/db/dslocal/nodes/Default/users' , User ) PrintAndLog ( User [ : - 6 ] + u'\'s system account details' , 'SUBSECTION' ) SysUserPlist = UniversalReadPlist ( SysUserPlistPath ) UserDetails = '' if SysUserPlist : if 'name' in SysUserPlist : Names = u'' for Name in SysUserPlist [ 'name' ] : Names += Name if Name in ADMINS : Names += u' (is Admin)' Names += u'\n' UserDetails += u'Name(s): ' + Names if 'realname' in SysUserPlist : UserDetails += u'Real Name(s): ' + StringFromDic ( SysUserPlist [ 'realname' ] ) if 'shell' in SysUserPlist : UserDetails += u'Shell(s): ' + StringFromDic ( SysUserPlist [ 'shell' ] ) if 'home' in SysUserPlist : UserDetails += u'Home(s): ' + StringFromDic ( SysUserPlist [ 'home' ] ) if 'uid' in SysUserPlist : UserDetails += u'UID(s): ' + StringFromDic ( SysUserPlist [ 'uid' ] ) if 'gid' in SysUserPlist : UserDetails += u'GID(s): ' + StringFromDic ( SysUserPlist [ 'gid' ] ) if 'generateduid' in SysUserPlist : Generateduids = u'' for Generateduid in SysUserPlist [ 'generateduid' ] : Generateduids += Generateduid if Generateduid in ADMINS : Generateduids += u' (is Admin)' Generateduids += u'\n' UserDetails += u'generated UID(s): ' + Generateduids if 'LinkedIdentity' in SysUserPlist : UserDetails += u'LinkedIdentities have been found. Extraction of LinkedIdentities is not implemented yet.' PrintAndLog ( UserDetails , 'INFO_RAW' )