コード例 #1
0
    def __init__(self, parent, size):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self._data = [Bytes(self, 1)] * size
コード例 #2
0
    def __init__(self, parent, size):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self._data = [Bytes(self, 1)] * size
コード例 #3
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self._data = BytesArray(self, 0)
コード例 #4
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.size = Bytes(self, 4)

        self._data = [self.size]
コード例 #5
0
 def __init__(self, parent, string=""):
     '''
     Constructor
     '''
     Measurable.__init__(self, parent)
     self.utf16Size = Bytes(self, 1)
     self.string = BytesArray(self, 0)  # it is data from dump, but name is already reserved
     self.rawString = string
     self._data = [self.utf16Size, self.string]
     self.rawString = string
     self.setString(string)
コード例 #6
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.classIdx = Bytes(self, 2)
        self.protoIdx = Bytes(self, 2)
        self.nameIdx = Bytes(self, 4)

        self._data = [self.classIdx, self.protoIdx, self.nameIdx]
コード例 #7
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.line_start = Bytes(self, 4)
        self.parameters_size = Bytes(self, 4)
        self.debugOpcodes = []

        self._data = [self.line_start, self.parameters_size, self.debugOpcodes]
コード例 #8
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.classIdx = Bytes(self, 2)
        self.protoIdx = Bytes(self, 2)
        self.nameIdx = Bytes(self, 4)

        self._data = [self.classIdx, self.protoIdx, self.nameIdx]
コード例 #9
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.shorty_idx = Bytes(self, 4)
        self.return_type_idx = Bytes(self, 4)
        self.parameters_off = Bytes(self, 4)

        self._data = [self.shorty_idx, self.return_type_idx, self.parameters_off]
コード例 #10
0
 def __init__(self, parent, string=""):
     '''
     Constructor
     '''
     Measurable.__init__(self, parent)
     self.utf16Size = Bytes(self, 1)
     self.string = BytesArray(
         self, 0)  # it is data from dump, but name is already reserved
     self.rawString = string
     self._data = [self.utf16Size, self.string]
     self.rawString = string
     self.setString(string)
コード例 #11
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.type = Bytes(self, 2)
        self.unused = Bytes(self, 2)
        self.size = Bytes(self, 4)
        self.offset = Bytes(self, 4)

        self._data = [self.type, self.unused, self.size, self.offset]
コード例 #12
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.type = Bytes(self, 2)
        self.unused = Bytes(self, 2)
        self.size = Bytes(self, 4)
        self.offset = Bytes(self, 4)

        self._data = [self.type, self.unused, self.size, self.offset]
        
コード例 #13
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.shorty_idx = Bytes(self, 4)
        self.return_type_idx = Bytes(self, 4)
        self.parameters_off = Bytes(self, 4)

        self._data = [
            self.shorty_idx, self.return_type_idx, self.parameters_off
        ]
コード例 #14
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.registersSize = Bytes(self, 2)
        self.insSize = Bytes(self, 2)
        self.outsSize = Bytes(self, 2)
        self.triesSize = Bytes(self, 2)
        self.debugInfoOff = Bytes(self, 4)  # can it be 0 at all times?
        self.debugInfoOff.value = 0
        self.insnsSize = Bytes(self, 4)  # number of Bytes(self, 2) of instructions
        self.instructions = []

        self._data = [self.registersSize, self.insSize, self.outsSize, self.triesSize, self.debugInfoOff,
                      self.insnsSize, self.instructions]
コード例 #15
0
    def __init__(self):
        '''
        Constructor
        '''
        Measurable.__init__(self, None)  # Dex is the root

        self.header_item_section = HeaderItemSection(self)
        self.string_data_item_section = StringDataItemSection(self)
        self.string_id_item_section = StringIdItemSection(self)
        # data section has to be eariler, id section initializes with references
        self.type_id_item_section = TypeIdItemSection(self)
        self.type_list_section = TypeListSection(self)
        self.proto_id_item_section = ProtoIdItemSection(self)
        self.field_id_item_section = FieldIdItemSection(self)
        self.method_id_item_section = MethodIdItemSection(self)
        self.code_item_section = CodeItemSection(self)
        self.class_data_item_section = ClassDataItemSection(self)
        self.class_def_item_section = ClassDefItemSection(self)
        self.debug_info_item_section = DebugInfoItemSection(self)
        self.map_item_section = MapItemSection(self)

        self.header_item_section.initialize()
        self.initializeStringDataAndIdSections()
        # data section has to be eariler, id section initializes with references
        self.type_id_item_section.initialize()
        self.type_list_section.initialize()
        self.proto_id_item_section.initialize()
        self.field_id_item_section.initialize()
        self.method_id_item_section.initialize()
        self.code_item_section.initialize()
        self.class_data_item_section.initialize()
        self.class_def_item_section.initialize()
        self.debug_info_item_section.initialize()
        self.map_item_section.initialize()

        self._data = [
            self.header_item_section, self.string_id_item_section,
            self.type_id_item_section, self.proto_id_item_section,
            self.field_id_item_section, self.method_id_item_section,
            self.class_def_item_section, self.code_item_section,
            self.type_list_section, self.string_data_item_section,
            self.debug_info_item_section, self.class_data_item_section,
            self.map_item_section
        ]
