Created
February 9, 2016 18:02
-
-
Save cnf/5fbb673a3bc27f9b0d28 to your computer and use it in GitHub Desktop.
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/sh | |
# Frank Rosquin <[email protected]> | |
MAC=$1 | |
echo "Calculating ipv6 for $MAC" | |
LEAD=`echo $MAC|awk -F':' '{ print $1}'` | |
FIXED=`echo $MAC|awk -F':' '{ print tolower($2":"$3":"$4":"$5":"$6)}'` | |
# TODO: TOGGLE this | |
SIGNIF=`printf "%02x" $((0x$LEAD | 0x02))` | |
echo $SIGNIF | |
# SIGNIF=`printf "%02x" $((0x$SIGNIF ^ 0x02))` | |
NMAC="$SIGNIF:$FIXED" | |
echo $SIGNIF | |
LEAD=`echo $NMAC|awk -F':' '{ print $1$2":"$3}'` | |
END=`echo $NMAC|awk -F':' '{ print $4":"$5$6}'` | |
echo "Connect to: fe80::${LEAD}ff:fe${END}%<device>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment