Skip to content

Instantly share code, notes, and snippets.

@ntzyz
Created January 11, 2017 07:56
Show Gist options
  • Save ntzyz/6b6758a0606d40bb2694323c36bb3d65 to your computer and use it in GitHub Desktop.
Save ntzyz/6b6758a0606d40bb2694323c36bb3d65 to your computer and use it in GitHub Desktop.
Generate PAP/CHAP user name for CMCC PPPoE server.
#!/bin/zsh
uuid=`uuidgen -t`
text1=`echo $uuid | sed "s/-//g"`
text2="YourPhoneNumberHere"
number=0
for ((i=0;i<3;++i)); do;
number=$((number + $(printf '%d ' "'${text1:$i:1}")))
done
for ((i=0;i<3;++i)); do;
number=$((number + $(printf '%d ' "'${text2:$i:1}")))
done
echo $text1$(printf "%04d" $(((177 * number + 5166) % 10000)))"01"$text2"@internet"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment