def main(argv=sys.argv):
if tpm_initialize.get_tpm_manufacturer() != 'IBM':
raise Exception("This stub should only be used with the IBM TPM emulator")
# initialize position in ML
pos=0
# check if pcr is clean
output = tpm_exec.run("pcrread -ix %s"%common.IMA_PCR)[0]
pcrval = output[0].split()[5]
if pcrval != ima.START_HASH.encode('hex'):
print "Warning: IMA PCR is not empty, trying to find the last updated file in the measurement list..."
pos = ml_extend(common.IMA_ML, 0, pcrval)
print "Monitoring %s"%(common.IMA_ML)
poll_object = select.poll()
fd_object = file(common.IMA_ML, "r")
number = fd_object.fileno()
poll_object.register(fd_object,select.POLLIN|select.POLLPRI)
while True:
results = poll_object.poll()
for result in results:
if result[0] != number:
continue
pos = ml_extend(common.IMA_ML,pos)
#print "new POS %d"%pos
time.sleep(0.2)
sys.exit(1)
评论列表
文章目录