1
0
Fork 0
mirror of https://github.com/dbarzin/pandora-box.git synced 2025-07-18 21:09:41 +02:00
pandora-box/install.sh

137 lines
4.3 KiB
Bash
Raw Normal View History

2022-06-28 22:49:48 +02:00
#/usr/bin/bash -e
2022-06-30 10:32:30 +02:00
# Install procedure for Pandora-Box
2022-06-28 22:49:48 +02:00
set -e
cd ..
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 20:24:06 +02:00
# Python
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 20:24:06 +02:00
apt install -y python-is-python3 python3-pip
2022-07-05 20:55:01 +02:00
#---------------------
2022-06-28 22:49:48 +02:00
# Peotry
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 20:24:06 +02:00
su - $SUDO_USER -c "curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -"
su - $SUDO_USER -c "poetry --version"
2022-06-28 22:49:48 +02:00
2022-07-05 20:55:01 +02:00
#---------------------
2022-06-28 22:49:48 +02:00
# REDIS
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 17:29:59 +02:00
apt-get update
2022-07-04 20:24:06 +02:00
apt install -y build-essential tcl
2022-06-28 22:49:48 +02:00
git clone https://github.com/redis/redis.git
cd redis
git checkout 6.2
make
# Optionally, you can run the tests:
2022-07-05 20:14:07 +02:00
# make test
2022-06-28 22:49:48 +02:00
cd ..
2022-07-04 17:29:59 +02:00
chown -R $SUDO_USER redis
2022-07-05 20:55:01 +02:00
#---------------------
2022-06-28 22:49:48 +02:00
# Kvrocks
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 17:29:59 +02:00
apt-get update
2022-07-04 20:24:06 +02:00
apt install -y gcc g++ make libsnappy-dev autoconf automake libtool googletest libgtest-dev
2022-06-28 22:49:48 +02:00
git clone --recursive https://github.com/apache/incubator-kvrocks.git kvrocks
cd kvrocks
git checkout 2.0
make -j4
# Optionally, you can run the tests:
2022-07-05 20:14:07 +02:00
# make test
2022-06-28 22:49:48 +02:00
cd ..
2022-07-04 17:29:59 +02:00
chown -R $SUDO_USER kvrocks
2022-07-05 20:55:01 +02:00
#---------------------
2022-06-28 22:49:48 +02:00
# Pandora
2022-07-05 20:55:01 +02:00
#---------------------
2022-07-04 20:24:06 +02:00
su - $SUDO_USER -c "git clone https://github.com/pandora-analysis/pandora.git"
2022-07-05 20:55:01 +02:00
cd pandorra
2022-06-28 22:49:48 +02:00
2022-07-05 20:55:01 +02:00
# install packages
2022-07-04 20:24:06 +02:00
apt install -y python3-dev # for compiling things
apt install -y libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 # For HTML -> PDF
apt install -y libreoffice-base-nogui libreoffice-calc-nogui libreoffice-draw-nogui libreoffice-impress-nogui libreoffice-math-nogui libreoffice-writer-nogui # For Office -> PDF
apt install -y exiftool # for extracting exif information
apt install -y unrar # for extracting rar files
apt install -y libxml2-dev libxslt1-dev antiword unrtf poppler-utils pstotext tesseract-ocr flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig # for textract
2022-06-28 22:49:48 +02:00
2022-07-05 20:55:01 +02:00
# install yara-python
su - $SUDO_USER -c "python3 -m pip show yara-python"
# set .env
2022-06-28 22:49:48 +02:00
echo PANDORA_HOME="`pwd`" >> .env
2022-07-05 20:55:01 +02:00
chown $SUDO_USER .env
su - $SUDO_USER -c "cd ~/pandora; poetry install"
2022-07-04 20:24:06 +02:00
su - $SUDO_USER -c "cd ~/pandora; cp config/generic.json.sample config/generic.json"
2022-06-28 22:49:48 +02:00
2022-07-04 17:29:59 +02:00
# ClamAV
2022-07-04 20:24:06 +02:00
apt-get install -y clamav-daemon
2022-06-28 22:49:48 +02:00
# In order for the module to work, you need the signatures.
# Running the command "freshclam" will do it but if the script is already running
# (it is started by the systemd service clamav-freshclam)
# You might want to run the commands below:
2022-07-04 17:29:59 +02:00
systemctl stop clamav-freshclam.service # Stop the service
freshclam # Run the signatures update
systemctl start clamav-freshclam.service # Start the service so we keep getting the updates
2022-06-28 22:49:48 +02:00
2022-07-04 17:29:59 +02:00
service clamav-daemon start
2022-06-28 22:49:48 +02:00
# Comodo
wget https://download.comodo.com/cis/download/installs/linux/cav-linux_x64.deb
2022-07-04 17:29:59 +02:00
dpkg --ignore-depends=libssl0.9.8 -i cav-linux_x64.deb
2022-06-28 22:49:48 +02:00
2022-07-04 17:29:59 +02:00
wget http://cdn.download.comodo.com/av/updates58/sigs/bases/bases.cav -O /opt/COMODO/scanners/bases.cav
2022-06-28 22:49:48 +02:00
2022-07-05 20:55:01 +02:00
# Configure workers
2022-07-05 20:14:07 +02:00
su - $SUDO_USER -c "cd pandora; for file in pandora/workers/*.sample; do cp -i ${file} ${file%%.sample}; done"
2022-06-28 22:49:48 +02:00
#---------------------
2022-07-04 17:29:59 +02:00
# Pandora-box
2022-06-28 22:49:48 +02:00
#---------------------
# Python libraries
2022-07-04 20:24:06 +02:00
su - $SUDO_USER -c "pip install pypandora psutil pyudev"
2022-06-28 22:49:48 +02:00
# Quarantine folder
2022-07-04 20:24:06 +02:00
mkdir -p /var/quarantine
2022-07-04 17:29:59 +02:00
chown $SUDO_USER /var/quarantine
2022-06-28 22:49:48 +02:00
2022-07-04 20:24:06 +02:00
# ImageMagick and pmount
apt --fix-broken install -y
apt install -y imagemagick pmount
2022-06-28 22:49:48 +02:00
# Suppress all messages from the kernel (and its drivers) except panic messages from appearing on the console.
2022-07-04 17:29:59 +02:00
echo "kernel.printk = 3 4 1 3" | tee -a /etc/sysctl.conf
2022-07-05 20:14:07 +02:00
# Set Permanently ulimit -n / open files in ubuntu
echo "fs.file-max = 65535" | tee -a /etc/sysctl.conf
2022-06-28 22:49:48 +02:00
# allow write to /dev/fb0
2022-07-04 17:29:59 +02:00
usermod -a -G video $SUDO_USER
2022-06-28 22:49:48 +02:00
2022-06-30 10:32:30 +02:00
# allow read mouse input
2022-07-04 17:29:59 +02:00
usermod -a -G input $SUDO_USER
2022-06-30 10:32:30 +02:00
2022-07-04 17:29:59 +02:00
# Start Poetry at boot
2022-07-05 20:55:01 +02:00
echo "su - $SUDO_USER -c \"cd pandora ; poetry run update --yes\"" > /etc/rc.local
2022-07-04 17:29:59 +02:00
chmod +x /etc/rc.local
2022-06-28 22:49:48 +02:00
2022-07-05 20:14:07 +02:00
# getty1 autostart
2022-07-04 20:24:06 +02:00
mkdir -p /etc/systemd/system/getty@tty1.service.d
echo "[Service]" > /etc/systemd/system/getty@tty1.service.d/override.conf
echo "ExecStart=" >> /etc/systemd/system/getty@tty1.service.d/override.conf
echo "ExecStart=-su - pandora -c ./pandora-box/pandora-box.py" >> /etc/systemd/system/getty@tty1.service.d/override.conf
echo "StandardInput=tty" >> /etc/systemd/system/getty@tty1.service.d/override.conf
echo "StandardOutput=tty" >> /etc/systemd/system/getty@tty1.service.d/override.conf
echo "Type=idle" >> /etc/systemd/system/getty@tty1.service.d/override.conf
2022-07-04 21:20:31 +02:00
reboot
2022-07-04 20:24:06 +02:00
2022-07-05 20:14:07 +02:00