예제 #1
0
    def _read_java_obj(cls, data, pos, ignore_remaining_data=False):
        data_stream = BytesIO(data[pos:])
        obj = javaobj.load(data_stream,
                           ignore_remaining_data=ignore_remaining_data)
        obj_size = data_stream.tell()

        return obj, pos + obj_size
예제 #2
0
def DecryptMetadata(arg, options):
    oOutput = InstantiateCOutput(options)

    oOutput.Line('Input: %s' % arg)
    arg = cCSInstructions(cCSInstructions.CS_INSTRUCTION_TYPE_METADATA,
                          options.transform).ProcessInstructions(arg.encode())
    oOutput.Line('Encrypted metadata: %s' % binascii.b2a_hex(arg).decode())

    if options.private != '':
        decrypted = RSADecrypt(options.private, arg)
        if decrypted != None:
            DecodeMetadata(decrypted, oOutput)
    elif options.file != '':
        if javaobj == None:
            print('javaobj module required: pip install javaobj-py3')
            exit(-1)
        pobj = javaobj.load(open(options.file, 'rb'))
        privateKey = binascii.b2a_hex(
            bytes([
                number & 0xFF
                for number in pobj.array.value.privateKey.encoded._data
            ])).decode()
        decrypted = RSADecrypt(privateKey, arg)
        if decrypted != None:
            DecodeMetadata(decrypted, oOutput)
    else:
        jsonData = GetJSONData()
        for publicKey, dPrivatekey in jsonData['dLookupValues']['7'].items():
            privateKey = dPrivatekey['verbose']
            decrypted = RSADecrypt(privateKey, arg)
            if decrypted != None:
                DecodeMetadata(decrypted, oOutput)
                break
예제 #3
0
def get_java_object(obj_file):
    with open(obj_file, 'rb') as fd:
        obj = javaobj.load(fd)
        return obj
예제 #4
0
파일: jks.py 프로젝트: gitter-badger/pyjks
def _read_java_obj(data, pos, ignore_remaining_data=False):
    data_stream = BytesIO(data[pos:])
    obj = javaobj.load(data_stream, ignore_remaining_data=ignore_remaining_data)
    obj_size = data_stream.tell()

    return obj, pos + obj_size
예제 #5
0
파일: jks.py 프로젝트: neonbunny/pyjks
def _read_java_obj(data, pos):
    data_stream = StringIO.StringIO(data[pos:])
    obj = javaobj.load(data_stream)
    obj_size = data_stream.tell()

    return obj, pos + obj_size
예제 #6
0
def _read_java_obj(data, pos):
    data_stream = StringIO.StringIO(data[pos:])
    obj = javaobj.load(data_stream)
    obj_size = data_stream.tell()

    return obj, pos + obj_size