Beispiel #1
0
#!/usr/bin/env python3

import sys
import os
import time

sys.path.append('/home/dmurik/qemu/python')
from qemu.qmp import QEMUMonitorProtocol

target_socket = sys.argv[1]
user_cmd = sys.argv[2]

print("--- Connecing to {}".format(target_socket))
srv = QEMUMonitorProtocol(target_socket)
srv.connect()

print("--- {}".format(user_cmd))
rsp = srv.cmd(user_cmd)
print(rsp)
srv.close()
Beispiel #2
0
    return rsp['return']


def shell_cmd(command_line):
    print(">>> Shell: {}".format(command_line))
    os.system(command_line)


target_socket = sys.argv[1]

print("--- Connecing to {}".format(target_socket))
srv = QEMUMonitorProtocol(target_socket)
srv.connect()

print("--- stopping")
rsp = srv.cmd("stop")
print(rsp)

info_registers = hmp_cmd(srv, "info registers")
hmp_cmd(srv, "info lapic")
hmp_cmd(srv, "info pic")
hmp_cmd(srv, "gva2gpa 0xfffffe0000000000")
hmp_cmd(srv, "gva2gpa 0xfffffe0000001000")
hmp_cmd(srv, "gva2gpa 0xfffffe0000003000")
hmp_cmd(srv, "x /32xg 0xfffffe0000000000")
hmp_cmd(srv, "x /16xg 0xfffffe0000001000")
hmp_cmd(srv, "x /32xg 0xfffffe0000003000")

hmp_cmd(srv, "savevm save3")

print("--- dump memory")
sys.path.append('/home/dmurik/qemu/python')
from qemu.qmp import QEMUMonitorProtocol

KB = 1024
MB = 1024 * KB
GB = 1024 * MB

target_socket = sys.argv[1]

print("--- Connecing to {}".format(target_socket))
srv = QEMUMonitorProtocol(target_socket)
srv.connect()

print("--- stop")
rsp = srv.cmd("stop")
print(rsp)

print("--- load part 1")
rsp = srv.cmd("pmemload", {
    "val": 0x0,
    "size": 0x80b000,
    "filename": "mem-dump-1.bin"
})
print(rsp)
print("--- load part 2")
rsp = srv.cmd("pmemload", {
    "val": 0x80e000,
    "size": 0x3F7F2000,
    "filename": "mem-dump-2.bin"
})