1*4f1223e8SApple OSS Distributions""" Please make sure you read the README file COMPLETELY BEFORE reading anything below. 2*4f1223e8SApple OSS Distributions It is very critical that you read coding guidelines in Section E in README file. 3*4f1223e8SApple OSS Distributions""" 4*4f1223e8SApple OSS Distributionsfrom xnu import * 5*4f1223e8SApple OSS Distributionsfrom utils import * 6*4f1223e8SApple OSS Distributions 7*4f1223e8SApple OSS Distributions# Macro: walkkauthcache 8*4f1223e8SApple OSS Distributions@lldb_command('walkkauthcache') 9*4f1223e8SApple OSS Distributionsdef WalkKauthCache(cmd_args=None): 10*4f1223e8SApple OSS Distributions """ Walks the bins of the kauth credential hash cache and prints out the 11*4f1223e8SApple OSS Distributions number of bins and bin usage information. 12*4f1223e8SApple OSS Distributions """ 13*4f1223e8SApple OSS Distributions PrintKauthCache() 14*4f1223e8SApple OSS Distributions# EndMacro: walkkauthcache 15*4f1223e8SApple OSS Distributions 16*4f1223e8SApple OSS Distributionsdef PrintKauthCache(cmd_args=None): 17*4f1223e8SApple OSS Distributions """ Routine to determine the size of the kauth cache, walk the bins 18*4f1223e8SApple OSS Distributions and print out usage information. 19*4f1223e8SApple OSS Distributions """ 20*4f1223e8SApple OSS Distributions anchor = unsigned(kern.globals.kauth_cred_table_anchor) 21*4f1223e8SApple OSS Distributions table_entries = 128 # KAUTH_CRED_TABLE_SIZE 22*4f1223e8SApple OSS Distributions anchor = kern.globals.kauth_cred_table_anchor 23*4f1223e8SApple OSS Distributions print("Cred cache has: " + str(table_entries) + " buckets\n") 24*4f1223e8SApple OSS Distributions print("Number of items in each bucket ... \n") 25*4f1223e8SApple OSS Distributions for i in range(0, table_entries): 26*4f1223e8SApple OSS Distributions numinbucket = 0 27*4f1223e8SApple OSS Distributions for kauth_cred in IterateListEntry(anchor[i], "crw_link"): 28*4f1223e8SApple OSS Distributions numinbucket += 1 29*4f1223e8SApple OSS Distributions #print str(kauth_cred.cr_posix) 30*4f1223e8SApple OSS Distributions #print str(kauth_cred.cr_ref) 31*4f1223e8SApple OSS Distributions print(str(numinbucket) + "\n") 32