Skip to main content

VirtuAlization GDb integrations in pwntools

Project description

PyPI docs

VAGD

VirtuAlization GDb integrations in pwntools

Installation

pip install vagd

or from repo with

git clone https://github.com/gfelber/vagd
pip install ./vagd/

Usage

use python -m vagd to generate a template

# run as process in VM
./exploit.py
# run as gdb server in VM requires tmux
./exploit.py GDB
# run on remote IP:PORT
./exploit.py REMOTE

I recommend using pwndbg.

Files

All created files ares stored in the local ./.vagd/ directory. Additional large files (e.g. cloudimages) are stored in the home directory ~/.vagd/ or handled by tools themselfs (e.g. Vagrant, Docker).

Recommendations

Consider adding these aliases to either ~./.bash_aliases, ~./.bashrc or other

alias vagd='python -m vagd'
# example use to ssh to guest
# vagdssh
alias vagdssh='VAGRANT_CWD=.vagd vagrant ssh'
# example use to copy flag.txt from host to guest (only works if Port is 2222)
# vagdscp ./flag.txt ./
vagdscp() {
  scp -P 2222 -o StrictHostKeyChecking=no -i ./vagd/.vagrant/machines/default/virtualbox/private_key ${@:3} $1 vagrant@localhost:$2
}
# example use to ssh to guest
# dogdssh
alias dogdssh='ssh -o "StrictHostKeyChecking=no" -i ~/.vagd/keyfile -p $(cut -d":" -f 2 .vagd/docker.lock) vagd@0.0.0.0'
# example use to copy flag.txt from host to guest
# dogdscp ./flag.txt
dogdscp() {
  scp -P $(cut -d":" -f 2 .vagd/docker.lock) -o StrictHostKeyChecking=no -i ~/.vagd/keyfile ${@:3} $1 vagd@localhost:$2
}
# example use to spawn shell in guest 
# dogdexec sh
alias dogdexec='docker exec -it $(cut ./.vagd/docker.lock -d":" -f 1)'
# example use to copy /etc/passwd from guest to host
# dogdcp /etc/passwd ./
dogdcp() {
  docker cp "$(cut ./.vagd/docker.lock -d":" -f 1):$1" $2
}
# example use to ssh to guest
# qegdssh
alias qegdssh='ssh -o "StrictHostKeyChecking=no" -i ~/.vagd/keyfile -p $(cat .vagd/qemu.lock) ubuntu@0.0.0.0'
# example use to copy flag.txt from host to guest
# qegdscp ./flag.txt
qegdscp() {
  scp -P $(cat .vagd/qemu.lock) -o StrictHostKeyChecking=no -i ~/.vagd/keyfile ${@:3} $1 ubuntu@localhost:$2
}

Documentation

Boxes

the following boxes were tested and work, box constants are inside vagd.box.Box

  • Vagrant
    • UBUNTU_JAMMY64 = 'ubuntu/jammy64'
    • UBUNTU_FOCAL64 = 'ubuntu/focal64'
    • UBUNTU_BIONIC64 = 'ubuntu/bionic64'
    • UBUNTU_XENIAL64 = 'ubuntu/xenial64'
  • QEMU (cached in ~/.vagd/qemu-imgs)
  • Docker
    • DOCKER_JAMMY = 'ubuntu:jammy'
    • DOCKER_FOCAL = 'ubuntu:focal'
    • DOCKER_BIONIC = 'ubuntu:bionic'
    • DOCKER_XENIAL = 'ubuntu:xenial'
    • DOCKER_ALPINE_316 = 'alpine:3.16.6'

currently only distributions that use apt and alpine for Docker are supported

Future plans

pre configured Vagrant boxes / QEMU Images / Docker Image

created pre configured environments with preinstalled lib debug symbols and gdbserver to lower init runtime.

Better Docker integration

created a Docker integration that allows loading existing Dockerfiles (maybe docker-compose), also add a feature that additionally virtualizes (Vagrant/Qemu) them to change the used kernel.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vagd-0.4.8.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

vagd-0.4.8-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file vagd-0.4.8.tar.gz.

File metadata

  • Download URL: vagd-0.4.8.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for vagd-0.4.8.tar.gz
Algorithm Hash digest
SHA256 6b42a25b49b5e275028db002bf810972a8289f1ccd147a878e532d26b38acbcd
MD5 388ec35b1b6a95143eb823160ca158ce
BLAKE2b-256 77f861fb3876866c9e3d8344d543af6bffe9268972b9204cd80466cdb354ae8d

See more details on using hashes here.

File details

Details for the file vagd-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: vagd-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for vagd-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1145b21600fe9ff465b58ba2c20d1e8474f4260fc94b3b4e0a7c2b355c7587a0
MD5 1d36e73efbca32059c4c910fa3534b07
BLAKE2b-256 d2994e2f172ad4b5b83797e56a53bbcba0fa99c2b288fe4df45cb59c75f6483a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page