vagd.virts.degd

Classes

Degd

Native Docker API backend with Docker exec and gdbserver integration.

Module Contents

class vagd.virts.degd.Degd(binary: str, image: str = DEFAULT_IMAGE, user: str = DEFAULT_USER, forward: Dict[str, Any] | None = None, packages: List[str] | None = None, cap_add: List[str] | None = None, privileged: bool = False, symbols: bool = True, files: str | List[str] | None = None, libs: bool = False, tmp: bool = False, rm: bool = True, fast: bool = False, ex: bool = False, **kwargs: Any)

Bases: vagd.virts.pwngd.Pwngd

Native Docker API backend with Docker exec and gdbserver integration.

Parameters:
  • binary – local binary to upload and execute

  • image – Debian or Ubuntu base image

  • user – user for target processes inside the container

  • forward – additional Docker port mappings

  • packages – additional packages installed while building the image

  • cap_add – Linux capabilities to add to the container

  • privileged – run the container with extended privileges

  • symbols – install libc debug symbols

  • files – additional files or directories to upload

  • libs – download the target’s dynamically linked libraries

  • tmp – use a fresh temporary working directory

  • rm – automatically remove the container when it stops

TYPE = 'degd'
LOCKFILE = './.vagd/docker-api.lock'
DOCKERHOME
DEFAULT_IMAGE = 'ubuntu:noble'
DEFAULT_USER = 'vagd'
WORKDIR = '/vagd'
GDBSERVER_PORT = 42069
DEFAULT_PACKAGES = ['gdbserver', 'python3', 'sudo']
is_new = False
_path = b'.'
_binary
_image = 'ubuntu:noble'
_user = 'vagd'
_forward
_cap_add = []
_privileged = False
_rm = True
_symbols = True
_packages = ['gdbserver', 'python3', 'sudo']
_client
_container
_workdir = '/vagd'
_ssh_setup() None

setup ssh connection

_configuration() Dict[str, Any]
_image_configuration() Dict[str, Any]
_build_directory() str
_create_dockerfile() str
_build_image() Any
_container_name() str
_create_container() None
_vm_setup() None

setup vagrant machine creates new one if no Vagrantfile is specified or box does not match

_run_wait(command: str | List[str], user: str | None = None) bytes
_remote_exists(path: str) bool
_sync(file: str) bool

upload file on remote if not exist :type file: file to upload :return: if the file was uploaded

static _archive(path: str) bytes
static put_to(container: Any, file: str, remote: str) None
put(file: str, remote: str | None = 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

static pull_from(container: Any, file: str, local: str | None = None) None
pull(file: str, local: str | None = 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: str) None

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:

which(program: str) str | None
process(argv: List[str] | None = None, command: List[str] | None = None, **kwargs: Any) vagd.virts.docker_exec.DockerExecTube

run binary in vm as process

Parameters:
  • argv – comandline arguments for binary

  • kwargs – pwntool parameters

Returns:

pwntools process

system(command: str | List[str]) vagd.virts.docker_exec.DockerExecTube

executes command on vm, interface to pwnlib.tubes.ssh.ssh.system

Parameters:

cmd – command to execute on vm

Returns:

returns

debug(argv: List[str] | None = None, gdb_args: List[str] | None = None, gdbscript: str = '', sysroot: str | None = None, sysroot_debug: str | None = None, api: bool = False, **kwargs: Any) vagd.virts.docker_exec.DockerExecTube

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

start(argv: List[str] | None = None, gdbscript: str = '', api: bool = False, sysroot: str | None = None, sysroot_debug: str | None = None, gdb_args: List[str] | None = None, **kwargs: Any) vagd.virts.docker_exec.DockerExecTube

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