Пример #1
0
def get_registers(_view):
    res = binjatron.custom_request("registers", {
        "block": False,
        "deref": True
    },
                                   alert=False)
    if (res.is_error):
        log_error("Could not get registers!" + " -- " + res.message)
        return None, res.message
    return res.registers, res.deref
Пример #2
0
def get_memory(_view, address, length):
    res = binjatron.custom_request("memory", {
        "block": False,
        "address": address,
        "length": length
    },
                                   alert=False)
    if (res.is_error):
        log_error("Could not get memory at address ``" + str(address) +
                  " -- " + res.message)
        return None
    return res.memory
Пример #3
0
def set_arguments(arguments, _view):
    version = get_version(_view).host_version
    if 'gdb' in version:
        # Voltron doesn't like commands that aren't UTF-8, but for exploit work we're going to need
        # arbitary byte support. A named temporary file that we can source commands from is the best
        # solution I've come up with so far, despite the fact that it's inelegant.
        with tempfile.NamedTemporaryFile() as tempf:
            tempf.write('set args ')
            tempf.write(arguments)
            tempf.write('\n')
            tempf.flush()
            binjatron.custom_request(
                "command", _build_command_dict("source " + tempf.name))
    elif 'lldb' in version:
        with tempfile.NamedTemporaryFile() as tempf:
            tempf.write('settings set target.run-args ')
            tempf.write(arguments)
            tempf.write('\n')
            tempf.flush()
            binjatron.custom_request(
                "command", _build_command_dict("command source " + tempf.name))
Пример #4
0
def get_backtrace(_view):
    try:
        res = binjatron.custom_request("backtrace", {"block:": False},
                                       alert=False)
    except:
        import traceback
        traceback.print_exc()
        log_error(
            "Voltron encountered an exception while getting the backtrace. Maybe this is a stripped binary?"
        )
        return [{'index': 0, 'addr': 0, 'name': 'Exception! Voltron Bug?'}]
    if (res.is_error):
        log_error("Could not get backtrace -- " + res.message)
        return None
    return res.frames
Пример #5
0
def set_tty(_view, tty):
    version = get_version(_view).host_version
    if 'gdb' in version:
        binjatron.custom_request("command", _build_command_dict("tty " + tty))
    elif 'lldb' in version:
        binjatron.custom_request(
            "command",
            _build_command_dict("settings set target.input-path " + tty))
        binjatron.custom_request(
            "command",
            _build_command_dict("settings set target.output-path " + tty))
Пример #6
0
def continue_exec(_view):
    binjatron.custom_request("command", _build_command_dict("continue"))
Пример #7
0
def kill(_view):
    binjatron.custom_request("command", _build_command_dict("ki"), alert=False)
Пример #8
0
def step_out(_view):
    binjatron.custom_request("command", _build_command_dict("finish"))
Пример #9
0
def step_over(_view):
    binjatron.custom_request("command", _build_command_dict("ni"))
Пример #10
0
def run_binary(_view):
    binjatron.custom_request("command", _build_command_dict("run"))
Пример #11
0
def get_version(_view):
    return binjatron.custom_request("version", {})