-
Notifications
You must be signed in to change notification settings - Fork 0
/
cringe.py
25 lines (21 loc) · 816 Bytes
/
cringe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import time
from scapy.all import sniff, TCP
# Specify the domain to monitor
SOCIAL_MEDIA_DOMAINS = ["twitter.com"]
def shutdown():
if os.name == 'nt': # Windows
os.system("shutdown /s /t 1")
elif os.name == 'posix': # Unix-based
os.system("shutdown now")
def packet_callback(packet):
if packet.haslayer(TCP) and packet.haslayer('IP'):
# Check if the packet has a Raw layer
if packet.haslayer('Raw'):
# Check the destination IP address
payload = packet['Raw'].load.decode(errors='ignore')
for domain in SOCIAL_MEDIA_DOMAINS:
if domain in payload:
shutdown()
print("Starting network monitor. Please run this script with administrative privileges.")
sniff(prn=packet_callback, store=0)