Untitled
Anonymous
plain_text
03/28/2025 3:08 PM
664 B
15
Indexable
import random
from collections import defaultdict
def generate_logs():
logs = []
for _ in range(100):
ip = f"{random.randint(1,255)}.{random.randint(1,255)}.{random.randint(1,255)}.{random.randint(1,255)}"
port = random.choice([80, 443, 22, 3389, 8080])
logs.append(f"{ip} - Port {port} - {'ALLOWED' if random.random() > 0.1 else 'BLOCKED'}")
return logs
def analyze_traffic(logs):
ip_counts = defaultdict(int)
port_scans = defaultdict(intEditor is loading...
Leave a Comment