Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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))
Exemplo n.º 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
Exemplo n.º 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))
Exemplo n.º 6
0
def continue_exec(_view):
    binjatron.custom_request("command", _build_command_dict("continue"))
Exemplo n.º 7
0
def kill(_view):
    binjatron.custom_request("command", _build_command_dict("ki"), alert=False)
Exemplo n.º 8
0
def step_out(_view):
    binjatron.custom_request("command", _build_command_dict("finish"))
Exemplo n.º 9
0
def step_over(_view):
    binjatron.custom_request("command", _build_command_dict("ni"))
Exemplo n.º 10
0
def run_binary(_view):
    binjatron.custom_request("command", _build_command_dict("run"))
Exemplo n.º 11
0
def get_version(_view):
    return binjatron.custom_request("version", {})