53 lines
1.6 KiB
Bash
Executable file
53 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
# randomize-mac - Randomize MAC addresses for privacy
|
|
# Usage: sudo randomize-mac
|
|
|
|
set -euo pipefail
|
|
|
|
ETHERNET="enp3s0"
|
|
WIFI="wlp4s0"
|
|
|
|
# Check if running as root
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "❌ This script must be run as root (use sudo)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "🔄 Randomizing MAC addresses..."
|
|
echo ""
|
|
|
|
# Randomize Ethernet
|
|
echo "📡 Ethernet ($ETHERNET):"
|
|
if ip link show $ETHERNET &>/dev/null; then
|
|
echo " └─ Before: $(ip link show $ETHERNET | grep ether | awk '{print $2}')"
|
|
if macchanger -r $ETHERNET 2>/dev/null; then
|
|
echo " └─ After: $(ip link show $ETHERNET | grep ether | awk '{print $2}')"
|
|
echo " └─ ✅ Randomized successfully"
|
|
else
|
|
echo " └─ ⚠️ Failed (interface may be in use)"
|
|
fi
|
|
else
|
|
echo " └─ ⚠️ Interface not found"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Randomize WiFi
|
|
echo "📶 WiFi ($WIFI):"
|
|
if ip link show $WIFI &>/dev/null; then
|
|
echo " └─ Before: $(ip link show $WIFI | grep ether | awk '{print $2}')"
|
|
if macchanger -r $WIFI 2>/dev/null; then
|
|
echo " └─ After: $(ip link show $WIFI | grep ether | awk '{print $2}')"
|
|
echo " └─ ✅ Randomized successfully"
|
|
else
|
|
echo " └─ ⚠️ Failed (interface may be disabled or in use)"
|
|
fi
|
|
else
|
|
echo " └─ ⚠️ Interface not found"
|
|
fi
|
|
|
|
echo ""
|
|
echo "⚠️ NOTE: You may need to reconnect to your network after randomization!"
|
|
echo ""
|
|
echo "💡 TIP: WiFi ($WIFI) is currently disabled. This script will randomize it"
|
|
echo " when you enable WiFi, preventing tracking on public networks."
|