Skip to content

Commit 068bf34

Browse files
committed
1.4.1 bug fixes
+ Fixed #6: now sshfs mount entire root directory
1 parent b29c0b9 commit 068bf34

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vagd"
3-
version = "1.4.0"
3+
version = "1.4.1"
44
authors = [{ name = "0x6fe1be2" }]
55
description = "VirtuAlization GDb integrations in pwntools"
66
readme = "README.md"

src/vagd/virts/pwngd.py

+8-13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from shutil import which
66
from typing import Union, Dict, Iterable, List
77

8+
from paramiko import util
89
import pwnlib.args
910
import pwnlib.filesystem
1011
import pwnlib.gdb
@@ -30,8 +31,6 @@ class Pwngd(ABC):
3031
HOME_DIR = os.path.expanduser('~/.local/share/vagd/')
3132
SYSROOT = LOCAL_DIR + 'sysroot/'
3233
LOCKFILE = LOCAL_DIR + 'vagd.lock'
33-
SYSROOT_LIB = SYSROOT + 'lib/'
34-
SYSROOT_LIB_DEBUG = SYSROOT + 'lib/debug'
3534
KEYFILE = HOME_DIR + 'keyfile'
3635
PUBKEYFILE = KEYFILE + '.pub'
3736
DEFAULT_PORT = 2222
@@ -98,15 +97,15 @@ def _lock(self, typ: str):
9897
with open(Pwngd.LOCKFILE, 'w') as lfile:
9998
lfile.write(typ)
10099

101-
def _mount_lib(self, remote_lib: str = '/usr/lib') -> None:
100+
def _mount_root(self, remote_lib: str = '/') -> None:
102101
"""
103102
mount the lib directory of remote
104103
"""
105-
if not (os.path.exists(Pwngd.SYSROOT) and os.path.exists(Pwngd.SYSROOT_LIB)):
106-
os.makedirs(Pwngd.SYSROOT_LIB)
107-
if not os.path.ismount(Pwngd.SYSROOT_LIB):
104+
if not os.path.exists(Pwngd.SYSROOT):
105+
os.makedirs(Pwngd.SYSROOT)
106+
if not os.path.ismount(Pwngd.SYSROOT):
108107
helper.info('mounting libs in sysroot')
109-
self._mount(remote_lib, Pwngd.SYSROOT_LIB)
108+
self._mount(remote_lib, Pwngd.SYSROOT)
110109

111110
def system(self, cmd: str) -> pwnlib.tubes.ssh.ssh_channel:
112111
"""
@@ -129,7 +128,7 @@ def _install_packages(self, packages: Iterable):
129128
"""
130129
self.system("sudo apt update").recvall()
131130
packages_str = " ".join(packages)
132-
self.system(f"sudo NEEDRESTART_MODE=a apt install -y {packages_str}").recvall()
131+
self.system(f"sudo DEBIAN_FRONTEND=noninteractive apt install -y {packages_str}").recvall()
133132

134133
def put(self, file: str, remote: str = None):
135134
"""
@@ -230,7 +229,7 @@ def __init__(self,
230229

231230
if self._fast:
232231
if self._experimental:
233-
self._mount_lib()
232+
self._mount_root()
234233
else:
235234
helper.error('requires experimental features, activate with ex=True')
236235

@@ -309,12 +308,8 @@ def debug(self,
309308

310309
if self._fast:
311310
gdb_args += ["-ex", f"set sysroot {pathlib.Path().resolve()}/{Pwngd.SYSROOT}"]
312-
gdbscript = f"set debug-file-directory {Pwngd.SYSROOT_LIB_DEBUG}\n" + gdbscript
313311
elif sysroot:
314312
gdb_args += ["-ex", f"set sysroot {sysroot}"]
315-
gdbscript = f"set debug-file-directory ./{sysroot}/lib/debug\n" + gdbscript
316-
else:
317-
gdbscript = "set debug-file-directory /lib/debug\n" + gdbscript
318313

319314
gdb_args += ["-ex", f"file -readnow {self._path}"]
320315

0 commit comments

Comments
 (0)