Ejemplo n.º 1
0
 def parse(self,stream):
     self.function_name = datatypes.string(stream)
     self.num_params = stream.read('uintle:16')
     self.register_count = stream.read('uintle:8')
     self.preload_parent_flag = stream.read('bool')
     self.preload_root_flag = stream.read('bool')
     self.suppress_super_flag = stream.read('bool')
     self.preload_super_flag = stream.read('bool')
     self.suppress_arguments_flag = stream.read('bool')
     self.preload_arguments_flag = stream.read('bool')
     self.suppress_this_flag = stream.read('bool')
     self.preload_this_flag = stream.read('bool')
     stream.pos += 7
     self.preload_global_flag = stream.read('bool')
     self.parameters = []
     for i in range(0,self.num_params):
         self.parameters.append({'register': stream.read('uintle:8'),
                                 'param_name': datatypes.string(stream)
                                 })
     self.code_size = stream.read('uintle:16')
     initial_bytepos = stream.bytepos
     self.actions = []
     while stream.pos < stream.len and stream.bytepos < initial_bytepos + self.code_size:
         action_code = stream.read('uintle:8')
         action_length = 0
         if action_code > 0x7F:
             action_length = stream.read('uintle:16')
         action_stream = stream.read('bits:{0}'.format(action_length*8))
         self.actions.append(ActionFactory.new_action(action_stream,
                                                      action_code,
                                                      action_length))    
Ejemplo n.º 2
0
 def parse(self,stream):
     self.url = datatypes.string(stream)
     count = stream.read('uintle:16')
     self.assets = []
     for x in range(0,count):
         new_asset = {'tag': stream.read('uintle:16'),
                      'name': datatypes.string(stream)}
         self.assets.append(new_asset)
Ejemplo n.º 3
0
 def parse(self,stream):
     self.url = datatypes.string(stream)
     count = datatypes.UI16(stream)
     self.assets = []
     for x in range(0,count):
         new_asset = {'tag': datatypes.UI16(stream),
                      'name': datatypes.string(stream)}
         self.assets.append(new_asset)
Ejemplo n.º 4
0
 def parse(self,stream):
     self.scene_count = datatypes.EncodedU32(stream)
     self.scenes = []
     for x in xrange(0,scene_count):
         offset_data = {'offset' : datatypes.EncodedU32(stream),
                        'name' : datatypes.string(stream) }
         self.scenes.append(offset_data)
     self.frame_label_count = datatypes.EncodedU32(stream)
     self.frame_labels = []
     for x in xrange(0,scene_count):
         label_data = {'frame_number' : datatypes.EncodedU32(stream),
                       'frame_label' : datatypes.string(stream) }
         self.frame_labels.append(label_data)
Ejemplo n.º 5
0
 def parse(self,stream):
     num_symbols = stream.read('uintle:16')
     self.symbols = []
     for x in range(0,num_symbols):
         new_symbol = {'tag': stream.read('uintle:16'),
                      'name': datatypes.string(stream)}
         self.symbols.append(new_symbol)
Ejemplo n.º 6
0
 def parse(self,stream):
     num_symbols = datatypes.UI16(stream)
     self.symbols = []
     for x in range(0,num_symbols):
         new_symbol = {'tag': datatypes.UI16(stream),
                      'name': datatypes.string(stream)}
         self.symbols.append(new_symbol)
Ejemplo n.º 7
0
 def parse(self,stream):
     self.function_name = datatypes.string(stream)
     self.num_params = stream.read('uintle:16')
     self.params = []
     for i in range(0,self.num_params):
         self.params.append(datatypes.string(stream))
     self.code_size = stream.read('uintle:16')
     initial_bytepos = stream.bytepos
     self.actions = []
     while stream.pos < stream.len and stream.bytepos < initial_bytepos + self.code_size:
         action_code = stream.read('uintle:8')
         action_length = 0
         if action_code > 0x7F:
             action_length = stream.read('uintle:16')
         action_stream = stream.read('bits:{0}'.format(action_length*8))
         self.actions.append(ActionFactory.new_action(action_stream,
                                                      action_code,
                                                      action_length))    
