Skip to content

Instantly share code, notes, and snippets.

@WillArevalo
Last active November 17, 2018 11:49
Show Gist options
  • Save WillArevalo/128959effd2ad75b0082b7c3f6b9ae5d to your computer and use it in GitHub Desktop.
Save WillArevalo/128959effd2ad75b0082b7c3f6b9ae5d to your computer and use it in GitHub Desktop.
Cuckoo complete setup 2018
#!/bin/bash
# Last update: 4/04/2018
#
# ***********************************************************
#
# 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)
#
# ***********************************************************
#Preinstaled
sudo apt-get update
sudo apt-get -y upgrade
# 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
# tcpdump
sudo apt-get install -y xfce4 tcpdump apparmor-utils git
# tcp config
sudo setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump
# Install volatility from github
sudo git clone https://github.com/volatilityfoundation/volatility.git
sudo pip install -U pip pycrypto distorm3
cd volatility/
sudo python setup.py install
cd ..
# 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
print_message 'Installing m2crypto on virtualenv...'
pip install m2crypto==0.24.0
print_message 'Installing pillow on virtualenv...'
pip install pillow==3.2.0
# Part C) Run Cuckoo
print_subheader 'C' 'Execute Cuckoo'
cuckoo
# Fetch Cuckoo Signatures
print_message 'Fetching Cuckoo Community files...'
cuckoo community
# Next Steps
print_header 'Process Finish'
print_header 'Next Steps'
print_message '1. Configure your VMs'
print_message '2. Configure Virtual Network'
print_message '3. Add de agent of Cuckoo in your VMs'
print_message '4. Configure files of Cuckoo'
print_message '5. Power On your Virtual Env and run cuckoo and server of cuckoo(cuckoo web runserver yourip:8080)'
print_message '6. Enjoy :) '
@michaelkasede
Copy link

Hi, does this setup of cuckoo work in a VM setup?
I would like to have cuckoo setup as a VM and use other VMs as the testing VMs.
Obvious reasones, limited resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment