def execute(self, input_data): # Spin up SWF class swf = SWF() # Get the raw_bytes raw_bytes = input_data['sample']['raw_bytes'] # Parse it swf.parse(StringIO(raw_bytes)) # Header info head = swf.header output = {'version':head.version,'file_length':head.file_length,'frame_count':head.frame_count, 'frame_rate':head.frame_rate,'frame_size':head.frame_size.__str__(),'compressed':head.compressed} # Loop through all the tags output['tags'] = [tag.__str__() for tag in swf.tags] # Add the meta data to the output output.update(input_data['meta']) return output ''' # Map all tag names to indexes tag_map = {tag.name:index for tag,index in enumerate(swf.tags)} # FileAttribute Info file_attr_tag = swf.tags[tag_map] ''' '''
def execute(self, input_data): # Spin up SWF class swf = SWF() # Get the raw_bytes raw_bytes = input_data['sample']['raw_bytes'] # Parse it swf.parse(StringIO(raw_bytes)) # Header info head = swf.header output = { 'version': head.version, 'file_length': head.file_length, 'frame_count': head.frame_count, 'frame_rate': head.frame_rate, 'frame_size': head.frame_size.__str__(), 'compressed': head.compressed } # Loop through all the tags output['tags'] = [tag.__str__() for tag in swf.tags] # Add the meta data to the output output.update(input_data['meta']) return output ''' # Map all tag names to indexes tag_map = {tag.name:index for tag,index in enumerate(swf.tags)} # FileAttribute Info file_attr_tag = swf.tags[tag_map] ''' '''
def swfParse(strSWFFile): for file in strSWFFile: hFile = open(file) swf = SWF(hFile) print swf.parse() hFile.close()