initial BLIT commit

This commit is contained in:
Ruzicka Pavel 2016-09-16 03:03:49 +02:00
parent 7c2356fe80
commit 5130a2ab11
24 changed files with 900 additions and 0 deletions

View file

@ -0,0 +1,9 @@
=== Instalation ===
# install dictionary
apt-get install wamerican
cp hostnamechanger /etc/network/if-pre-up.d/
chmod 755 /etc/network/if-pre-up.d/hostnamechanger
watch 'egrep "^send host-name" /etc/dhcp/dhclient.conf'
# disconnect and connect back to your network

View file

@ -0,0 +1,18 @@
#!/bin/bash
WORDFILE="/usr/share/dict/words"
# if no wordfile than fukitol
test -f "$WORDFILE" || exit 0
#Number of lines in $WORDFILE is max value for random chooser
wordfile_lines=$(awk 'NF!=0 {++c} END {print c}' "$WORDFILE")
## bash VARIANT
rnum="$((${RANDOM}*${RANDOM}%${wordfile_lines}+1))"
newhostname="$(sed -n "$rnum p" $WORDFILE |sed 's/[^a-zA-Z0-9]//g')"
## coreutils VARIANT
#newhostname="$(shuf -n1 /usr/share/dict/words|sed 's/[^a-zA-Z0-9]//g')"
#sed "s=$(hostname)=REPLACEME=g" -i /etc/hosts && hostname "$newhostname" && sed "s=REPLACEME=$(hostname)=g" -i /etc/hosts
sed -i "s+send host-name = .*+send host-name = \"${newhostname}\";+" /etc/dhcp/dhclient.conf