Upload files to "/"

This commit is contained in:
yanuaradi 2024-07-24 14:18:50 +07:00
commit 7ced30d99e
1 changed files with 82 additions and 0 deletions

82
kode program.txt Normal file
View File

@ -0,0 +1,82 @@
Kode Program Implementasi Snort Intrusion Detection System Pada Keamanan Jaringan Menggunakan Raspberry Pi sebagai berikut :
a. Install Snort pada Raspberry Pi
#install dependensi
1) $ sudo apt update
2) $ sudo apt upgrade -y
3) $ sudo apt install build-essential libcap-dev libpcre3-dev libdnet1-dev zlib1g-dev luajit hwloc libdnet-devlibdumbnet-dev bison flex liblzma-dev openssl pkg-config libhwloc-dev cmake cpputest libsqlite3-dev uuid-dev libcmocka-dev libdnetfilter-queue-dev libmnl-devautotools-dev libluajit-5.1-dev libunwind-dev libfl-dev -y
#install daq
4) $ mkdir ~/snort_src && cd ~/snort_src
5) $ wget https://www.snort.org/downloads/snort/daq-2.0.7.tar.gz
6) $ tar -xvzf daq-2.0.7.tar.gz
7) $ cd daq-2.0.7
8) $ autoreconf -f -i
9) $./configure && make && sudo make install
#install snort
10) $ cd ..
11) wget https://www.snort.org/downloads/snort/snort-2.9.20.tar.gz
12) $ tar -xvzf snort-2.9.20.tar.gz
13) $ cd snort-2.9.20
14) $ ./configure --enable-sourcefire
15) $ make
16) $ sudo make install
b. Install Apache di Raspberry OS
1) $ sudo apt-get update
2) $ sudo apt-get install apache2
3) $ sudo systemctl start apache2
4) $ sudo systemctl enable apache2
c. Konfigurasi bot Telegram
1) $ apt install git
2) $ git clone https://github.com/gagaltotal/Snort-Bot-Telegram-Shell
3) $ cd Snort-Bot-Telegram-Shell
4) $ chmod 777 bot-tele.sh
5) $ sudo nano bot-tele.sh
#!/bin/bash
#init
initCount=0
logs=/home/pi/log-tele.txt
#File
msg_caption=/tmp/telegram_msg_caption.txt
#Chat ID dan bot token Telegram
chat_id="-4245197259"
token="6531070649:AAGR5IAjV5psUz5Tt4wbfUQM3pHClDVOOps"
#kirim
function sendAlert
{
curl -s -F chat_id=$chat_id -F text="$caption"
https://api.telegram>}
#Monitoring Server
while true
do
lastCount=$(wc -c $logs | awk '{print $1}') #getSizeFileLogs
#DEBUG ONLY
#echo before_last $lastCount #ex 100 #after reset 0
#echo before_init $initCount #ex 0
#echo "--------------------"
if(($(($lastCount)) > $initCount));
then
#DEBUG
#echo "Kirim Alert..."
msg=$(tail -n 2 $logs) #GetLastLineLog
echo -e "Halo Admin Yanuar Adi Nandra ada Penyerangan pada Server
l> caption=$(<$msg_caption) #set Caption
sendAlert #Panggil Fungsi di function
echo "Alert Terkirim"
initCount=$lastCount
rm -f $msg_caption
sleep 1
fi
sleep 2 #delay if Not Indication
done
6) $ cd ~
7) $ cd Snort-Bot-Telegram-Shell/
8) $ ./bot-tele.s
9) $ snort -i eth0 -c /etc/snort/snort.conf -l /var/log/snort
-d -A console > /home/pi/log-tele.txt