Ejemplo n.º 8
0
 def parse(self,stream):
     self.character_id = datatypes.UI16(stream)
     self.bounds = datatypes.Rect(stream)
     self.has_text = stream.read('bool')
     self.word_wrap = stream.read('bool')
     self.multiline = stream.read('bool')
     self.password = stream.read('bool')
     self.read_only = stream.read('bool')
     self.has_text_color = stream.read('bool')
     self.has_max_length = stream.read('bool')
     self.has_font = stream.read('bool')
     self.has_font_class = stream.read('bool')
     self.auto_size = stream.read('bool')
     self.has_layout = stream.read('bool')
     self.no_select = stream.read('bool')
     self.border = stream.read('bool')
     self.was_static = stream.read('bool')
     self.html = stream.read('bool')
     self.use_outlines = stream.read('bool')
     if self.has_font:
         self.font_id = datatypes.UI16(stream)
     if self.has_font_class:
         self.font_class = datatypes.string(stream)
     if self.has_font:
         self.font_height = datatypes.UI16(stream)
     if self.has_text_color:
         self.text_color = datatypes.Rgba(stream)
     if self.has_max_length:
         self.max_length = datatypes.UI16(stream)
     if self.has_layout:
         self.align = datatypes.UI8(stream)
         self.left_margin = datatypes.UI16(stream)
         self.right_margin = datatypes.UI16(stream)
         self.indent = datatypes.UI16(stream)
         self.leading = datatypes.SI16(stream)
     self.variable_name = datatypes.string(stream)
     if self.has_text:
         self.initial_text = datatypes.string(stream)
Ejemplo n.º 9
0
    def parse(self,stream):
        stream.pos += 5
        self.catch_in_register_flag = stream.read('bool')
        self.finally_block_flag = stream.read('bool')
        self.catch_block_flag = stream.read('bool')
        self.try_size = stream.read('uintle:16')
        self.catch_size = stream.read('uintle:16')
        self.finally_size = stream.read('uintle:16')
        if self.catch_in_register_flag == False:
            self.catch_name = datatypes.string(stream)
        else:
            self.catch_register = stream.read('uintle:8')
        # TryBody
        initial_bytepos = stream.bytepos
        self.try_body = []
        while stream.bytepos < initial_bytepos + self.try_size:
            action_code = stream.read('uintle:8')
            action_length = 0
            if action_code > 0x7F:
                action_length = stream.read('uintle:16')
            action_stream = stream.read('bits:{0}'.format(action_length*8))
            self.try_body.append(ActionFactory.new_action(action_stream,
                                                          action_code,
                                                          action_length))    
        # CatchBody
        initial_bytepos = stream.bytepos
        self.catch_body = []
        while stream.bytepos < initial_bytepos + self.catch_size:
            action_code = stream.read('uintle:8')
            action_length = 0
            if action_code > 0x7F:
                action_length = stream.read('uintle:16')
            action_stream = stream.read('bits:{0}'.format(action_length*8))
            self.catch_body.append(ActionFactory.new_action(action_stream,
                                                            action_code,
                                                            action_length))    

        # FinallyBody
        initial_bytepos = stream.bytepos
        self.finally_body = []
        while stream.bytepos < initial_bytepos + self.finally_size:
            action_code = stream.read('uintle:8')
            action_length = 0
            if action_code > 0x7F:
                action_length = stream.read('uintle:16')
            action_stream = stream.read('bits:{0}'.format(action_length*8))
            self.finally_body.append(ActionFactory.new_action(action_stream,
                                                              action_code,
                                                            action_length))    
Ejemplo n.º 10
0
 def parse(self,stream):
     self.type = stream.read('uintle:8')
     if self.type == 0:
         self.string = datatypes.string(stream)
     elif self.type == 1:
         self.float = stream.read('floatle:32')
     elif self.type == 4:
         self.register_number = stream.read('uintle:8')
     elif self.type == 5:
         self.boolean = stream.read('uintle:8')
     elif self.type == 6:
         self.double = stream.read('floatle:64')
     elif self.type == 7:
         self.integer = stream.read('uintle:32')
     elif self.type == 8:
         self.constant_8 = stream.read('uintle:8')
     elif self.type == 9:
         self.constant_16 = stream.read('uintle:16')
Ejemplo n.º 11
0
 def parse(self,stream):
     self.type = datatypes.UI8(stream)
     if self.type == 0:
         self.string = datatypes.string(stream)
     elif self.type == 1:
         self.float = datatypes.Float(stream)
     elif self.type == 4:
         self.register_number = datatypes.UI8(stream)
     elif self.type == 5:
         self.boolean = datatypes.UI8(stream)
     elif self.type == 6:
         self.double = datatypes.Double(stream)
     elif self.type == 7:
         self.integer = datatypes.UI32(stream)
     elif self.type == 8:
         self.constant_8 = datatypes.UI8(stream)
     elif self.type == 9:
         self.constant_16 = datatypes.UI16(stream)
Ejemplo n.º 12
0
 def parse(self,stream):
     self.has_clip_actions = stream.read('bool')
     self.has_clip_depth = stream.read('bool')
     self.has_name = stream.read('bool')
     self.has_ratio = stream.read('bool')
     self.has_color_transform = stream.read('bool')
     self.has_matrix = stream.read('bool')
     self.has_character = stream.read('bool')
     self.move = stream.read('bool')
     self.depth = datatypes.UI16(stream)
     if self.has_character:
         self.character_id = datatypes.UI16(stream)
     if self.has_matrix:
         self.matrix = datatypes.Matrix(stream)
     if self.has_color_transform:
         self.color_transform = datatypes.CxformWithAlpha(stream)
     if self.has_ratio:
         self.ratio = datatypes.UI16(stream)
     if self.has_name:
         self.name = datatypes.string(stream)
     if self.has_clip_depth:
         self.clip_depth = datatypes.UI16(stream)
     if self.has_clip_actions:
         self.clip_actions = datatypes.ClipActions(stream,self.swf_version)
Ejemplo n.º 13
0
 def parse(self,stream):
     self.count = datatypes.UI16(stream)
     self.constant_pool = []
     for i in range(0,self.count):
         self.constant_pool.append(datatypes.string(stream))
Ejemplo n.º 14
0
 def parse(self,stream):
     self.font_id = stream.read('uintle:16')
     self.font_name = datatypes.string(stream)
     self.font_copyright = datatypes.string(stream)
Ejemplo n.º 15
0
 def parse(self,stream):
     self.label = datatypes.string(stream)
Ejemplo n.º 16
0
 def parse(self,stream):
     self.target_name = datatypes.string(stream)
Ejemplo n.º 17
0
 def parse(self,stream):
     self.count = stream.read('uintle:16')
     self.constant_pool = []
     for i in range(0,self.count):
         self.constant_pool.append(datatypes.string(stream))
Ejemplo n.º 18
0
 def parse(self,stream):
     self.url_string = datatypes.string(stream)
     self.target_string = datatypes.string(stream)
Ejemplo n.º 19
0
 def parse(self,stream):
     self.font_id = datatypes.UI16(stream)
     self.font_name = datatypes.string(stream)
     self.font_copyright = datatypes.string(stream)
Ejemplo n.º 20
0
 def parse(self,stream):
     if self.length > 0:
         self.password_hash = datatypes.string(stream)
Ejemplo n.º 21
0
 def parse(self,stream):
     self.metadata = datatypes.string(stream)
Ejemplo n.º 22
0
 def parse(self,stream):
     stream.pos += 16
     self.password_hash = datatypes.string(stream)
Ejemplo n.º 23
0
 def parse(self,stream):
     self.name = datatypes.string(stream)
     if stream.pos < stream.length and stream.peek('uintle:8') == 1:
         self.is_named_anchor = True
     else:
         self.is_named_anchor = False