def PlayFilesOnHost( hostname, port, files, file_prefix ): iphone_player = ControlAgent.iPhonePlayer( hostname, port ) iphone_player.SetDebugLevel( 10 ) for file in files: print ">",file_prefix+file try: iphone_player.PlayFile( file_prefix+file ) except: fd = open( file, "rb" ) data = fd.read() fd.close() m = md5.new() m.update( data ) dst_file = m.hexdigest() + file[-4:] print file,'->',dst_file shutil.copyfile( file, dst_file ) iphone_player = ControlAgent.iPhonePlayer( hostname, port )
newfile = "output" + str(count) + ".mp4" shutil.copyfile(sourcefile, newfile) oldatoms = mutagen.mp4.MP4(newfile) newatoms = fuzz_qt_atoms(oldatoms, numtofuzz) failed = False try: newatoms.save() print "Playing %s..." % newfile try: iphone_player.PlayFile(newfile) except KeyboardInterrupt: print "User interrupted, cleaning up." sys.exit() except: print "Failed to save %s" % newfile failed = True os.remove(newfile) count = count + 1 # main stuff starts here. parser = get_options() (ops, args) = parser.parse_args() iphone_player = ControlAgent.iPhonePlayer(ops.hostname, ops.port) iphone_player.SetDebugLevel(10) while 1: Fuzz(iphone_player, ops, args)