Skip to content

Commit

Permalink
Resolving issue 165. (#171)
Browse files Browse the repository at this point in the history
* Create config.sh

* Rename config.sh to like_debugger_tool_install.sh
  • Loading branch information
R3zk0n authored Dec 12, 2023
1 parent 91a9cb6 commit be70f55
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .dockerfile_dbg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ WORKDIR /home/$USER

COPY io/scripts/.gdbinit .
COPY io/scripts/debugger.sh .
COPY io/scripts/gdb_script .

RUN apt-get update && \
set -e && \
Expand All @@ -34,17 +35,16 @@ ENV LC_ALL=en_US.UTF-8

USER $USER
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -e && \
wget -q -O- https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh | bash -s - > /dev/null && \
git clone --depth=1 https://github.com/pwndbg/pwndbg && \
pushd pwndbg > /dev/null && \
chmod +x setup.sh && \
echo 'y' | ./setup.sh && \
popd > /dev/null && \
wget -q -O ~/.gdbinit-gef.py -q https://gef.blah.cat/dev && \
echo "source ~/.gdbinit-gef.py" >> ~/.gdbinit && \
wget -q -O- https://github.com/hugsy/gef/raw/dev/scripts/gef-extras.sh | bash -s - -b dev && \
echo "export PATH=/home/$USER/.local/bin/:${PATH}" >> /home/$USER/.zshrc
COPY io/scripts/like_debugger_tool_install.sh .
RUN ./like_debugger_tool_install.sh

# Set Zsh as the default shell for the user
USER root
RUN chsh -s $(which zsh) $USER
USER $USER

# Copy necessary scripts
COPY io/scripts/gdb_script .

# Set working directory
WORKDIR /io
70 changes: 70 additions & 0 deletions io/scripts/like_debugger_tool_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash


# Using this is easy to mantain and add things then using the bash -e

# Enable error handling and pipefail option


# Function to log informational messages
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') [INFO]: $1"
}

# Function to handle errors
error_handling() {
local error_message="$1"
local exit_code=${2-1} # default exit code is 1
echo "$(date '+%Y-%m-%d %H:%M:%S') [ERROR]: $error_message"
exit "$exit_code"
}

# Function to check command success
check_success() {
local message="$1"
if [ $? -eq 0 ]; then
log "$message succeeded"
else
error_handling "$message failed"
fi
}

# Set USER variable to your user
USER="user" # Replace <your_user_here> with your username

# Installing Oh My Zsh
log "Installing Oh My Zsh"
if wget -q -O ohmyzsh-install.sh https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh; then
bash ohmyzsh-install.sh > /dev/null || error_handling "Failed to install Oh My Zsh"
rm ohmyzsh-install.sh
else
error_handling "Failed to download Oh My Zsh install script"
fi

# Clone and setup Pwndbg
log "Installing Pwndbg"
if git clone --depth=1 https://github.com/pwndbg/pwndbg; then
pushd pwndbg > /dev/null || error_handling "Failed to change directory to Pwndbg"
chmod +x setup.sh
echo 'y' | ./setup.sh || error_handling "Failed to setup Pwndbg"
popd > /dev/null
rm -rf pwndbg
else
error_handling "Failed to clone Pwndbg"
fi

# Setup GEF
log "Installing GEF"
if bash -c "$(wget https://gef.blah.cat/sh -O -)"; then
wget -q -O gef-extras.sh https://raw.githubusercontent.com/hugsy/gef/main/scripts/gef-extras.sh || error_handling "Failed to download GEF extras script"
bash ./gef-extras.sh
rm gef-extras.sh
else
error_handling "Failed to install GEF"
fi

# Update PATH in .zshrc
log "Updating PATH in .zshrc"
echo "export PATH=/home/$USER/.local/bin/:${PATH}" >> /home/$USER/.zshrc || error_handling "Failed to update PATH in .zshrc"

log "Installation complete."

0 comments on commit be70f55

Please sign in to comment.