From bf30f44a08bfb9ced6a908892b3e600605acda76 Mon Sep 17 00:00:00 2001 From: dbarzin Date: Wed, 6 Jul 2022 17:55:07 +0200 Subject: [PATCH] work in progress --- install.sh | 27 ++++++++++++++++----------- pandora.service | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 pandora.service diff --git a/install.sh b/install.sh index d8d9aed..afe1498 100755 --- a/install.sh +++ b/install.sh @@ -1,13 +1,17 @@ #/usr/bin/bash -e -# Install procedure for Pandora-Box + +#================================ +# Install script for Pandora-Box +#================================ set -e -cd .. +cd ~ #--------------------- # Python #--------------------- -apt install -y python-is-python3 python3-pip +sudo apt install -y python-is-python3 python3-pip +sudo apt install -y libssl-dev #--------------------- # Peotry @@ -51,7 +55,6 @@ chown -R $SUDO_USER kvrocks # Pandora #--------------------- su - $SUDO_USER -c "git clone https://github.com/pandora-analysis/pandora.git" -cd pandorra # install packages apt install -y python3-dev # for compiling things @@ -61,16 +64,17 @@ 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 -# install yara-python -su - $SUDO_USER -c "python3 -m pip show yara-python" - # set .env +cd ~/pandora echo PANDORA_HOME="`pwd`" >> .env chown $SUDO_USER .env su - $SUDO_USER -c "cd ~/pandora; poetry install" su - $SUDO_USER -c "cd ~/pandora; cp config/generic.json.sample config/generic.json" +# install yara-python +su - $SUDO_USER -c "pip install yara-python" + # ClamAV apt-get install -y clamav-daemon # In order for the module to work, you need the signatures. @@ -95,6 +99,7 @@ su - $SUDO_USER -c "cd pandora; for file in pandora/workers/*.sample; do cp -i $ #--------------------- # Pandora-box #--------------------- +cd ~/pandora-box # Python libraries su - $SUDO_USER -c "pip install pypandora psutil pyudev" @@ -118,9 +123,10 @@ usermod -a -G video $SUDO_USER # allow read mouse input usermod -a -G input $SUDO_USER -# Start Poetry at boot -echo "su - $SUDO_USER -c \"cd pandora ; poetry run update --yes\"" > /etc/rc.local -chmod +x /etc/rc.local +# Start Pandora at boot +sudo cp pandora.service.sample /etc/systemd/system/pandora.service +sudpo sed -i "s/_USER_/$SUDO_USER/g" /etc/systemd/system/pandora.service +sudo systemctl daemon-reload # getty1 autostart mkdir -p /etc/systemd/system/getty@tty1.service.d @@ -133,4 +139,3 @@ echo "Type=idle" >> /etc/systemd/system/getty@tty1.service.d/override.conf reboot - diff --git a/pandora.service b/pandora.service new file mode 100644 index 0000000..3398077 --- /dev/null +++ b/pandora.service @@ -0,0 +1,19 @@ +[Unit] +Description=Pandora service +After=network.target + +[Service] +User=_USER_ +Group=_USER_ +Type=forking +WorkingDirectory=/home/_USER_/pandora +Environment="PATH=/home/_USER_/.poetry/bin:/usr/bin" +Environment="PANDORA_HOME=/home/_USER_/pandora" +ExecStart=/bin/bash -c "exec poetry run start" +ExecStop=/bin/bash -c "exec poetry run stop" +StandardOutput=append:/var/log/pandora_message.log +StandardError=append:/var/log/pandora_error.log + + +[Install] +WantedBy=multi-user.target