Skip to content

Instantly share code, notes, and snippets.

@shihyu
Forked from AkashiSN/ctf_tools.sh
Created February 21, 2018 08:01
Show Gist options
  • Save shihyu/8a5f2c172f4d0954afb240b5ab6d7df5 to your computer and use it in GitHub Desktop.
Save shihyu/8a5f2c172f4d0954afb240b5ab6d7df5 to your computer and use it in GitHub Desktop.
CTF tool installation script.
#!/bin/bash
# Advance preparation
echo "source $HOME/.ctf_tool" >> $HOME/.zshrc
# Support 32-bit elf.
sudo apt install -y lib32z1
# Install other tools.
sudo apt install -y gdb binutils build-essential strace ltrace\
hexedit exiftool binwalk nmap sqlitebrowser socat
#
# NetCat for Python - https://gist.github.com/leonjza/f35a7252babdf77c8421
#
# Get the current user name.
user=`whoami`
# Create a directory and change owners.
sudo mkdir -p /opt/netcat-python && sudo chown -R ${user}:${user} /opt/netcat-python/
# Download a program.
wget https://gist.github.com/leonjza/f35a7252babdf77c8421/raw/10c84a2058e3b55f98559ff56c26de4addea7945/netcat.py -P /opt/netcat-python
# Add to python path.
cat <<\EOF >> $HOME/.pyenv/versions/2.7.14/lib/python2.7/site-packages/custom.pth
/opt/netcat-python/
EOF
#
# Nikto
#
# Install Nikto.
sudo apt install -y nikto
# Update Nikto.
sudo nikto -update
#
# BurpSuite
#
# Get the current user name.
user=`whoami`
# Create a directory and change owners.
sudo mkdir -p /opt/burpsuite/bin && sudo chown -R ${user}:${user} /opt/burpsuite/
# Download program.
wget -O /opt/burpsuite/burpsuite.jar 'https://portswigger.net/DownloadUpdate.ashx?Product=Free'
# Create an execution script.
cat <<\EOF > /opt/burpsuite/bin/burpsuite
#!/bin/sh
java -jar /opt/burpsuite/burpsuite.jar $*
EOF
# Grant execution authority.
chmod +x /opt/burpsuite/bin/burpsuite
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# BurpSuite
export PATH=/opt/burpsuite/bin:$PATH
EOF
#
# IDA Demo
#
# http://out7.hex-rays.com/demo/request
# Please register and download.
# Expand archives.
tar xvf idademo70_linux.tgz
# Move the program.
sudo mv idademo70 /opt/
# Create a directory.
mkdir /opt/idademo70/bin
# Create a symbolic link.
ln -s /opt/idademo70/ida /opt/idademo70/bin/ida
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# IDA Demo
export PATH=/opt/idademo70/bin:$PATH
EOF
#
# sqlmap
#
# Get the current user name.
user=`whoami`
# Clone a repository and change owners.
sudo git clone https://github.com/sqlmapproject/sqlmap.git /opt/sqlmap && sudo chown -R ${user}:${user} /opt/sqlmap/
# Create a directory.
mkdir /opt/sqlmap/bin
# Set the version of Python to 2.7.14.
echo "2.7.14" > /opt/sqlmap/.python-version
# Create an execution script.
cat <<\EOF > /opt/sqlmap/bin/sqlmap
python /opt/sqlmap/sqlmap.py $*
EOF
# Grant execution authority.
chmod +x /opt/sqlmap/bin/sqlmap
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# sqlmap
export PATH=/opt/sqlmap/bin:$PATH
EOF
#
# gdb-peda
#
# Clone a repository
git clone https://github.com/longld/peda.git $HOME/peda
# Add to .gdbinit
echo "source ~/peda/peda.py" >> $HOME/.gdbinit
#
# radare2
#
# Clone a repository and change owners.
sudo git clone https://github.com/radare/radare2.git /opt/radare2 && sudo chown -R ${user}:${user} /opt/radare2/
# Running the install script.
sudo /opt/radare2/sys/install.sh
#
# Procyon
#
# Get the current user name.
user=`whoami`
# Create a directory and change owners.
sudo mkdir -p /opt/procyon/bin && sudo chown -R ${user}:${user} /opt/procyon/
# Download program.
wget -O /opt/procyon/procyon.jar https://bitbucket.org/mstrobel/procyon/downloads/procyon-decompiler-0.5.30.jar
# Create an execution script.
cat <<\EOF > /opt/procyon/bin/procyon
#!/bin/sh
java -jar /opt/procyon/procyon.jar $*
EOF
# Grant execution authority.
chmod +x /opt/procyon/bin/procyon
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
#procyon
export PATH=/opt/procyon/bin:$PATH
EOF
#
# dex2jar
#
# Download program.
wget https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip -P /tmp
# Expand archives.
unzip /tmp/dex-tools-2.0.zip -d /tmp
# Move the program.
sudo mv /tmp/dex2jar-2.0 /opt/dex2jar
# Change authority.
chmod 755 -R /opt/dex2jar
# Remove *.bat files.
rm /opt/dex2jar/*.bat
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# dex2jar
export PATH=/opt/dex2jar:$PATH
EOF
#
# Foremost
#
# Download program.
wget https://github.com/korczis/foremost/archive/v1.5.7.tar.gz -P /tmp
# Expand archives.
tar xzvf /tmp/v1.5.7.tar.gz -C /tmp
# Move the program and change authority.
sudo mv /tmp/foremost-1.5.7 /opt/foremost && chmod 644 /opt/foremost/*
# Running make command.
make -C /opt/foremost
# Running make install command.
sudo make -C /opt/foremost install
#
# checksec.sh
#
# Get the current user name.
user=`whoami`
# Clone a repository and change owners.
sudo git clone https://github.com/slimm609/checksec.sh.git /opt/checksec.sh && sudo chown -R ${user}:${user} /opt/checksec.sh/
# Create a directory.
mkdir /opt/checksec.sh/bin
# Create a symbolic link.
sudo ln -s /opt/checksec.sh/checksec /opt/checksec.sh/bin/checksec
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# checksec.sh
export PATH=/opt/checksec.sh/bin:$PATH
EOF
#
# PkCrack
#
# Download program.
wget https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack/pkcrack-1.2.2.tar.gz -P /tmp
# Expand archives.
tar xzvf /tmp/pkcrack-1.2.2.tar.gz -C /tmp
# Move the program.
sudo mv /tmp/pkcrack-1.2.2 /opt/pkcrack
# Running make command.
make -C /opt/pkcrack/src
# Create a directory.
mkdir /opt/pkcrack/bin
# Create a symbolic link.
ln -s /opt/pkcrack/src/pkcrack /opt/pkcrack/bin/pkcrack
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# PkCrack
export PATH=/opt/pkcrack/bin:$PATH
EOF
#
# stegsolve
#
# Get the current user name.
user=`whoami`
# Create a directory and change owners.
sudo mkdir -p /opt/stegsolve/bin && sudo chown -R ${user}:${user} /opt/stegsolve/
# Download program.
wget -O /opt/stegsolve/stegsolve.jar http://www.caesum.com/handbook/Stegsolve.jar
# Create an execution script.
cat <<\EOF > /opt/stegsolve/bin/stegsolve
#!/bin/sh
java -jar /opt/stegsolve/stegsolve.jar $*
EOF
# Grant execution authority.
sudo chmod +x /opt/stegsolve/bin/stegsolve
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# stegsolve
export PATH=/opt/stegsolve/bin:$PATH
EOF
#
# pngcheck
#
# Download program.
wget https://jaist.dl.sourceforge.net/project/png-mng/pngcheck/2.3.0/pngcheck-2.3.0.tar.gz -P /tmp
# Expand archives.
tar xzvf /tmp/pngcheck-2.3.0.tar.gz -C /tmp
# Move the program.
sudo mv /tmp/pngcheck-2.3.0 /opt/pngcheck
# Create a directory.
mkdir /opt/pngcheck/bin
# Compile the program.
gcc /opt/pngcheck/pngcheck.c -o /opt/pngcheck/bin/pngcheck
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# pngcheck
export PATH=/opt/pngcheck/bin:$PATH
EOF
#
# RsaCtfTool
#
# Get the current user name.
user=`whoami`
# Change the version of Python to 2.7.14.
pyenv global 2.7.14
# Install gmpy2 dependency.
sudo apt install -y libgmp3-dev libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg libmpc-dev
# Install RsaCtfTool requirements.
pip install pycrypto gmpy gmpy2 sympy requests
## Install libnum.
# Clone a repository and change owners.
sudo git clone https://github.com/hellman/libnum.git /opt/libnum && sudo chown -R ${user}:${user} /opt/libnum/
# Running the install script.
cd /opt/libnum && python setup.py install && cd
# Clone a repository and change owners.
sudo git clone https://github.com/Ganapati/RsaCtfTool.git /opt/RsaCtfTool && sudo chown -R ${user}:${user} /opt/RsaCtfTool/
# Create a directory.
mkdir /opt/RsaCtfTool/bin
# Set the version of Python to 2.7.14.
echo "2.7.14" > /opt/RsaCtfTool/.python-version
# Create an execution script.
cat <<\EOF > /opt/RsaCtfTool/bin/RsaCtfTool
python /opt/RsaCtfTool/RsaCtfTool.py $*
EOF
# Grant execution authority.
chmod +x /opt/RsaCtfTool/bin/RsaCtfTool
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# RsaCtfTool
export PATH=/opt/RsaCtfTool/bin:$PATH
EOF
#
# Volatility
#
# Download program.
wget http://downloads.volatilityfoundation.org/releases/2.6/volatility_2.6_lin64_standalone.zip -P /tmp
# Expand archives.
unzip /tmp/volatility_2.6_lin64_standalone.zip -d /tmp
# Move the program.
sudo mv /tmp/volatility_2.6_lin64_standalone /opt/volatility
# Change authority.
chmod 755 -R /opt/volatility && chmod 644 /opt/volatility/*.txt
# Create a directory.
mkdir -p /opt/volatility/bin
# Create symbolic link.
ln -s /opt/volatility/volatility_2.6_lin64_standalone /opt/volatility/bin/volatility
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# Volatility
export PATH=/opt/volatility/bin:$PATH
EOF
#
# LSB-Steganography
#
# Get the current user name.
user=`whoami`
# Clone a repository and change owners.
sudo git clone https://github.com/RobinDavid/LSB-Steganography.git /opt/LSB-Steganography && sudo chown -R ${user}:${user} /opt/LSB-Steganography/
# Create a directory.
mkdir /opt/LSB-Steganography/bin
mkdir /opt/LSB-Steganography/package
# Change the version of Python to 3.6.3.
pyenv global 3.6.3
# Install LSB-Steganography requirements.
pip install opencv-python docopt
# Set the version of Python to 3.6.3.
echo "3.6.3" > /opt/LSB-Steganography/.python-version
# Create an execution script.
cat <<\EOF > /opt/LSB-Steganography/bin/LSBSteg
python /opt/LSB-Steganography/LSBSteg.py $*
EOF
# Grant execution authority.
chmod +x /opt/LSB-Steganography/bin/LSBSteg
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# LSB-Steganography
export PATH=/opt/LSB-Steganography/bin:$PATH
EOF
# Create a symbolic link.
sudo ln -s /opt/LSB-Steganography/LSBSteg.py /opt/LSB-Steganography/package/LSBSteg.py
# Add to python path.
cat <<\EOF >> $HOME/.pyenv/versions/3.6.3/lib/python3.6/site-packages/custom.pth
/opt/LSB-Steganography/package/
EOF
#
# hash-identifier
#
# Get the current user name.
user=`whoami`
# Create a directory and change owners.
sudo mkdir -p /opt/hash-identifier/bin && sudo chown -R ${user}:${user} /opt/hash-identifier/
# Download program.
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/hash-identifier/Hash_ID_v1.1.py -P /opt/hash-identifier
# Set the version of Python to 2.7.14.
echo "2.7.14" > /opt/hash-identifier/.python-version
# Create an execution script.
cat <<\EOF > /opt/hash-identifier/bin/HashID
#!/bin/sh
python /opt/hash-identifier/Hash_ID_v1.1.py $*
EOF
# Grant execution authority.
chmod +x /opt/hash-identifier/bin/HashID
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# hash-identifier
export PATH=/opt/hash-identifier/bin:$PATH
EOF
#
# pycdc - C++ python bytecode disassembler and decompiler
#
# Get the current user name.
user=`whoami`
# Clone a repository and change owners.
sudo git clone https://github.com/zrax/pycdc.git /opt/pycdc && sudo chown -R ${user}:${user} /opt/pycdc/
# Install a Cmake.
sudo apt install -y cmake
# Running cmake command.
cmake /opt/pycdc/CMakeLists.txt
# Running make command.
make -C /opt/pycdc
# Create a directory.
mkdir /opt/pycdc/bin
# Create a symbolic link.
ln -s /opt/pycdc/pycdc /opt/pycdc/bin/pycdc
ln -s /opt/pycdc/pycdas /opt/pycdc/bin/pycdas
# Add to .ctf_tool
cat <<\EOF >> $HOME/.ctf_tool
# pycdc
export PATH=/opt/pycdc/bin:$PATH
EOF
#
# uncompyle - A Python 2.7 byte-code decompiler, written in Python 2.7
#
# Get the current user name.
user=`whoami`
# Clone a repository and change owners.
sudo git clone https://github.com/wibiti/uncompyle2.git /opt/uncompyle2 && sudo chown -R ${user}:${user} /opt/uncompyle2/
# Change the version of Python to 3.6.3.
pyenv global 2.7.14
# Install uncompyle2.
cd /opt/uncompyle2 && python setup.py install && cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment