#!/bin/bash
# Copyright (C) 2025 CEA - All Rights Reserved
# 
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# 
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.


if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   echo -e "Usage : sudo $0" 1>&2
   exit 1
fi

if [ $# -ne 0 ]; then
    echo -e "Usage : sudo $0"
    exit 1
fi

echo -e "[+] Stopping DNS server..."
sudo systemctl stop named

echo -e "[+] Killing C&C..."
sudo pkill -9 cnc

echo -e "[+] Killing loader..."
sudo pkill -9 loader.dbg

echo -e "[+] Killing ScanListen..."
sudo pkill -9 scanListen

echo -e "[+] Killing Webserver..."
sudo pkill -f "python3 -m http.server --bind 50.50.50.53 80"


echo -e "\n[+] Successfully killed all mirai servers.\n"