コード例 #16
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.classIdx = Bytes(self, 4)
        self.accessFlags = Bytes(self, 4)
        self.superclassIdx = Bytes(self, 4)
        self.interfacesOff = Bytes(self, 4)
        self.sourceFileIdx = Bytes(self, 4)
        self.annotationsOff = Bytes(self, 4)
        self.classDataOff = Bytes(self, 4)
        self.staticValuesOff = Bytes(self, 4)

        self._data = [self.classIdx, self.accessFlags, self.superclassIdx, self.interfacesOff, self.sourceFileIdx,
                      self.annotationsOff,
                      self.classDataOff, self.staticValuesOff]
        
コード例 #17
0
    def __init__(self, parent, bytesCount, value=0):
        '''
        B 1 byte unsigned
        H 2 bytes unsigned
        I 4 bytes unsigned
        Q 8 bytes unsigned
        '''
        Measurable.__init__(self, parent)
        Reference.__init__(self)

        # print "Bytes parent: " + str(parent)

        self.bytesCountMap = {1: 'B', 2: 'H', 4: 'I', 8: 'Q'}
        if not bytesCount in self.bytesCountMap:
            raise InappropriateBytesCount()

        self._bytesCount = bytesCount
        self._value = value
        self._data = struct.pack(self.bytesCountMap.get(self._bytesCount), self._value)
コード例 #18
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.classIdx = Bytes(self, 4)
        self.accessFlags = Bytes(self, 4)
        self.superclassIdx = Bytes(self, 4)
        self.interfacesOff = Bytes(self, 4)
        self.sourceFileIdx = Bytes(self, 4)
        self.annotationsOff = Bytes(self, 4)
        self.classDataOff = Bytes(self, 4)
        self.staticValuesOff = Bytes(self, 4)

        self._data = [
            self.classIdx, self.accessFlags, self.superclassIdx,
            self.interfacesOff, self.sourceFileIdx, self.annotationsOff,
            self.classDataOff, self.staticValuesOff
        ]
コード例 #19
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.staticFieldsSize = ULeb128(self)
        self.instanceFieldsSize = ULeb128(self)
        self.directMethodsSize = ULeb128(self)
        self.virtualMethodsSize = ULeb128(self)
        self.staticFields = []
        self.instanceFields = []
        self.directMethods = []
        self.virtualMethods = []

        self._data = [
            self.staticFieldsSize, self.instanceFieldsSize,
            self.directMethodsSize, self.virtualMethodsSize, self.staticFields,
            self.instanceFields, self.directMethods, self.virtualMethods
        ]
コード例 #20
0
    def __init__(self, parent, bytesCount, value=0):
        '''
        B 1 byte unsigned
        H 2 bytes unsigned
        I 4 bytes unsigned
        Q 8 bytes unsigned
        '''
        Measurable.__init__(self, parent)
        Reference.__init__(self)

        # print "Bytes parent: " + str(parent)

        self.bytesCountMap = {1: 'B', 2: 'H', 4: 'I', 8: 'Q'}
        if not bytesCount in self.bytesCountMap:
            raise InappropriateBytesCount()

        self._bytesCount = bytesCount
        self._value = value
        self._data = struct.pack(self.bytesCountMap.get(self._bytesCount),
                                 self._value)
コード例 #21
0
ファイル: dex.py プロジェクト: PrzemekBurczyk/dalvik-compiler
    def __init__(self):
        '''
        Constructor
        '''
        Measurable.__init__(self, None)  # Dex is the root

        self.header_item_section = HeaderItemSection(self)
        self.string_data_item_section = StringDataItemSection(self)
        self.string_id_item_section = StringIdItemSection(self)
        # data section has to be eariler, id section initializes with references
        self.type_id_item_section = TypeIdItemSection(self)
        self.type_list_section = TypeListSection(self)
        self.proto_id_item_section = ProtoIdItemSection(self)
        self.field_id_item_section = FieldIdItemSection(self)
        self.method_id_item_section = MethodIdItemSection(self)
        self.code_item_section = CodeItemSection(self)
        self.class_data_item_section = ClassDataItemSection(self)
        self.class_def_item_section = ClassDefItemSection(self)
        self.debug_info_item_section = DebugInfoItemSection(self)
        self.map_item_section = MapItemSection(self)

        self.header_item_section.initialize()
        self.initializeStringDataAndIdSections()
        # data section has to be eariler, id section initializes with references
        self.type_id_item_section.initialize()
        self.type_list_section.initialize()
        self.proto_id_item_section.initialize() 
        self.field_id_item_section.initialize()
        self.method_id_item_section.initialize()
        self.code_item_section.initialize()
        self.class_data_item_section.initialize()
        self.class_def_item_section.initialize()
        self.debug_info_item_section.initialize()
        self.map_item_section.initialize()

        self._data = [self.header_item_section, self.string_id_item_section, self.type_id_item_section,
                      self.proto_id_item_section, self.field_id_item_section, self.method_id_item_section,
                      self.class_def_item_section,
                      self.code_item_section, self.type_list_section, self.string_data_item_section,
                      self.debug_info_item_section, self.class_data_item_section, self.map_item_section]
