#!/bin/sh

#####################################################################################
#                                                                                   #
# * Description :                                                                   #
#       This is the installation script for the reproducer script                   #
#       CVE-2017-15412 which install all the requirements needed                     #
#       to use it .                                                                 #
#                                                                                   #
#                                                                                   #
# * Date : <DATE>                                                                   #
#                                                                                   #
# * Author :                                                                        #
#                                                                                   #
# *  NOTES :                                                                        #
#    - This File Was Generated Automatically And May Contains Bugs                  #
#                                                                                   #
#                                                                                   #
#####################################################################################

BASE=$(pwd)
PKG_MANAGER=""
PKG_DEV="devel"

if [ -e "/bin/dnf" ] ; then
    PKG_MANAGER="dnf"
else
    if [ -e "/bin/apt" ] ; then
        PKG_MANAGER="apt-get"
        PKG_DEV="dev"
    fi
fi

echo " ____     __  __  ____                 ___       __      _     ________          _  ______  __ __       _      ___     "
echo "/\\  _\`\\  /\\ \\/\\ \\/\\  _\`\\             /'___\`\\   /'__\`\\  /' \\   /\\_____  \\       /' \\/\\  ___\\/\\ \\\\ \\    /' \\   /'___\`\\   "
echo "\\ \\ \\/\\_\\\\ \\ \\ \\ \\ \\ \\L\\_\\          /\\_\\ /\\ \\ /\\ \\/\\ \\/\\_, \\  \\/___//'/'      /\\_, \\ \\ \\__/\\ \\ \\\\ \\  /\\_, \\ /\\_\\ /\\ \\  "
echo " \\ \\ \\/_/_\\ \\ \\ \\ \\ \\  _\\L   _______\\/_/// /__\\ \\ \\ \\ \\/_/\\ \\     /' /'_______\\/_/\\ \\ \\___\`\`\\ \\ \\\\ \\_\\/_/\\ \\\\/_/// /__ "
echo "  \\ \\ \\L\\ \\\\ \\ \\_/ \\ \\ \\L\\ \\/\\______\\  // /_\\ \\\\ \\ \\_\\ \\ \\ \\ \\  /' /' /\\______\\  \\ \\ \\/\\ \\L\\ \\ \\__ ,__\\ \\ \\ \\  // /_\\ \\"
echo "   \\ \\____/ \\ \`\\___/\\ \\____/\\/______/ /\\______/ \\ \\____/  \\ \\_\\/\\_/   \\/______/   \\ \\_\\ \\____/\\/_/\\_\\_/  \\ \\_\\/\\______/"
echo "    \\/___/   \`\\/__/  \\/___/           \\/_____/   \\/___/    \\/_/\\//                 \\/_/\\/___/    \\/_/     \\/_/\\/_____/ "
echo "                                                                                                                       "
echo "                                                                                                                       "


echo "[*] Using Package Manager : $PKG_MANAGER"
echo "[*] Installing Depencies"
sudo $PKG_MANAGER install -y perl perl-$PKG_DEV libxml2 libxml2-static libxml2-devel mod_security mod_security_crs mod_security_crs-extras
 
echo "[*] Installing Perl Dependencies ..."
cpan -f -T -i Getopt::Long
cpan -f -T -i DateTime
cpan -f -T -i URI::URL
cpan -f -T -i HTTP::Request
cpan -f -T -i HTTP::Cookies
cpan -f -T -i HTTP::Proxy
cpan -f -T -i HTTP::Daemon
cpan -f -T -i Time::HiRes
cpan -f -T -i Term::ANSIColor
cpan -f -T -i Data::Dump
cpan -f -T -i Data::Validate::URI
cpan -f -T -i LWP::UserAgent
cpan -f -T -i MIME::Base32
cpan -f -T -i MIME::Base64
cpan -f -T -i HTML::Entities
cpan -f -T -i HTTP::Response

echo "[+] Done."
