@@ -5,8 +5,8 @@ ENV HISTFILE=/home/pwntools/.history
55
66# Uninstall existing versions of pwntools
77USER root
8- RUN python -m pip uninstall -q -y pwntools \
9- && python3 -m pip uninstall -q -y pwntools
8+ RUN python2.7 -m pip uninstall -q -y pwntools \
9+ && python3 -m pip uninstall -q -y pwntools
1010
1111# Switch back to the pwntools user from here forward
1212USER pwntools
@@ -18,20 +18,23 @@ ENV PATH="/home/pwntools/.local/bin:${PATH}"
1818
1919# Install Pwntools to the home directory, make it an editable install
2020RUN git clone https://github.com/Gallopsled/pwntools \
21- && python -m pip install --upgrade --editable pwntools \
21+ && python2.7 -m pip install --upgrade --editable pwntools \
2222 && python3 -m pip install --upgrade --editable pwntools \
2323 && PWNLIB_NOTERM=1 pwn version
2424
2525# Requirements for running the tests
26- RUN python -m pip install --upgrade --requirement pwntools/docs/requirements.txt \
27- && python3 -m pip install --upgrade --requirement pwntools/docs/requirements.txt
26+ RUN python2.7 -m pip install --upgrade --requirement pwntools/docs/requirements.txt \
27+ && python3 -m pip install --upgrade --requirement pwntools/docs/requirements.txt
2828
2929# Python niceties for debugging
30- RUN python -m pip install -U ipython ipdb \
31- && python3 -m pip install -U ipython ipdb
30+ RUN python2.7 -m pip install -U ipython ipdb \
31+ && python3 -m pip install -U ipython ipdb
3232
3333# Dependencies from .travis.yml addons -> apt -> packages
34- RUN sudo apt-get update && sudo apt-get install -y \
34+ ARG DEBIAN_FRONTEND=noninteractive
35+ ENV TZ="UTC"
36+ RUN sudo apt-get update && sudo -E apt-get install -y \
37+ tzdata \
3538 ash \
3639 bash \
3740 bash-static \
@@ -41,7 +44,7 @@ RUN sudo apt-get update && sudo apt-get install -y \
4144 dash \
4245 gcc \
4346 gcc-multilib \
44- gdb \
47+ gdb \
4548 ksh \
4649 lib32stdc++6 \
4750 libc6-dev-i386 \
@@ -51,20 +54,17 @@ RUN sudo apt-get update && sudo apt-get install -y \
5154 socat \
5255 sshpass \
5356 vim \
54- zsh
55-
57+ zsh \
5658# Misc useful things when developing
57- RUN sudo apt-get install -y \
5859 curl \
59- ipython \
6060 ipython3 \
6161 lsb-release \
6262 ssh \
6363 unzip \
6464 wget
6565
6666# Use zsh by default
67- RUN sudo chsh -s /bin/zsh pwntools
67+ RUN sudo -E chsh -s /bin/zsh pwntools
6868
6969# Get and install prezto
7070RUN git clone --recursive https://github.com/sorin-ionescu/prezto.git .zprezto
@@ -84,24 +84,26 @@ ADD ipython_config.py /home/pwntools/.ipython/profile_default
8484
8585# Do not require password for sudo
8686RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/travis
87+
8788# Some additional debugging tools that are useful
88- RUN python -m pip install ipdb
89- RUN python3 -m pip install ipdb
89+ RUN python2.7 -m pip install ipdb && \
90+ python3 -m pip install ipdb
9091
9192# Install debugging utilities
9293USER root
9394RUN apt-get -y install gdb gdbserver tmux gdb-multiarch
9495
9596# Set up binfmt-misc mappings inside the VM
9697USER root
97- RUN mkdir /etc/qemu-binfmt
98- RUN ln -sf /usr/lib/arm-linux-gnueabihf /etc/qemu-binfmt/arm
99- RUN ln -sf /usr/lib/aarch64-linux-gnu /etc/qemu-binfmt/aarch64
100- RUN ln -sf /usr/lib/mips-linux-gnu /etc/qemu-binfmt/mips
101- RUN ln -sf /usr/lib/mipsel-linux-gnu /etc/qemu-binfmt/mipsel
102- RUN ln -sf /usr/lib/powerpc-linux-gnu /etc/qemu-binfmt/powerpc
103- RUN ln -sf /usr/lib/powerpc-linux-gnu64 /etc/qemu-binfmt/powerpc64
104- RUN ln -sf /usr/lib/sparc64-linux-gnu /etc/qemu-binfmt/sparc64
98+ RUN mkdir /etc/qemu-binfmt && \
99+ ln -sf /usr/lib/arm-linux-gnueabihf /etc/qemu-binfmt/arm && \
100+ ln -sf /usr/lib/aarch64-linux-gnu /etc/qemu-binfmt/aarch64 && \
101+ ln -sf /usr/lib/mips-linux-gnu /etc/qemu-binfmt/mips && \
102+ ln -sf /usr/lib/mipsel-linux-gnu /etc/qemu-binfmt/mipsel && \
103+ ln -sf /usr/lib/powerpc-linux-gnu /etc/qemu-binfmt/powerpc && \
104+ ln -sf /usr/lib/powerpc-linux-gnu64 /etc/qemu-binfmt/powerpc64 && \
105+ ln -sf /usr/lib/sparc64-linux-gnu /etc/qemu-binfmt/sparc64 && \
106+ ln -sf /usr/lib/riscv64-linux-gnu /etc/qemu-binfmt/riscv64
105107
106108# Create the Travis user
107109USER root
@@ -110,32 +112,29 @@ RUN echo "travis ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/travis
110112
111113# Set up SSH stuff so we can SSH into localhost
112114USER pwntools
113- RUN ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
114- RUN cp ~/.ssh/id_rsa.pub /tmp
115- RUN echo \
115+ RUN ssh-keygen -t rsa -f ~/.ssh/id_rsa -N '' && \
116+ cp ~/.ssh/id_rsa.pub /tmp && \
117+ echo \
116118"Host *\n \
117119 User travis\n \
118120 HostName 127.0.0.1\n \
119121" > ~/.ssh/config
120122
121123# Set up authorized_keys so we can login as travis with no creds
122124USER travis
123- RUN mkdir -m 0700 ~/.ssh
124- RUN echo 'from="127.0.0.1"' $(cat /tmp/id_rsa.pub) > ~/.ssh/authorized_keys
125+ RUN mkdir -m 0700 ~/.ssh && \
126+ echo 'from="127.0.0.1"' $(cat /tmp/id_rsa.pub) > ~/.ssh/authorized_keys
125127
126128# Add the doctest entrypoint to /usr/bin so we don't have to supply the full path
127129USER root
128- ADD doctest2 /usr/bin
129- ADD doctest3 /usr/bin
130+ ADD doctest2 doctest3 /usr/bin
130131
131132# Switch back to pwntools to actually run the image
132133USER pwntools
133134WORKDIR /home/pwntools
134135
135136# Copy in the Doctest script
136- COPY doctest2 /home/pwntools
137- COPY doctest3 /home/pwntools
138- COPY tmux.sh /home/pwntools
137+ COPY doctest2 doctest3 tmux.sh /home/pwntools
139138
140139# Do everything in UTF-8 mode!
141140ENV LANG=C.UTF-8
0 commit comments