vagd.virts.pwngd
Classes
start binary on remote and return pwnlib.tubes.process.process |
Module Contents
- class vagd.virts.pwngd.Pwngd(binary: str, libs: bool = False, files: str | list[str] | None = None, packages: List[str] | None = None, symbols: bool = True, tmp: bool = False, gdbsrvport: int = 0, root: bool = False, fast: bool = False, ex: bool = False)
Bases:
abc.ABC
start binary on remote and return pwnlib.tubes.process.process
- Parameters:
binary – binary for VM debugging
libs – download libraries (using ldd) from VM
files – other files or directories that need to be uploaded to VM
packages – packages to install on vm
symbols – additionally install libc6 debug symbols
tmp – if a temporary directory should be created for files
gdbsrvport – specify static gdbserver port, REQURIES port forwarding to localhost
fast – mounts libs locally for faster symbol extraction (experimental)
ex – if experimental features should be enabled
- LOCAL_DIR = './.vagd/'
- HOME_DIR
- SYSROOT = './.vagd/sysroot/'
- SYSROOT_LIB_DEBUG = './.vagd/sysroot/lib/debug'
- LOCKFILE = './.vagd/vagd.lock'
- KEYFILE
- PUBKEYFILE
- DEFAULT_PORT = 2222
- STATIC_GDBSRV_PORT = 42069
- is_new: bool = False
- _path: str
- _gdbsrvport: int
- _binary: str
- _ssh: pwnlib.tubes.ssh.ssh
- _experimental: bool
- _fast: bool
- abstract _vm_setup() None
setup vagrant machine creates new one if no Vagrantfile is specified or box does not match
- abstract _ssh_setup() None
setup ssh connection
- _sync(file: str) bool
upload file on remote if not exist :type file: file to upload :return: if the file was uploaded
- _SSHFS_TEMPLATE = 'sshfs -p {port} -o StrictHostKeyChecking=no,ro,IdentityFile={keyfile}...
- _mount(remote_dir: str, local_dir: str) None
mount remote dir on local wiith sshfs :param remote_dir: directory on remote to mount :param local_dir: local mount point
- _lock(typ: str)
- _mount_root(remote_lib: str = '/') None
mount the lib directory of remote
- system(cmd: str) pwnlib.tubes.ssh.ssh_channel
executes command on vm, interface to pwnlib.tubes.ssh.ssh.system
- Parameters:
cmd – command to execute on vm
- Returns:
returns
- DEFAULT_PACKAGES = ['gdbserver', 'python3', 'sudo']
- LIBC6_DEBUG = 'libc6-dbg'
- LIBC6_I386 = 'libc6-i386'
- _install_packages(packages: Iterable[str])
install packages on remote machine
- Parameters:
packages – packages to install on remote machine
- put(file: str, remote: str | None = None)
upload file or dir on vm,
- Parameters:
file – file to upload
remote – remote location of file, working directory if not specified
- Returns:
returns
- pull(file: str, local: str | None = None)
download file or dir on vm,
- Parameters:
file – remote location of file, working directory if not specified
local – local location of file, current directory if not specified
- Returns:
returns
- LIBS_DIRECTORY = 'libs'
- libs(directory: str)
Downloads the libraries referred to by a file. This is done by running ldd on the remote server, parsing the output and downloading the relevant files.
directory(str): Output directory :return:
- debug(argv: list[str] | None = None, gdb_args: list[str] | None = None, gdbscript: str = '', sysroot: str | None = None, sysroot_debug: str | None = None, **kwargs: Any) pwnlib.tubes.ssh.ssh_channel
run binary in vm with gdb (pwnlib feature set)
- Parameters:
argv – comandline arguments for binary
gdb_args – gdb args to forward to gdb
gdbscript – GDB script for GDB
sysroot – sysroot dir
sysroot_debug – sysroot debug lib dir
kwargs – pwntool parameters
- Returns:
pwntools process
- process(argv: list[str] | None = None, **kwargs: Any) pwnlib.tubes.ssh.ssh_channel
run binary in vm as process
- Parameters:
argv – comandline arguments for binary
kwargs – pwntool parameters
- Returns:
pwntools process
- start(argv: list[str] = None, gdbscript: str = '', api: bool = False, sysroot: str | None = None, sysroot_debug: str | None = None, gdb_args: list[str] | None = None, **kwargs: Any) pwnlib.tubes.ssh.ssh_channel
start binary on remote and return pwnlib.tubes.process.process
- Parameters:
argv – commandline arguments for binary
gdbscript – GDB script for GDB
api – if GDB API should be enabled
sysroot – sysroot dir
sysroot_debug – sysroot debug lib dir
gdb_args – extra gdb args
kwargs – pwntool parameters
- Returns:
pwntools process, if api=True tuple with gdb api