Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release 2024.06] Fixes #1116

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/api/gef_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from tests.base import RemoteGefUnitTestGeneric

from tests.utils import (
ARCH,
debug_target,
gdbserver_session,
qemuuser_session,
Expand Down Expand Up @@ -135,6 +136,7 @@ def test_func_parse_maps_remote_gdbserver(self):
sections = gef.memory.maps
assert len(sections) > 0

@pytest.mark.skipif(ARCH not in ("x86_64",), reason=f"Skipped for {ARCH}")
def test_func_parse_maps_remote_qemu(self):
gdb, gef = self._gdb, self._gef
# When in a gef-remote qemu-user session `parse_gdb_info_proc_maps`
Expand Down
3 changes: 3 additions & 0 deletions tests/api/gef_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import pathlib
import random
import re
import pytest

from tests.base import RemoteGefUnitTestGeneric

from tests.utils import (
ARCH,
debug_target,
gdbserver_session,
qemuuser_session,
Expand Down Expand Up @@ -72,6 +74,7 @@ def test_root_dir_remote(self):
expected.st_ino == result.st_ino
)

@pytest.mark.skipif(ARCH not in ("x86_64",), reason=f"Skipped for {ARCH}")
def test_root_dir_qemu(self):
gdb, gef = self._gdb, self._gef

Expand Down
9 changes: 4 additions & 5 deletions tests/commands/canary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@ def setUp(self) -> None:
self._target = debug_target("canary")
return super().setUp()


def test_cmd_canary(self):
assert ERROR_INACTIVE_SESSION_MESSAGE == self._gdb.execute("canary", to_string=True)
self._gdb.execute("start")
res = self._gdb.execute("canary", to_string=True)
assert "The canary of process" in res
assert self._gef.session.canary[0] == self._gef.session.original_canary[0]


def test_overwrite_canary(self):
gdb, gef = self._gdb, self._gef

gdb.execute("start")
_, canary_address = gef.session.canary
if is_64b():
gef.memory.write(gef.arch.canary_address(), p64(0xdeadbeef))
gef.memory.write(canary_address, p64(0xDEADBEEF))
else:
gef.memory.write(gef.arch.canary_address(), p32(0xdeadbeef))
res = u32(gef.memory.read(gef.arch.canary_address(), gef.arch.ptrsize))
gef.memory.write(canary_address, p32(0xDEADBEEF))
res = u32(gef.memory.read(canary_address, gef.arch.ptrsize))
assert 0xdeadbeef == res
2 changes: 2 additions & 0 deletions tests/commands/gef_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from tests.base import RemoteGefUnitTestGeneric
from tests.utils import (
ARCH,
debug_target,
gdbserver_session,
qemuuser_session,
Expand Down Expand Up @@ -39,6 +40,7 @@ def test_cmd_gef_remote_gdbserver(self):
assert res.endswith(f"pid={gef.session.pid}, mode={gdbserver_mode})")

@pytest.mark.slow
@pytest.mark.skipif(ARCH not in ("x86_64",), reason=f"Skipped for {ARCH}")
def test_cmd_gef_remote_qemu_user(self):
gdb = self._gdb
gef = self._gef
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ScanCommand(RemoteGefUnitTestGeneric):
"""`scan` command test module"""

def setUp(self) -> None:
self._target = debug_target("checksec-no-pie")
self._target = debug_target("default")
return super().setUp()

def test_cmd_scan(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/vmmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def test_cmd_vmmap(self):
res = gdb.execute("vmmap stack", to_string=True)
self.assertGreater(len(res.splitlines()), 1)

res = gdb.execute("vmmap $rip", to_string=True)
res = gdb.execute("vmmap $pc", to_string=True)
self.assertEqual(len(res.splitlines()), 2)
Loading