Last active
November 14, 2023 05:18
-
-
Save mapi68/f6159b3d936afdbead2bf6ce39214bac to your computer and use it in GitHub Desktop.
This Bash script prompts the user to input a MAC address and then converts it into an IPv6 address using a custom function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tput clear | |
echo | |
echo "********************* Hello $USER! *********************" | |
echo | |
echo "Please paste MAC address that you want to convert into IPv6:" | |
read A | |
ipv6() { | |
IFS=':'; set $1; unset IFS | |
echo | |
echo "IPv6 address is: fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6" | |
echo | |
} | |
ipv6 $A | |
echo | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment