예제 #1
0
from util import proctal_cli, sleeper

codes = {
    "x86-64":
    """
        mov rax, 0x{address}
        mov DWORD PTR [rax], {value}
    """
}

with sleeper.run() as guinea:
    address = proctal_cli.allocate(guinea.pid(), 14)

    type = proctal_cli.TypeInteger(bits=32)
    value = proctal_cli.ValueInteger(type)
    value.parse(0)

    proctal_cli.write(guinea.pid(), address, type, value)

    proctal_cli.execute(guinea.pid(),
                        codes["x86-64"].format(address=str(address), value=1))

    reader = proctal_cli.read(guinea.pid(), address, type)
    read = reader.next_value()
    reader.stop()

    if read.cmp(value) == 0:
        exit("Value was not overwritten.")
예제 #2
0
            try:
                writer.write_value(self.value)
                writer.stop()

                reader = proctal_cli.read(guinea.pid(), address, self.type)

                try:
                    value = reader.next_value()

                    if self.value.cmp(value) != 0:
                        raise Error("Expected {expected} but got {found}.".format(expected=self.value, found=value))
                finally:
                    reader.stop()
            finally:
                writer.stop()
        finally:
            proctal_cli.deallocate(guinea.pid(), address)

int32 = proctal_cli.TypeInteger(32);
int32_test_val = proctal_cli.ValueInteger(int32)
int32_test_val.parse(0x0ACC23AA)

tests = [
    TestSingleValue(int32, int32_test_val)
]

with sleeper.run() as guinea:
    for test in tests:
        test.run(guinea)
예제 #3
0
        super().__init__(message)


class UnexpectedTotalMatches(Error):
    def __init__(self, expected, found):
        self.expected = expected
        self.found = found

        message = "Expected {expected} matches but found {found}.".format(
            expected=self.expected, found=self.found)

        super().__init__(message)


test_type = proctal_cli.TypeInteger(32)
test_value = proctal_cli.ValueInteger(test_type)
test_value.parse(0x7FDDCCAA)
test_pattern = "AA CC DD 7F"

with sleeper.run() as guinea:
    length = 10
    byte_length = length * test_value.size()

    address = proctal_cli.allocate(guinea.pid(), byte_length)

    proctal_cli.write(guinea.pid(),
                      address,
                      test_type,
                      test_value,
                      array=length)