Skip to content

Commit

Permalink
feat: add ubuntu-24.10
Browse files Browse the repository at this point in the history
  • Loading branch information
the-soloist committed Nov 26, 2024
1 parent fc7ecb1 commit b917b6f
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/docker-ubuntu-non-lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,34 @@ jobs:
file: ./build/ubuntu/non-lts/23.10/Dockerfile
push: true
tags: th3s/pwn-env:ubuntu-23.10

build-ubuntu2410:
if: |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ||
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/non-lts/24.10')
runs-on: ubuntu-latest
needs: [init-build-env]

steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: env-artifact
path: .

- name: Decompress Artifact
run: unzip artifact.zip -d .

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./
file: ./build/ubuntu/non-lts/24.10/Dockerfile
push: true
tags: th3s/pwn-env:ubuntu-24.10
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ docker compose -f docker-compose-dev.yml build <service-name>
| th3s/pwn-env:ubuntu-23.04 | Ubuntu 23.04 | 2.37 | 22304 -> 22 | 62304 -> 8888 |
| th3s/pwn-env:ubuntu-23.10 | Ubuntu 23.10 | 2.38 | 22310 -> 22 | 62310 -> 8888 |
| th3s/pwn-env:ubuntu-24.04 | Ubuntu 24.04 | 2.39 | 22404 -> 22 | 62404 -> 8888 |
| th3s/pwn-env:ubuntu-24.10 | Ubuntu 24.10 | 2.40 | 22410 -> 22 | 62410 -> 8888 |

#### compose volumes 映射

Expand Down
111 changes: 111 additions & 0 deletions build/ubuntu/non-lts/24.10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
FROM ubuntu:24.10

ENV TZ=Asia/Shanghai
ENV DEBIAN_FRONTEND noninteractive

RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list && \
cat <<EOF >> /etc/apt/sources.list.d/ubuntu.sources
# deb source package
Types: deb-src
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF

RUN apt-get update && apt-get -y dist-upgrade locales && \
apt-get install -y tzdata lib32z1 xinetd tcpdump && \
apt-get install sudo

RUN locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
# ENV LC_ALL zh_CN.UTF-8


### config user env ###
RUN useradd -m pwn

WORKDIR /home/pwn

RUN cp -R /usr/lib* /home/pwn

RUN mkdir /home/pwn/dev && \
mknod /home/pwn/dev/null c 1 3 && \
mknod /home/pwn/dev/zero c 1 5 && \
mknod /home/pwn/dev/random c 1 8 && \
mknod /home/pwn/dev/urandom c 1 9 && \
chmod 666 /home/pwn/dev/*

RUN mkdir /home/pwn/bin && \
cp /bin/sh /home/pwn/bin && \
cp /bin/ls /home/pwn/bin && \
cp /bin/cat /home/pwn/bin

RUN echo "Blocked by pwn-env-docker" > /etc/banner_fail

RUN chown -R root:pwn /home/pwn && \
chmod -R 750 /home/pwn


### config root env ###
WORKDIR /root

COPY ./config/bashrc /root/.bashrc
COPY ./config/pip /root/.pip
COPY ./docker/scripts/ /root/scripts/
COPY ./docker/tools/ /root/tools/
COPY ./docker/env/ /opt/env/

RUN dpkg --add-architecture i386
RUN apt-get update && \
apt-get install -y gcc g++ make python3 python3-pip ruby ruby-dev build-essential && \
apt-get install -y libc6-dbg libc6-dbg:i386 libseccomp-dev libgmp-dev libmpfr-dev libmpc-dev libssl-dev libffi-dev && \
apt-get install -y gdb gdbserver strace socat openssh-server net-tools iputils-ping && \
apt-get install -y git vim tmux wget curl sshfs

# temporary fix error: externally-managed-environment
RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bak

# install custom tools
RUN bash /opt/env/install.sh
RUN bash /opt/env/pyenv/install.sh

# install pwn tools
RUN pip3 install pip --upgrade --ignore-installed
RUN pip3 install prettytable colorama loguru tqdm && \
pip3 install ipdb websocket-client psutil requests redis && \
pip3 install gmpy2 pycryptodome && \
pip3 install z3-solver angr pwntools

RUN gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/ && \
gem install one_gadget && \
gem install seccomp-tools

RUN cd /root/tools/gdb/plugins/pwndbg && \
./setup.sh

RUN cp /root/tools/gdb/init/pwndbg.conf /root/.gdbinit

# download glibc source code
RUN mkdir /root/files && cd /root/files && \
apt source libc6-dev

# edit configurations
RUN sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config

# remove cached file
RUN rm -rf /root/.cache && \
rm -rf /root/.gem && \
rm -rf /root/.pip && \
rm -rf /root/files/glibc_* && \
rm -rf /tmp/scripts
RUN apt-get clean


### end ###
COPY ./docker/start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]

EXPOSE 22
EXPOSE 8888
18 changes: 18 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,24 @@ services:
- '22'
- '8888'

ubuntu-24.10:
container_name: pwn-env-dev_ubuntu-24.10
build:
context: ./
dockerfile: ./build/ubuntu/lts/24.10/Dockerfile
volumes:
- ./challenge:/challenge
- ./config:/root/.config
- ./deps:/deps
- ./share:/share
- ./ssh:/root/.ssh
ports:
- '22410:22'
- '62410:8888'
expose:
- '22'
- '8888'

networks:
devnet:
driver: bridge
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,19 @@ services:
expose:
- '22'
- '8888'

ubuntu-24.10:
image: th3s/pwn-env:ubuntu-24.10
container_name: pwn-env_ubuntu-24.10
volumes:
- ./challenge:/challenge
- ./config:/root/.config
- ./deps:/deps
- ./share:/share
- ./ssh:/root/.ssh
ports:
- '22410:22'
- '62410:8888'
expose:
- '22'
- '8888'

0 comments on commit b917b6f

Please sign in to comment.