Skip to content

Instantly share code, notes, and snippets.

@WillArevalo
Forked from NeaSTDL/cuckoo_setup.sh
Last active March 25, 2018 21:12
Show Gist options
  • Save WillArevalo/e12367f43d4e8ffa086c7d3ff897128a to your computer and use it in GitHub Desktop.
Save WillArevalo/e12367f43d4e8ffa086c7d3ff897128a to your computer and use it in GitHub Desktop.
Cuckoo Sandbox Installation Script [Ubuntu 16.04.1] [v0.3]
#!/bin/bash
# ***********************************************************
#
# Functions definition
#
# ***********************************************************
# Function to print N blank lines
function print_blanks {
for (( c=1; c<=$1; c++ ))
do
echo ' '
done
}
# Function to print headers
function print_header {
print_blanks 1
echo '***************************************'
echo $1
echo '***************************************'
}
# Function to print sub header
function print_subheader {
print_blanks 1
echo 'PART '$1') '$2
echo '---------------------------------------'
}
# Print single lines messages
function print_message {
print_blanks 1
echo '--> '$1
print_blanks 1
}
# ***********************************************************
#
# Cuckoo Dependencies installation (Ubuntu 16.04.1)
#
# ***********************************************************
# Part A) Dependencies installation
print_header 'Cuckoo Sandbox Setup'
print_subheader 'A' 'Dependencies installation'
print_message 'Adding third-party repositories...'
# This repository is for VirtualBox 5.1
echo deb http://download.virtualbox.org/virtualbox/debian xenial contrib | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
# Update package manager
print_message 'Updating package manager...'
sudo apt-get update
# The Cuckoo host components is completely written in Python,
# therefore it is required to have an appropriate version of Python installed.
print_message 'Installing python and general dependencies...'
# General python and dependencies
sudo apt-get install -y python python-pip python-dev libffi-dev libssl-dev
# Virtual env to encapsulate dependencies cleanly
sudo apt-get install -y python-virtualenv python-setuptools
# Swig for M2Crypto
sudo apt-get install -y libjpeg-dev zlib1g-dev swig
# Installing databases for the different subsystems in the utility
print_message 'Installing databases...'
# In order to use the Django-based Web Interface, MongoDB is required
print_message ' A) Mongo:'
sudo apt-get install -y mongodb
# PostgreSQL as database (our recommendation)
print_message ' B) PostgreSQL:'
sudo apt-get install -y postgresql libpq-dev
# Used to create virtual guests systems to infect and monitor
print_message 'Installing VirtualBox...'
sudo apt-get install -y virtualbox-5.1
print_message 'Installing tcpdump...'
sudo apt-get install -y tcpdump apparmor-utils
sudo aa-disable /usr/sbin/tcpdump
# Part B) Cuckoo Installation
print_subheader 'B' 'Cuckoo Installation'
# Create cuckoo user
print_message 'Creating cuckoo user...'
sudo adduser cuckoo --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
echo "cuckoo:1234567890" | sudo chpasswd
# Add cuckoo user to "vboxusers" group
print_message 'Adding user to "vboxusers" group...'
sudo usermod -a -G vboxusers cuckoo
# Create virtualenv to install cuckoo on it
print_message 'Initialize virtualenv...'
virtualenv cuckoo_env
. cuckoo_env/bin/activate
# Installing other dependencies on virtualenv
print_message 'Installing other dependencies on virtualenv...'
pip install -U pip setuptools
print_message 'Installing cuckoo on virtualenv...'
pip install -U cuckoo
print_message 'Installing yara on virtualenv...'
pip install yara-python==3.6.3
# Part C) Run Cuckoo
print_subheader 'C' 'Execute Cuckoo'
cuckoo
# Fetch Cuckoo Signatures
print_message 'Fetching Cuckoo Community files...'
cuckoo community
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment