Skip to content

Commit

Permalink
add ubt-pwn
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-bro committed Jun 24, 2024
0 parents commit 44eb0a6
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Build & Push images"

on:
push:
paths:
- '.github/workflows/main.yml'
- 'Dockerfile'
branches:
- pwn
schedule:
# https://crontab.guru/#0_0_*_*_0
# At 00:00 on Sunday.
- cron: '0 0 * * 0'

jobs:
build:
strategy:
fail-fast: true
matrix:
tags:
- |
22.04
22
jammy
latest
uses: sky-bro/ubuntu-cn/.github/workflows/build-one-version.yml@master
with:
tags: |
${{ matrix.tags }}
registry_image: skybro/ubt-pwn
build-args: |
USERNAME=sky
PASSWORD=sky
secrets: inherit
1 change: 1 addition & 0 deletions .ssh/authorized_keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHzjaWZYhO/mECHZxz10URNXy2eVaPA+EEmE/PQds0KxLAFofHTQ5kp3zF26u/IfoZ1GwlcfSBA5pyf2d9SN7bV46vbv+xA0P8NJzcUWp57pNOjq5T6W2SVvFOgD2wp+Sn0oI8nfdO/YF5x1SaYW9mdr9ALg880gUpmKd+TXU3UagcYYkbza+YRG/NjHg3xuGY0EqoWgdYl/Q8Kextm+vq4gmKVkzsGYnvVw+Obp15dzKgK2w23rOrc291Z3noV0AdZVyK+F3lAUvCqiu9OAim7Ynx/UzUO7goeNDxRSxktMUhHgzIYVKIe2OfPR+FSqY+jDfHJkROkSvjwcMXi+sXoTwKzyo8jbwNniPAnfrzsrsiFqWim5+T4ir/kf+x900iqR2/gwR0pHzrHLiK1l6sqXlcQV10G8lvE/2On5COESzlM8+0lVTPzaSfvJx1g+rFijhyVGTfeLmJVq668PxtZDii79JXWMh6Jw7+p05+J9pAm0YuSylsjlkKLWB9gX20R6RnxjOlCR7h5mWd3327f9UraRr1EHJ03j+6UJuLg8QpYnWv+8MVU60+i69pHHMZEwzti1WTI3HtuTfm3Oe+D1+VP00K2+uZGgJiVZgzqX84/dImAdtksQFRtNZLpPxAhcrnm4EAf6k6Y26MDRkTJ01Sg0HXhWsnsmG1VkX1MQ== openpgp:0xD3ECB362
70 changes: 70 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FROM ubuntu:$VERSION

ENV DEBIAN_FRONTEND noninteractive

ARG USERNAME=foo
ARG PASSWORD=bar


# pre-install softwares
RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list && \
apt-get -y update && \
apt-get install -y lib32z1 apt-transport-https python3 python3-pip git \
libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev \
vim nano netcat openssh-server unzip make wget bison flex build-essential \
curl qemu qemu-system-x86 gcc gdb clang lldb tmux konsole

# enable ssh login
RUN rm -f /etc/service/sshd/down
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config &&\
sed -ri 's/#UseDNS\ no/UseDNS\ no/g' /etc/ssh/sshd_config && \
sed -ri "s/StrictModes yes/StrictModes no/g" /etc/ssh/sshd_config && \
sed -ri "s/UsePAM yes/UsePAM no/g" /etc/ssh/sshd_config

# enable login with password
RUN echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config

# set username and password
RUN groupadd ${USERNAME} && \
useradd -g ${USERNAME} ${USERNAME} -m -s /bin/bash && \
echo "${USERNAME}:${PASSWORD}" | chpasswd && \
echo "root:${PASSWORD}" | chpasswd

# enable ssh key login
ADD --chown=${USERNAME}:${USERNAME} .ssh /home/${USERNAME}/.ssh
# ADD --chown=root:root .ssh /home/${USERNAME}/.ssh
ADD .ssh /root/.ssh

# keep container running
RUN echo "#!/bin/sh\nservice ssh restart\nsleep infinity" > /root/start.sh
RUN chmod +x /root/start.sh

# enable sudo
RUN apt-get install -y sudo && \
usermod -aG sudo ${USERNAME}

# pwn-related tools
RUN python3 -m pip config set global.index-url http://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
python3 -m pip install -U pip && \
python3 -m pip install --no-cache-dir \
pwntools \
ropgadget \
z3-solver \
smmap2 \
apscheduler \
ropper \
unicorn \
keystone-engine \
capstone \
angr \
pebble \
r2pipe \
LibcSearcher

RUN git clone https://github.com/pwndbg/pwndbg && \
cd pwndbg && chmod +x setup.sh && ./setup.sh

CMD ["/root/start.sh"]

EXPOSE 22
13 changes: 13 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#+Title: Ubuntu Docker Image for PWN

* Build

put your public ssh key under

#+begin_src shell
#+end_src

* Run

#+begin_src shell
#+end_src

0 comments on commit 44eb0a6

Please sign in to comment.