cloak.sh

#!/bin/bash
# aMiscreant

echo "[+] Spoofing MAC address..."
IFACE=$(ip route | grep default | awk '{print $5}')
if [[ -n "$IFACE" ]]; then
    ip link set $IFACE down
    macchanger -r $IFACE
    ip link set $IFACE up
fi

echo "[+] Randomizing hostname..."
NEW_HOST="anon-$(tr -dc a-z0-9 </dev/urandom | head -c6)"
hostnamectl set-hostname $NEW_HOST

echo "[+] Obfuscating kernel info..."
echo "kernel.hostname = hidden" >> /etc/sysctl.conf
echo "kernel.dmesg_restrict = 1" >> /etc/sysctl.conf
echo "kernel.kptr_restrict = 2" >> /etc/sysctl.conf
sysctl -p

echo "[+] Disabling bash history..."
unset HISTFILE
ln -sf /dev/null ~/.bash_history

echo "[+] Done. You're now a ghost on the wire."

cloak_v1.sh

#!/bin/bash
# aMiscreant

echo "[+] Spoofing MAC address..."
IFACE=$(ip route | grep default | awk '{print $5}')
if [[ -n "$IFACE" ]]; then
    ip link set $IFACE down
    macchanger -r $IFACE
    ip link set $IFACE up
    dhclient -r $IFACE
    dhclient $IFACE
fi

echo "[+] Randomizing hostname..."
NEW_HOST="anon-$(tr -dc a-z0-9 </dev/urandom | head -c6)"
hostnamectl set-hostname "$NEW_HOST"

echo "[+] Obfuscating kernel info..."
for line in \
  "kernel.hostname = hidden" \
  "kernel.dmesg_restrict = 1" \
  "kernel.kptr_restrict = 2"; do
    grep -qxF "$line" /etc/sysctl.conf || echo "$line" >> /etc/sysctl.conf
done
sysctl -p

echo "[+] Disabling bash history..."
unset HISTFILE
ln -sf /dev/null ~/.bash_history

echo "[+] Cloaking complete."

cloak.service

[Unit]
Description=MAC + Hostname Cloaking
After=network-pre.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/cloak.sh
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl enable cloak.service