Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaipre committed Jun 7, 2024
1 parent 7a904ec commit 05c22dc
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 88 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SHELL=/bin/zsh
#PATH="/root/.cargo/bin:${PATH}"
7 changes: 4 additions & 3 deletions to-do/zshrc → .zshrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export PS1='%B%f%1~%F{red} %bpwn%B $%f%b '
# credits: https://github.com/joleeee/pwnbox
export PS1='%B%f%1~%F{red} %bpwnbox%B $%f%b '

# save everything
export HISTFILE=~/.zsh_history
Expand Down Expand Up @@ -28,5 +29,5 @@ alias la='ls -A'
alias l='ls -CF'
alias tmux='tmux -u'

. "$HOME/.cargo/env"

#. "$HOME/.cargo/env"
PATH=$PATH:/home/user/.cargo/bin
24 changes: 21 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ RUN dpkg --add-architecture i386 && \
cargo \
cmake \
cpio \
curl \
file \
g++-multilib \
gawk \
gcc \
gdb \
gdb-multiarch \
gdbserver \
Expand All @@ -37,6 +39,7 @@ RUN dpkg --add-architecture i386 && \
liblzma-dev \
libmpc-dev \
libssl-dev \
locales \
ltrace \
nasm \
net-tools \
Expand Down Expand Up @@ -67,7 +70,11 @@ RUN dpkg --add-architecture i386 && \
# Fix time zone
RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Fix locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

# Install radare2
RUN version=$(curl -s https://api.github.com/repos/radareorg/radare2/releases/latest | grep -P '"tag_name": "(.*)"' -o| awk '{print $2}' | awk -F"\"" '{print $2}') && \
Expand All @@ -89,7 +96,6 @@ RUN apt-get install libreadline6-dev -y && \
RUN gem install one_gadget seccomp-tools && rm -rf /var/lib/gems/2.*/cache/*

# Download prebuilt glibc versions for debugging by skysider
# TODO: Figure out if we can just use https://libc.rip and https://libc.blukat.me instead...
COPY --from=skysider/glibc_builder64:2.19 /glibc/2.19/64 /glibc/2.19/64
COPY --from=skysider/glibc_builder32:2.19 /glibc/2.19/32 /glibc/2.19/32

Expand Down Expand Up @@ -143,29 +149,40 @@ RUN mkdir -p $RESOURCES && chown -R $USER:$USER $RESOURCES
USER $USER
WORKDIR /home/$USER

# Install Oh My zsh and add .zshrc
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
COPY .zshrc /home/$USER/.zshrc

# Install nice-to-have tools with pip
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install --no-cache-dir --user \
angr \
apscheduler \
binsync \
capstone \
cryptography \
decomp2dbg \
keystone-engine \
pebble \
pwntools \
pycryptodome \
requests \
r2pipe \
ropgadget \
ropper \
smmap2 \
unicorn \
z3-solver

# Install new Rust version
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Install pwninit
#RUN wget https://github.com/io12/pwninit/releases/download/3.2.0/pwninit -P /home/$USER/.local/bin/ && \
# chmod +x /home/$USER/.local/bin/pwninit
RUN cargo install pwninit


# Install useful plugins for gdb
RUN mkdir ~/.gdb-plugins && \
git clone --depth 1 https://github.com/pwndbg/pwndbg.git .gdb-plugins/pwndbg && \
Expand All @@ -174,6 +191,7 @@ RUN mkdir ~/.gdb-plugins && \
git clone --depth 1 https://github.com/hugsy/gef.git .gdb-plugins/gef && \
git clone --depth 1 https://github.com/scwuaptx/Pwngdb.git .gdb-plugins/Pwngdb && \
curl -O "https://gist.githubusercontent.com/nicolaipre/df88b22bb0658b6719a92a73175638a2/raw/1e61ad6d4d9fbc1a97fc48b1a74f3a0e511d505e/.gdbinit"
# RUN git clone https://github.com/pwndbg/pwndbg && cd pwndbg && ./setup.sh

# Download statically compiled gdbserver binaries for different architectures.
# Copy a gdbserver to a remote host or container for remote debugging or just use qemu.
Expand All @@ -199,4 +217,4 @@ RUN wget https://github.com/slimm609/checksec.sh/archive/refs/tags/2.5.0.zip -P

RUN ln -s $RESOURCES ~/resources

ENTRYPOINT ["bash"]
ENTRYPOINT ["/bin/zsh"]
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ despawn:
docker compose down

shell:
docker exec -it pwndocker /bin/bash
docker exec -it pwnbox /bin/bash

spawn:
docker compose up -d
#docker run -d --cap-add all --privileged --name pwnbox --mount 'type=volume,src=pwnbox-chals,dst=/chals' pwnbox sleep infinity
@#docker run -d --cap-add all --privileged --name pwnbox --mount 'type=volume,src=pwnbox-chals,dst=/chals' pwnbox sleep infinity

start:
docker compose start

stop:
docker compose stop

status:
docker ps -a
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pwnbox

[![Actions Status](https://github.com/nicolaipre/pwnbox/workflows/pwnbox/badge.svg)](https://github.com/nicolaipre/pwnbox/actions)
<a href="https://github.com/nicolaipre/pwnbox/actions"><img src="https://github.com/nicolaipre/pwnbox/workflows/Docker%20Image%20CI/badge.svg" alt="Build Status"></a>

add `man`?
[![](https://github.com/nicolaipre/pwnbox/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/nicolaipre/pwnbox/actions)

Heavily based on (pretty much ripped) [pwndocker](https://github.com/skysider/pwndocker).

Expand All @@ -20,6 +20,10 @@ $ go 16.04
# ubuntu:12.04
```

## To-Do
- [ ] Figure out if we can just use https://libc.rip and https://libc.blukat.me instead...


### Usage
```shell
# build
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ services:
pwn:
container_name: pwnbox
image: pwnbox
hostname: pwnbox
stdin_open: true
tty: true
build:
Expand Down
29 changes: 0 additions & 29 deletions to-do/Dockerfile.jole

This file was deleted.

49 changes: 0 additions & 49 deletions to-do/gdbinit.txt

This file was deleted.

0 comments on commit 05c22dc

Please sign in to comment.