Skip to content

Commit

Permalink
feat: add ubuntu-24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
the-soloist committed May 31, 2024
1 parent cfacdfe commit 737570a
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/docker-ubuntu-lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,31 @@ jobs:
file: ./build/ubuntu/lts/22.04/Dockerfile
push: true
tags: th3s/pwn-env:ubuntu-22.04

build-ubuntu2404:
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@v3
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/lts/24.04/Dockerfile
push: true
tags: th3s/pwn-env:ubuntu-24.04
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ docker compose -f docker-compose-dev.yml build <service-name>
| th3s/pwn-env:ubuntu-22.10 | Ubuntu 22.10 | 2.36 | 22210 -> 22 | 62210 -> 8888 |
| 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 23.10 | 2.39 | 22404 -> 22 | 62404 -> 8888 |

#### compose volumes 映射

Expand Down Expand Up @@ -166,7 +167,7 @@ bash ./xinetd.sh
- 配置:
- 默认 prefix 为 C-x
- gem
- 默认源:https://gems.ruby-china.com
- 默认源:https://mirrors.tuna.tsinghua.edu.cn/rubygems
- apt
- 默认源:http://mirrors.tuna.tsinghua.edu.cn

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

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 && \
sed -i "s/http:\/\/security.ubuntu.com/http:\/\/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list && \
sed -i "s/# deb-src/deb-src/g" /etc/apt/sources.list && \
sed -i "s/^[^#].*archive\.canonical\.com*/#&/g" /etc/apt/sources.list

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

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 ./docker/scripts/ /root/scripts/
COPY ./docker/tools/ /root/tools/
COPY ./config/bashrc /root/.bashrc
COPY ./config/pip /root/.pip

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 socat openssh-server net-tools iputils-ping && \
apt-get install -y git vim tmux wget curl

# install pwn tools
RUN pip3 install pip --upgrade
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

# install custom tools
COPY ./docker/env/ /tmp/env/
RUN bash /tmp/env/install.sh

# 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 @@ -281,6 +281,24 @@ services:
networks:
- devnet

ubuntu-24.04:
container_name: pwn-env-dev_ubuntu-24.04
build:
context: ./
dockerfile: ./build/ubuntu/lts/24.04/Dockerfile
volumes:
- ./challenge:/challenge
- ./config:/root/.config
- ./deps:/deps
- ./share:/share
- ./ssh:/root/.ssh
ports:
- '22404:22'
- '62404: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 @@ -224,3 +224,19 @@ services:
expose:
- '22'
- '8888'

ubuntu-24.04:
image: th3s/pwn-env:ubuntu-24.04
container_name: pwn-env_ubuntu-24.04
volumes:
- ./challenge:/challenge
- ./config:/root/.config
- ./deps:/deps
- ./share:/share
- ./ssh:/root/.ssh
ports:
- '22404:22'
- '62404:8888'
expose:
- '22'
- '8888'
2 changes: 2 additions & 0 deletions scripts/build-lts-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function remove_images() {
docker rmi th3s/pwn-env:ubuntu-18.04
docker rmi th3s/pwn-env:ubuntu-20.04
docker rmi th3s/pwn-env:ubuntu-22.04
docker rmi th3s/pwn-env:ubuntu-24.04
}

docker compose down
Expand All @@ -28,3 +29,4 @@ docker compose pull ubuntu-16.04
docker compose pull ubuntu-18.04
docker compose pull ubuntu-20.04
docker compose pull ubuntu-22.04
docker compose pull ubuntu-24.04

0 comments on commit 737570a

Please sign in to comment.