Initial commit
This commit is contained in:
commit
3a7e6ddda1
4 changed files with 41 additions and 0 deletions
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM ubuntu:latest
|
||||
RUN mkdir /PWD
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y upgrade
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get -y install gdb gdbserver python3 python3-pip python-is-python3 libc6-i386
|
||||
RUN pip install pwntools
|
||||
ADD spawn-on-host-tmux.sh /bin/spawn-on-host-tmux.sh
|
||||
RUN chmod +x /bin/spawn-on-host-tmux.sh
|
||||
RUN ln -s /bin/spawn-on-host-tmux.sh /bin/pwntools-terminal
|
||||
WORKDIR /PWD
|
||||
ENTRYPOINT ["bash"]
|
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
|||
A small utility to spawn a podman container with pwntools and ability to spawn terminal tabs on the host terminal
|
2
spawn-on-host-tmux.sh
Normal file
2
spawn-on-host-tmux.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
echo $@ > /tmux-sock
|
26
spawn.sh
Executable file
26
spawn.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eou pipefail
|
||||
|
||||
pipe="$(mktemp -u)"
|
||||
trap "rm -f $pipe" EXIT
|
||||
mkfifo "$pipe"
|
||||
|
||||
label="tmux-host-container-id"="$(head -c 32 /dev/urandom | base64)"
|
||||
|
||||
function interact() {
|
||||
# Wait for the container to start
|
||||
container_id=""
|
||||
while [ -p "$pipe" ] && [ -z $container_id ]; do
|
||||
container_id="$(podman container ps -f label="$label" --format "{{ .ID }}")"
|
||||
done
|
||||
|
||||
while [ -p "$pipe" ]; do
|
||||
if read line; then
|
||||
echo $line
|
||||
tmux split podman exec -it "$container_id" $line
|
||||
fi
|
||||
done <"$pipe"
|
||||
}
|
||||
interact &
|
||||
container_name="pwntools"
|
||||
podman run --rm --security-opt seccomp=unconfined --cap-add=SYS_PTRACE --label="$label" -v $PWD:/PWD -v "$pipe":"/tmux-sock" -it "$container_name" $@
|
Loading…
Reference in a new issue