Exemple #1
0
    def from_bytes(b, little=True):
        header, b = ResChunk_header.from_bytes(b)
        stringCount, b = uint32.from_bytes(b, little=True)
        styleCount, b = uint32.from_bytes(b, little=True)
        flags, b = ResStringPool_header.Flags.from_bytes(b, little=True)
        stringsStart, b = uint32.from_bytes(b, little=True)
        stylesStart, b = uint32.from_bytes(b, little=True)

        return ResStringPool_header(header, stringCount, styleCount, flags,
                                    stringsStart, stylesStart), b
Exemple #2
0
    def from_bytes(b, little=True):
        header, b = ResChunk_header.from_bytes(b)
        id, b = uint8.from_bytes(b)
        res0, b = uint8.from_bytes(b)
        res1, b = uint16.from_bytes(b, True)
        entryCount, b = uint32.from_bytes(b, True)
        entriesStart, b = uint32.from_bytes(b, True)
        config, b = ResTable_config.from_bytes(b)

        return ResTable_type_header(header, id, res0, res1, entryCount,
                entriesStart, config), b
Exemple #3
0
    def from_bytes(b):
        header, b = ResChunk_header.from_bytes(b)
        id, b = uint32.from_bytes(b, little=True)
        name, b = b[:256], b[256:]
        typeStrings, b = uint32.from_bytes(b, little=True)
        lastPublicType, b = uint32.from_bytes(b, little=True)
        keyStrings, b = uint32.from_bytes(b, little=True)
        lastPublicKey, b = uint32.from_bytes(b, little=True)

        return ResTable_package_header(header, id, name, typeStrings,
                                       lastPublicType, keyStrings,
                                       lastPublicKey), b[4:]
Exemple #4
0
    def from_bytes(b, little=True):
        header, b = ResChunk_header.from_bytes(b)
        id, b = uint8.from_bytes(b)
        res0, b = uint8.from_bytes(b)
        res1, b = uint16.from_bytes(b, True)
        entryCount, b = uint32.from_bytes(b, True)

        return ResTable_typeSpec_header(header, id, res0, res1, entryCount), b
Exemple #5
0
    def from_bytes(b):
        size, b = uint32.from_bytes(b, little=True)
        restlen = size.integer - len(size)
        notimpl, b = b[:restlen], b[restlen:]  # TODO: implement

        obj = ResTable_config(size)
        obj.notimpl = notimpl

        return obj, b
Exemple #6
0
    def __init__(self,
                 size=0x30,
                 imsi=None,
                 locale=None,
                 screenType=None,
                 input=None,
                 screenSize=None,
                 version=None,
                 screenConfig=None,
                 screenSizeDp=None):
        notimpl = None
        if isinstance(size, uint32):
            ## Number of bytes in this structure
            self.size = size
        elif isinstance(size, bytes):
            # TODO: remove after full implementation
            self.size, notimpl = uint32.from_bytes(size, little=True)
        else:
            self.size = uint32(size, little=True)

        if notimpl is None:
            notimpl = bytes(self.size.integer - 4)
        self.notimpl = notimpl
Exemple #7
0
 def from_bytes(b, little=True):
     chunkType, b = ResourceType.from_bytes(b, little=True)
     headerSize, b = uint16.from_bytes(b, little=True)
     size, b = uint32.from_bytes(b, little=True)
     return ResChunk_header(chunkType, headerSize, size), b
Exemple #8
0
    def from_bytes(b, little=True):
        header, b = ResChunk_header.from_bytes(b)
        packageCount, b = uint32.from_bytes(b, little=True)

        return ResTable_header(header, packageCount), b