## 1、查看mac地址 执行以下命令,查看云服务器的mac地址。 ```shell ifconfig ``` 执行以下命令查看ens33的mac地址。 ```shell ifconfig ens33 |egrep "ether" ``` 返回mac地址 ```shell ifconfig ens33 |egrep "ether" |awk '{print $2}' >> src.txt ``` ## 2、生产密钥 1. 创建私钥: ```shell #RSA加密算法产生的2048位私钥,并使用F4作为公钥的E参数,将私钥保存在文件key.pri中 openssl genrsa -out key.pri -f4 2048 ``` 2. 导出公钥 ```shell #用rsa的私钥文件key.pri导出PEM格式的公钥,保存在文件key.pub中 openssl rsa -inform PEM -outform PEM -in key.pri -out key.pub -pubout ``` 3. 私钥签名 ```shell #产生签名文件src.sig openssl dgst -sha256 -out src.sig -sign key.pri -keyform PEM src.txt ``` ## 3、脚本 ```shell ifconfig ens33 |egrep "ether" |awk '{print $2}' >> /tmp/mac_address result=`openssl dgst -sha256 -keyform PEM -verify key.pub -signature src.sig /tmp/mac_address` rm /tmp/mac_address if [ "$result" = "Verification Failure" ];then exit fi ``` ## 4、混淆shell 1. 下载Bashfuscator ```shell apt-get update && apt-get install python3 python3-pip python3-argcomplete xclip git git clone https://gitee.com/l0n9/Bashfuscator.git cd Bashfuscator python3 setup.py install --user cd bashfuscator/bin/ cp bashfuscator /usr/local/bin ``` 2. 混淆shell脚本 **低混淆程度** ```shell bashfuscator -s 1 -t 1 --layers 1 --no-file-write -f test.sh -o output.sh ``` **正常混淆** ```she bashfuscator -f test.sh -o output.sh ```