import sys, os, struct def main(): if len(sys.argv) != 2: print "USAGE: %s " % sys.argv[0] return trustlet_dir = sys.argv[1] moduli = set() moduli_map = {} for root, dirs, files in os.walk(trustlet_dir): for name in files: if not (name.endswith(".tlbin") or name.endswith(".drbin") or name.endswith(".tabin")): continue print "----------" print "trustlet %s" % name print "dir %s" % root print #Reading the length fields from the header trustlet = open(os.path.join(root, name), "rb").read() text_length = struct.unpack("= len(trustlet): print "Invalid offset, skipping." continue modulus_length = struct.unpack(" %s" % (N.encode("hex"), moduli_map[N]) if __name__ == "__main__": main()