FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386 && \ apt-get -y update && \ apt-get install -y software-properties-common && \ add-apt-repository -y universe && \ apt-get -y update
RUN apt-get install -y \ apt-transport-https \ vim \ nano \ git \ curl \ wget \ sudo \ netcat-openbsd \ openssh-server \ unzip \ bison \ flex \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
RUN useradd -m ubuntu && \ echo "ubuntu:123456" | chpasswd && \ echo "root:123456" | chpasswd && \ usermod -aG sudo ubuntu
RUN apt-get update && apt-get install -y \ build-essential \ zlib1g-dev \ libncurses5-dev \ libgdbm-dev \ libnss3-dev \ libssl-dev \ libreadline-dev \ libffi-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
RUN wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz \ && tar -xf Python-3.9.18.tgz \ && cd Python-3.9.18 \ && ./configure --prefix=/opt/python39 --enable-optimizations \ && make -j$(nproc) \ && make install \ && cd .. && rm -rf Python-3.9.18*
RUN /opt/python39/bin/python3.9 -m venv /opt/py39-venv \ && chown -R ubuntu:ubuntu /opt/py39-venv \ && echo "\n# 自动激活Python 3.9虚拟环境" >> /home/ubuntu/.bashrc \ && echo "source /opt/py39-venv/bin/activate" >> /home/ubuntu/.bashrc
RUN apt-get update && apt-get install -y \ build-essential \ libglib2.0-dev \ libfdt-dev \ libpixman-1-dev \ zlib1g-dev \ gcc-multilib \ gdb \ gdb-multiarch \ clang \ lldb \ make \ cmake \ nasm \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \ qemu-system-x86 \ qemu-user \ qemu-user-binfmt \ tmux \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \ lib32z1 \ libc6-dbg \ libc6-dbg:i386 \ libgcc1:i386 \ libstdc++6:i386 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
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 && \ echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
RUN git clone https://github.com/pwndbg/pwndbg /opt/pwndbg && \ cd /opt/pwndbg && \ git checkout 2024.08.29 && \ chmod +x setup.sh && \ ./setup.sh || true && \ echo "source /opt/pwndbg/gdbinit.py" >> /home/ubuntu/.gdbinit && \ chown -R ubuntu:ubuntu /opt/pwndbg
RUN /opt/py39-venv/bin/pip install --upgrade pip && \ /opt/py39-venv/bin/pip install \ pwntools \ ropgadget \ z3-solver \ smmap2 \ apscheduler \ ropper \ unicorn \ keystone-engine \ capstone \ angr \ pebble \ r2pipe \ LibcSearcher \ poetry \ && chown -R ubuntu:ubuntu /opt/py39-venv
RUN apt-get update && apt-get install -y \ git \ curl \ autoconf \ bison \ build-essential \ libssl-dev \ libyaml-dev \ libreadline6-dev \ zlib1g-dev \ libncurses5-dev \ libffi-dev \ libgdbm5 \ libgdbm-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/rbenv/rbenv.git /root/.rbenv \ && echo 'export PATH="/root/.rbenv/bin:$PATH"' >> /root/.bashrc \ && echo 'eval "$(rbenv init -)"' >> /root/.bashrc \ && /root/.rbenv/bin/rbenv init -
RUN git clone https://github.com/rbenv/ruby-build.git /root/.rbenv/plugins/ruby-build
RUN /root/.rbenv/bin/rbenv install 3.1.4 \ && /root/.rbenv/bin/rbenv global 3.1.4 \ && /root/.rbenv/bin/rbenv rehash
RUN /root/.rbenv/shims/gem install one_gadget
ENV PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
RUN echo "#!/bin/sh\nservice ssh restart\nsleep infinity" > /root/start.sh && \ chmod +x /root/start.sh
RUN apt-get clean && \ rm -rf /var/lib/apt/lists/*
CMD ["/root/start.sh"]
EXPOSE 22
|
sudo docker build -t pwnenv_ubuntu18 . sudo docker build --no-cache -t pwnenv_ubuntu18 .[dockerfile更改了,更新语句]
sudo docker run -d \ -p 28000:22 \ --name=pwn18 \ --cap-add=SYS_PTRACE \ -v ~/Desktop/PWN:/PWN \ pwnenv_ubuntu18
sudo docker start pwn18 sudo docker exec -w /PWN -e TERM=xterm-256color -it pwn18 bash#root sudo docker exec -w /PWN -e TERM=xterm-256color -u ubuntu -it pwn18 bash
|
sudo docker run -itd
-p 29000:22
–name=pwn-container
–privileged
–cap-add=SYS_PTRACE
-v ~/Desktop/pwnenv:/pwnenv
test
/bin/sh
sudo docker exec -w /pwnenv -e TERM=xterm-256color -it pwn-container /bin/sh