#!/bin/bash echo "===================================" echo " Starting WSN Monitoring System " echo "===================================" # Start monitor script in background /home/user/monitor.sh & echo "✅ Monitoring started." # Move to Cooja directory cd /home/user/contiki/tools/cooja echo "🚀 Launching Cooja Simulator..." # Start Cooja ant run
Posts
- Get link
- X
- Other Apps
#!/bin/bash # Cooja log file path LOGFILE="/home/user/Desktop/wspcap/cooja_log" # Cooldown time in seconds (300 = 5 minutes) COOLDOWN=300 # Last SMS sent time LAST_SENT=0 echo "======================================" echo " Real-Time WSN Attack Monitoring " echo "======================================" # Continuously monitor log file tail -f "$LOGFILE" | while read LINE do # Print live log line echo "$LINE" # Check for attack pattern if echo "$LINE" | grep -q "Sinkhole attack" then CURRENT_TIME=$(date +%s) TIME_DIFF=$((CURRENT_TIME - LAST_SENT)) # Check cooldown if [ $TIME_DIFF -ge $COOLDOWN ] then echo "" echo "⚠️ Sinkhole attack detected!" echo "📡 ...
- Get link
- X
- Other Apps
nano monitor.sh #!/bin/bash LOGFILE="/home/user/Desktop/wspcap/cooja_log" COOLDOWN=300 LAST_SENT=0 tail -f "$LOGFILE" | while read LINE do echo "$LINE" if echo "$LINE" | grep -q "Sinkhole attack" then CURRENT_TIME=$(date +%s) TIME_DIFF=$((CURRENT_TIME - LAST_SENT)) if [ $TIME_DIFF -ge $COOLDOWN ] then echo "⚠️ Sinkhole attack detected! Sending SMS..." curl -X POST https://api.twilio.com/2010-04-01/Accounts/YOUR_SID/Messages.json \ --data-urlencode "Body=⚠️ Sinkhole attack detected in WSN network!" \ --data-urlencode "From=+1XXXXXXXXXX" \ --data-urlencode "To=+91XXXXXXXXXX" \ -u YOUR_SID:YOUR_TOKEN LAST_SENT=$CURRENT_TIME else echo "Cooldown active. SMS skipped." fi fi done
4 DIRECTION TRAFFIC LIGHT
- Get link
- X
- Other Apps
CODE:- int red1 = 13; int yellow1 = 12; int green1 = 11; int red2 = 10; int yellow2 = 9; int green2 = 8; int red3 = 7; int yellow3 = 6; int green3 = 5; int red4 = 4; int yellow4 = 3; int green4 = 2; void setup() { for(int i = 2; i<=13; i++) { pinMode(i, OUTPUT); } } void loop() { direction(red1, yellow1, green1, red2, yellow2, green2, red3, yellow3, green3, red4, yellow4, green4); direction(red2, yellow2, green2, red1, yellow1, green1, red3, yellow3, green3, red4, yellow4, green4); direction(red3, yellow3, green3, red1, yellow1, green1, red2, yellow2, green2, red4, yellow4, green4); direction(red4, yellow4, green4, red1, yellow1, green1, red2, yellow2, green2, red3, yellow3, green3); } void direc...