Linux下產生鏈條式密碼鑰匙shell指令碼

來源:互聯網
上載者:User


之前寫過一個這樣的博文,但因為Ecvps倒閉跑路了,所以我丟失了兩個月的資料,那篇文章也就丟失了,但是我也更新了這個指令碼的方法,將有內容產生密鑰鏈條和無內容自動隨機產生密鑰鏈條兩種,控制方法是A和B兩種.A是隨機

# !/bin/bash

random() {
  index=0
  str=""
  t=`grep '((?=[\x21-\x7e]+)[^A-Za-z0-9])'`
  for i in {a..z}; do arr[index]=$i; index=`expr ${index} + 1`; done
  for i in {A..Z}; do arr[index]=$i; index=`expr ${index} + 1`; done
  for i in {$t}; do arr[index]=$i; index=`expr ${index} + 1`; done
  for i in {0..9}; do arr[index]=$i; index=`expr ${index} + 1`; done
  for i in {1..42}; do str="$str${arr[$RANDOM%$index]}"; done
  #echo $str
s=`echo $str |cut -c1-42`
echo ${s:0:6}-${s:12:6}-${s:18:6}-${s:24:6}-${s:30:6}-${s:36:6}
}
###########################################################################################################
create() (
ip=`ifconfig | awk -F'[ ]+|:' '/inet addr/{if($4!~/^192.168|^172.16|^10|^127|^0/) print $4}'`
read name
a=`echo $name |wc -L`
if [ $a -lt 6 ];then
site=$name.$ip
else
site=$name
fi
md=`echo $site |base64 -i`
b=`echo $md |wc -L`
if [ $b -lt 36 ];then
stin=`echo $md | md5sum |base64 -i`
else
stin=$md
fi
s=`echo $stin |cut -c1-42`
echo ${s:0:6}-${s:12:6}-${s:18:6}-${s:24:6}-${s:30:6}-${s:36:6}
)
###########################################################################################################
echo "# This is to get the character channeling encryption scripting tool"
echo "# Autor: RucLinux"
echo -e "# \033[31m Please select a channel A=random | B=create \033[0m"
read ab
if [ "$ab" == "A" ]; then
echo `random`
fi
if [ "$ab" == "B" ]; then
echo -e  "\033[31m Please enter Need to encrypt a string: \033[0m"
echo `create`
fi
###########################################################################################################

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.