Rascals are always sociable, and the chief sign that a man has any nobility in his character is the little pleasure he takes in others company. Arthur Schopenhauer

Here is a simple bash script to obfuscate an IPv4 address, I’ll let you guess the logic from the actual code.


read -p "IPv4 address to obfuscate: " ip

if ! echo "$ip" | grep -Pq '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'; then
	echo "Invalid IPv4 address: $ip"
	exit 1

IFS='.' read -ra ipmod <<< "$ip"
hex=$(printf '%x' $first)

for ((i = 1; i < 4; i++)); do
	decimal=$((decimal + ipmod[$i] * 256 ** (3 - $i) ))


echo -e "\nObfuscated IPv4 address: $final"

And to test it:

$ bash
IPv4 address to obfuscate:

Obfuscated IPv4 address: 0x9.592137
$ ping 0x9.592137
PING 0x9.592137 ( 56 data bytes
64 bytes from icmp_seq=0 ttl=58 time=75.316 ms
64 bytes from icmp_seq=1 ttl=58 time=77.938 ms