コード例 #22
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.magic = BytesArray(self, 8)
        self.checksum = Bytes(self, 4)
        self.signature = BytesArray(self, 20)
        self.file_size = Bytes(self, 4)
        self.header_size = Bytes(self, 4)
        self.endian_tag = Bytes(self, 4)
        self.link_size = Bytes(self, 4)
        self.link_offset = Bytes(self, 4)
        self.map_off = Bytes(self, 4)
        self.string_ids_size = Bytes(self, 4)
        self.string_ids_off = Bytes(self, 4)
        self.type_ids_size = Bytes(self, 4)
        self.type_ids_off = Bytes(self, 4)
        self.proto_ids_size = Bytes(self, 4)
        self.proto_ids_off = Bytes(self, 4)
        self.field_ids_size = Bytes(self, 4)
        self.field_ids_off = Bytes(self, 4)
        self.method_ids_size = Bytes(self, 4)
        self.method_ids_off = Bytes(self, 4)
        self.class_defs_size = Bytes(self, 4)
        self.class_defs_off = Bytes(self, 4)
        self.data_size = Bytes(self, 4)
        self.data_off = Bytes(self, 4)

        self._data = [
            self.magic, self.checksum, self.signature, self.file_size,
            self.header_size, self.endian_tag, self.link_size,
            self.link_offset, self.map_off, self.string_ids_size,
            self.string_ids_off, self.type_ids_size, self.type_ids_off,
            self.proto_ids_size, self.proto_ids_off, self.field_ids_size,
            self.field_ids_off, self.method_ids_size, self.method_ids_off,
            self.class_defs_size, self.class_defs_off, self.data_size,
            self.data_off
        ]
コード例 #23
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Measurable.__init__(self, parent)

        self.magic = BytesArray(self, 8)
        self.checksum = Bytes(self, 4)
        self.signature = BytesArray(self, 20)
        self.file_size = Bytes(self, 4)
        self.header_size = Bytes(self, 4)
        self.endian_tag = Bytes(self, 4)
        self.link_size = Bytes(self, 4)
        self.link_offset = Bytes(self, 4)
        self.map_off = Bytes(self, 4)
        self.string_ids_size = Bytes(self, 4)
        self.string_ids_off = Bytes(self, 4)
        self.type_ids_size = Bytes(self, 4)
        self.type_ids_off = Bytes(self, 4)
        self.proto_ids_size = Bytes(self, 4)
        self.proto_ids_off = Bytes(self, 4)
        self.field_ids_size = Bytes(self, 4)
        self.field_ids_off = Bytes(self, 4)
        self.method_ids_size = Bytes(self, 4)
        self.method_ids_off = Bytes(self, 4)
        self.class_defs_size = Bytes(self, 4)
        self.class_defs_off = Bytes(self, 4)
        self.data_size = Bytes(self, 4)
        self.data_off = Bytes(self, 4)

        self._data = [self.magic, self.checksum, self.signature, self.file_size, self.header_size, self.endian_tag,
                      self.link_size,
                      self.link_offset, self.map_off, self.string_ids_size, self.string_ids_off, self.type_ids_size,
                      self.type_ids_off,
                      self.proto_ids_size, self.proto_ids_off, self.field_ids_size, self.field_ids_off,
                      self.method_ids_size,
                      self.method_ids_off, self.class_defs_size, self.class_defs_off, self.data_size, self.data_off]
コード例 #24
0
    def __init__(self, parent):
        Measurable.__init__(self, parent)
        self.address_diff = Bytes(self, 4)
        self.line_diff = Bytes(self, 4)

        self._data = [self.address_diff, self.line_diff]
コード例 #25
0
 def __init__(self, parent):
     '''
     Constructor
     '''
     Measurable.__init__(self, parent)
コード例 #26
0
 def __init__(self, parent):
     '''
     Constructor
     '''
     Measurable.__init__(self, parent)
コード例 #27
0
    def __init__(self, parent):
        Measurable.__init__(self, parent)
        self.fieldIdxDiff = ULeb128(self)
        self.accessFlags = ULeb128(self)

        self._data = [self.fieldIdxDiff, self.accessFlags]