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