diff --git a/19.04/Dockerfile b/19.04/Dockerfile index dd8b046..43e0d11 100644 --- a/19.04/Dockerfile +++ b/19.04/Dockerfile @@ -11,9 +11,9 @@ RUN apt update && \ apt -y install locales RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 RUN mkdir -p /root/tools @@ -78,9 +78,9 @@ RUN apt update && \ mv apktool /bin/ && \ chmod 755 /bin/apktool && \ chmod 755 /bin/apktool.jar - -# Install PIL -RUN pip install Pillow + +# Install PIL +RUN pip install Pillow # Install frida and the frida tools RUN pip install frida frida-tools @@ -94,7 +94,7 @@ RUN cd /root/tools && \ # Install fzf RUN cd /root/tools && \ git clone --depth 1 https://github.com/junegunn/fzf.git /root/.fzf && \ - /root/.fzf/install --all --key-bindings --completion + /root/.fzf/install --all --key-bindings --completion RUN apt-get update && \ apt-get install --no-install-recommends -y software-properties-common @@ -132,7 +132,7 @@ RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.9.0/ripgr rm ripgrep_0.9.0_amd64.deb # Bash 4.4 for vim mode -# RUN wget http://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz && \ +# RUN wget http://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz && \ # tar zxvf bash-4.4.tar.gz && \ # cd bash-4.4 && \ # ./configure && \ @@ -176,7 +176,7 @@ RUN cd /root/tools && \ rm DynamoRIO*tar.gz && \ wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-7.91.18058/DynamoRIO-i386-Linux-7.91.18058-0.tar.gz && \ tar zxvf DynamoRIO*tar.gz && \ - rm DynamoRIO*tar.gz + rm DynamoRIO*tar.gz # Install Valgrind Run apt update && \ @@ -228,7 +228,7 @@ RUN wget -O ~/.gdbinit-gef-extras.sh -q https://github.com/hugsy/gef/raw/master/ # Install go RUN wget https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go*tar.gz + tar -C /usr/local -xzf go*tar.gz COPY .tmux.conf /root/.tmux.conf COPY test.sh /root/test.sh diff --git a/20.04/.tmux.conf b/20.04/.tmux.conf new file mode 100644 index 0000000..0acae57 --- /dev/null +++ b/20.04/.tmux.conf @@ -0,0 +1,110 @@ +set-option -g default-terminal "screen-256color" + +set-option -g prefix C-a +bind-key C-a last-window + +set -g status-interval 1 +set -g status-justify centre # center align window list +set -g status-left-length 20 +set -g status-right-length 140 +set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]' +set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load -i 1) #[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d' + +# C-b is not acceptable -- Vim uses it +set-option -g prefix C-a +bind-key C-a last-window + +# Start numbering at 1 +set -g base-index 1 + +# Allows for faster key repetition +set -s escape-time 0 + +# Rather than constraining window size to the maximum size of any client +# connected to the *session*, constrain window size to the maximum size of any +# client connected to *that window*. Much more reasonable. +setw -g aggressive-resize on + +# Allows us to use C-a a to send commands to a TMUX session inside +# another TMUX session +bind-key a send-prefix + +# Activity monitoring +setw -g monitor-activity on +set -g visual-activity on + +# Vi copypaste mode +# set-window-option -g mode-keys vi +# bind P paste-buffer +# bind-key -T copy-mode-vi v send-keys -X begin-selection +# bind-key -T copy-mode-vi y send-keys -X copy-selection +# bind-key -T copy-mode-vi r send-keys -X rectangle-toggle +# bind -T copy-mode-vi y send-keys -X copy-pipe 'xclip -in -selection clipboard' + +bind-key - split-window +bind-key \ split-window -h + +# hjkl pane traversal +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" + +# reload config +bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." + +# auto window rename +set-window-option -g automatic-rename + +# rm mouse mode fail +# set -g mode-mouse off + +# color +set -g default-terminal "screen-256color" + +# status bar +# set-option -g status-utf8 on + +set-option -g history-limit 50000 + +# https://github.com/edkolev/dots/blob/master/tmux.conf +# Updates for tmux 1.9's current pane splitting paths. +if-shell "[[ `tmux -V` == *1.9* ]]" 'unbind c; bind c new-window -c "#{pane_current_path}"' +if-shell "[[ `tmux -V` == *1.9* ]]" 'unbind s; bind s split-window -v -c "#{pane_current_path}"' +if-shell "[[ `tmux -V` == *1.9* ]]" "unbind '\"'; bind '\"' split-window -v -c '#{pane_current_path}'" +if-shell "[[ `tmux -V` == *1.9* ]]" 'unbind v; bind v split-window -h -c "#{pane_current_path}"' +if-shell "[[ `tmux -V` == *1.9* ]]" 'unbind %; bind % split-window -h -c "#{pane_current_path}"' + +#### COLOUR (Solarized dark) + +# default statusbar colors +set-option -g status-bg black #base02 +set-option -g status-fg yellow #yellow +set-option -g status-attr default + +# default window title colors +set-window-option -g window-status-fg brightblue #base0 +set-window-option -g window-status-bg default +#set-window-option -g window-status-attr dim + +# active window title colors +set-window-option -g window-status-current-fg brightred #orange +set-window-option -g window-status-current-bg default +#set-window-option -g window-status-current-attr bright + +# pane border +set-option -g pane-border-fg black #base02 +set-option -g pane-active-border-fg brightgreen #base01 + +# message text +set-option -g message-bg black #base02 +set-option -g message-fg brightred #orange + +# pane number display +set-option -g display-panes-active-colour blue #blue +set-option -g display-panes-colour brightred #orange + +# clock +set-window-option -g clock-mode-colour green #green diff --git a/20.04/Dockerfile b/20.04/Dockerfile new file mode 100644 index 0000000..6b3c24e --- /dev/null +++ b/20.04/Dockerfile @@ -0,0 +1,238 @@ +############################################################ +# Dockerfile to build Epictreasure container +# Based on Ubuntu +############################################################ + +FROM ubuntu:20.04 +ENV test false +MAINTAINER Maintainer Cory Duplantis + +# Set up locale. Required for `tzdata` +RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime + +# Update and unminimize. Docker installs a minimal version of Ubuntu 20.04 +RUN apt update && \ + yes | unminimize + +RUN apt -y install locales + +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +RUN mkdir -p /root/tools + +RUN apt update && \ + apt -y install man manpages-posix python3-dev python3-pip && \ + apt clean + +RUN apt update && \ + apt install --no-install-recommends -y build-essential curl gdb \ + gdb-multiarch gdbserver git \ + libncursesw5-dev python3-setuptools python-setuptools \ + tmux tree stow virtualenvwrapper \ + wget vim unzip \ + libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev \ + squashfs-tools zlib1g-dev liblzma-dev python-magic cmake \ + z3 net-tools strace ltrace \ + gcc-multilib g++-multilib ruby-full binutils-mips-linux-gnu sudo + +# Symlink `python3` and `pip3` +RUN ln -fs /usr/bin/python3 /usr/bin/python && \ + ln -fs /usr/bin/pip3 /usr/bin/pip + +# Personal dotfiles +RUN cd /root && \ + rm .bashrc && \ + git clone --recursive --depth 1 https://github.com/ctfhacker/dotfiles.git && \ + cd dotfiles && \ + ./install.sh + +# Upgrade pip and ipython +RUN python3 -m pip install --upgrade pip && \ + pip3 install ipython + +# Install radare +RUN git clone --depth 1 https://github.com/radare/radare2 && \ + cd radare2 && \ + ./sys/install.sh && \ + pip3 install r2pipe + +# Install pwntools and pwndbg +RUN pip3 install git+https://github.com/Gallopsled/pwntools && \ + cd /root/tools && \ + git clone --depth 1 https://github.com/pwndbg/pwndbg && \ + cd pwndbg && \ + ./setup.sh + +# Install 32bit dependencies +RUN dpkg --add-architecture i386 && \ + apt update && \ + apt --no-install-recommends -y install libc6:i386 libncurses5:i386 libstdc++6:i386 libc6-dev-i386 && \ + apt clean + +# Install apktool +RUN apt update && \ + apt install --no-install-recommends -y default-jre && \ + wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool && \ + wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.0.2.jar && \ + mv apktool_2.0.2.jar /bin/apktool.jar && \ + mv apktool /bin/ && \ + chmod 755 /bin/apktool && \ + chmod 755 /bin/apktool.jar + +# Install PIL +RUN pip3 install Pillow + +# Install frida and the frida tools +RUN pip3 install frida frida-tools + +# Install ROPgadget +RUN cd /root/tools && \ + git clone --depth 1 https://github.com/JonathanSalwan/ROPgadget.git && \ + cd ROPgadget && \ + python3 setup.py install + +# Install fzf +RUN cd /root/tools && \ + git clone --depth 1 https://github.com/junegunn/fzf.git /root/.fzf && \ + /root/.fzf/install --all --key-bindings --completion + +RUN apt-get update && \ + apt-get install --no-install-recommends -y software-properties-common + +# Install qemu with multiarchs +RUN apt --no-install-recommends -y install qemu qemu-user qemu-user-static && \ + apt -m update && \ + apt install -y libc6-arm64-cross libcc6-dev-i386 \ + libc6-i386 libffi-dev libssl-dev libncurses5-dev && \ + apt --no-install-recommends -y install 'binfmt*' && \ + apt --no-install-recommends -y install libc6-armhf-armel-cross && \ + apt --no-install-recommends -y install debian-keyring && \ + apt --no-install-recommends -y install debian-archive-keyring && \ + apt --no-install-recommends -y install emdebian-archive-keyring && \ + apt -m update; echo 0 && \ + apt --no-install-recommends -y install libc6-mipsel-cross && \ + apt --no-install-recommends -y install libc6-armel-cross libc6-dev-armel-cross && \ + apt --no-install-recommends -y install libc6-dev-armhf-cross && \ + apt --no-install-recommends -y install binutils-arm-linux-gnueabi && \ + apt --no-install-recommends -y install libncurses5-dev && \ + mkdir /etc/qemu-binfmt && \ + ln -s /usr/mipsel-linux-gnu /etc/qemu-binfmt/mipsel && \ + ln -s /usr/arm-linux-gnueabihf /etc/qemu-binfmt/arm && \ + apt clean + +# Install Rust +RUN wget https://sh.rustup.rs && \ + chmod +x index.html && \ + ./index.html --default-toolchain nightly -y && \ + rm index.html + +# Install ripgrep from Releases +RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.9.0/ripgrep_0.9.0_amd64.deb && \ + dpkg -i ripgrep_0.9.0_amd64.deb && \ + rm ripgrep_0.9.0_amd64.deb + +# Bash 4.4 for vim mode +# RUN wget http://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz && \ + # tar zxvf bash-4.4.tar.gz && \ + # cd bash-4.4 && \ + # ./configure && \ + # make && \ + # make install && \ + # cd .. && \ + # rm bash-4.4.tar.gz && rm -rf bash-4.4 && \ + # chsh -s /usr/local/bin/bash && \ + # rm -rf /var/lib/apt/lists/* && \ + # apt clean + +# Install one_gadget +RUN gem install one_gadget + +# Install arm_now +RUN apt update && \ + apt install e2tools && \ + pip3 install https://github.com/nongiach/arm_now/archive/master.zip --upgrade && \ + apt clean + +# Install capstone, keystone, unicorn +RUN cd /root/tools && \ + wget https://raw.githubusercontent.com/hugsy/stuff/master/update-trinity.sh && \ + sed 's/sudo//g' update-trinity.sh > no_sudo_trinity.sh && \ + chmod +x no_sudo_trinity.sh && \ + bash ./no_sudo_trinity.sh && \ + ldconfig + +# Install DrMemory +RUN cd /root/tools && \ + wget https://github.com/DynamoRIO/drmemory/releases/download/release_1.11.0/DrMemory-Linux-1.11.0-2.tar.gz && \ + tar zxvf DrMemory* && \ + cd DrMemory* && \ + ln -s $PWD/bin/drmemory /usr/bin/drmemory-32 && \ + ln -s $PWD/bin64/drmemory /usr/bin/drmemory-64 + +# Install DynamoRIO +RUN cd /root/tools && \ + wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-7.91.18058/DynamoRIO-x86_64-Linux-7.91.18058-0.tar.gz && \ + tar zxvf DynamoRIO*tar.gz && \ + rm DynamoRIO*tar.gz && \ + wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-7.91.18058/DynamoRIO-i386-Linux-7.91.18058-0.tar.gz && \ + tar zxvf DynamoRIO*tar.gz && \ + rm DynamoRIO*tar.gz + +# Install Valgrind +Run apt update && \ + apt install valgrind && \ + apt clean + +# Install gdb 8.2 +# Run apt update && \ + # apt install -y texinfo && \ + # cd /root/tools && \ + # wget https://ftp.gnu.org/gnu/gdb/gdb-8.2.tar.xz && \ + # xz -d < gdb-8.2.tar.xz > gdb-8.2.tar && \ + # tar xvf gdb-8.2.tar && \ + # cd gdb-8.2 && \ + # ./configure && \ + # make -j4 && \ + # make install && \ + # apt clean + +# Install binwalk +# git clone https://github.com/devttys0/binwalk && \ +# echo -e "y\n12\n4\n" | ./deps.sh && \ + +RUN cd /root/tools && \ + git clone --depth 1 https://github.com/ReFirmLabs/binwalk && \ + cd binwalk && \ + python3 setup.py install + +# Install fmk +# RUN cd /root/tools && \ + # wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/firmware-mod-kit/fmk_099.tar.gz && \ + # tar zxvf fmk_099.tar.gz && \ + # rm fmk_099.tar.gz && \ + # cd fmk/src && \ + # ./configure && \ + # make + +# Install angr +RUN python3 -m pip install angr + +# Install Rust binaries +RUN /root/.cargo/bin/cargo install ripgrep exa bat + +# Install gef but keep pwndbg downloaded +RUN wget -O ~/.gdbinit-gef.py -q https://github.com/hugsy/gef/raw/master/gef.py && echo source ~/.gdbinit-gef.py > ~/.gdbinit +RUN wget -O ~/.gdbinit-gef-extras.sh -q https://github.com/hugsy/gef/raw/master/scripts/gef-extras.sh && \ + chmod +x ~/.gdbinit-gef-extras.sh && \ + ~/.gdbinit-gef-extras.sh + +# Install go +RUN wget https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go*tar.gz + +COPY .tmux.conf /root/.tmux.conf +COPY test.sh /root/test.sh +CMD sh -c 'if [ "$test" = true ]; then echo "Running tests"; chmod +x /root/test.sh; /root/test.sh; else /bin/bash; fi' diff --git a/20.04/test.sh b/20.04/test.sh new file mode 100644 index 0000000..e691ca4 --- /dev/null +++ b/20.04/test.sh @@ -0,0 +1,117 @@ +bad=0 +if (python3 -c "from pwn import *" 2>&1); then + echo pwntool + bad=1 +fi +if !(rasm2 "xor eax, eax" 2>&1 | rg "31c0" 2>&1 >/dev/null); then + echo radare2 + bad=1 +fi +if !(binwalk 2>&1 | rg "Extraction Options:" 2>&1 >/dev/null); then + echo binwalk + bad=1 +fi +if !(apktool 2>&1 | rg ".*a tool for reengineering Android apk files.*" 2>&1 >/dev/null); then + echo apktool + bad=1 +fi +if !(frida-ps 2>&1 | rg ".*python3.*" 2>&1 >/dev/null); then + echo frida + bad=1 +fi +if !(ROPgadget 2>&1 | rg "Need a binary filename" 2>&1 >/dev/null); then + echo ropgadget + bad=1 +fi +if !(python3 -c "import PIL" 2>&1); then + echo pillow + bad=1 +fi +if !(strace 2>&1 | rg "Try 'strace -h'" 2>&1 >/dev/null); then + echo strace + bad=1 +fi +if !(ltrace 2>&1 | rg "too few arguments" 2>&1 >/dev/null); then + echo ltrace + bad=1 +fi +if !(python3 -c "import r2pipe" 2>&1); then + echo r2pipe python3 + bad=1 +fi +if !(qemu-arm --help 2>&1 | rg "usage: qemu-arm" 2>&1 >/dev/null); then + echo qemu-arm + bad=1 +fi +if !(qemu-mips --help 2>&1 | rg "usage: qemu-mips" 2>&1 >/dev/null); then + echo qemu-mips + bad=1 +fi +if !(rg --version 2>&1 | rg "ripgrep" 2>&1 >/dev/null); then + echo ripgrep + bad=1 +fi +if !(/root/.cargo/bin/cargo --help 2>&1 | rg "See 'cargo help " 2>&1 >/dev/null); then + echo cargo + bad=1 +fi +if !(/root/.cargo/bin/rustup --help 2>&1 | rg "The Rust toolchain installer" 2>&1 >/dev/null); then + echo rustup + bad=1 +fi +if !(one_gadget --help 2>&1 | rg "Usage: one_gadget " 2>&1 >/dev/null); then + echo one_gadget + bad=1 +fi +if !(arm_now --help 2>&1 | rg "arm_now list " 2>&1 >/dev/null); then + echo arm_now + bad=1 +fi +if !(drmemory-64 --help 2>&1 | rg "Usage: drmemory " 2>&1 >/dev/null); then + echo drmemory + bad=1 +fi +if !(/root/tools/DynamoRIO-x86_64-Linux-7.91.18058-0/bin64/drrun -c /root/tools/DynamoRIO-x86_64-Linux-7.91.18058-0/samples/bin64/libinscount.so -- /bin/ls 2>&1 | rg "instructions executed" 2>&1 >/dev/null); then + echo dynamorio64 + bad=1 +fi +if !(bash --version 2>&1 | rg "(4.4|5.0)" 2>&1 >/dev/null); then + echo bash 4.4 + bad=1 +fi +if !(python3 -c "import capstone" 2>&1); then + echo capstone python3 + bad=1 +fi +if !(python3 -c "import keystone" 2>&1); then + echo keystone python3 + bad=1 +fi +if !(python3 -c "import unicorn" 2>&1); then + echo unicorn python3 + bad=1 +fi +if !(netstat 2>&1 | rg "Active Internet connections" 2>&1 >/dev/null); then + echo net-tools + bad=1 +fi +if !(python3 -c "import angr" 2>&1); then + echo angr + bad=1 +fi +if !(valgrind --version 2>&1 | rg "valgrind-" 2>&1 >/dev/null); then + echo valgrind + bad=1 +fi +if !(python -V 2>&1 | rg "3." 2>&1 >/dev/null); then + echo python -V not 3.x + bad=1 +fi +if !(gdb --version 2>&1 | rg "GNU gdb (GDB) 8.0" 2>&1 >/dev/null); then + echo gdb not 8.0 + bad=1 +fi +if [ $bad -eq 1 ]; then + exit 1 +fi +exit 0