基于mac地址创建唯一标识
function gen_code(){
local enc_code=`echo $mac | openssl aes-128-cbc -k etherlinks -base64 -pbkdf2 -iter 100`
log_suss "\n您的机器码为: $enc_code"
}
解码:
function detect_status(){
if [ ! -f /opt/etherlinks ];then
status=`echo -e "\033[31m未激活\033[0m"`
else
local enc_code=`sudo cat /opt/etherlinks`
local dec_code=`echo $enc_code | openssl des3 -d -k "etherlinks" -base64 -pbkdf2 -iter 100`
if [ $dec_code == $mac ];then
status=`echo -e "\033[32m已激活\033[0m"`
else
status=`echo -e "\033[31m未激活\033[0m"`
log_err_pause "激活失败!\n请检查激活码!"
fi
fi
}