Shell 腳本加密


shc加密

加密軟件shcshc是linux的一款加密腳本的插件東西比較安全我們可以利用wget將文件放在root目錄下也可以通過sftp放在root目錄也可以直接利用cd命令選擇目錄

wget https://files-cdn.cnblogs.com/files/meilong/shc-3.8.9b.tar
tar vxf shc-3.8.9b.tgz
cd shc-3.8.9b
make test
make strings
make install

復制代碼->發現報錯的情況比較嚴重

*** Installing shc and shc.1 on /usr/local
*** ?Do you want to continue? y
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/
install: target `/usr/local/man/man1/' is not a directory: No such file or directory
make: *** [install] Error 1
#復制代碼
#請創建 mkdir -p /usr/local/man/man1/ ,然后運行make install
#也可以直接無視,一般沒什么影響,只是少了對應的幫助文檔。

常用參數:

  • -e date (指定過期日期)
  • -m message (指定過期提示的信息)
  • -f script_name(指定要編譯的shell的路徑及文件名)
  • -r Relax security. (可以相同操作系統的不同系統中執行)
  • -v Verbose compilation(編譯的詳細情況)

加密方法

  • 假如說我們這個腳本名字叫sokebox.com.sh那我們就執行Bashshc -v -f sokebox.com
    • -v 是現實加密過程
    • -f 后面跟需要加密的文件
  • abc.sh.x為二進制文件,賦予執行權限后,可直接執行。更改名字mv sokebox.com.sh.x sokebox.com.sh
  • abc.sh.x.c 是c源文件。基本沒用,可以刪除
  • 過期加密法:另shc還提供了一種設定有效執行期限的方法,過期時間,如:
shc -e 14/09/2016 -m -f sokebox.com.sh
#選項“-e”指定過期時間,格式為“日/月/年”;選項“-m”指定過期后執行此shell程序的提示信息。
#如果在過期后執行,則會有如下提示:

./abc.sh.x
./abc.sh.x: has expired!(文件已經過期)
#使用以上方法要注意,需防止用戶更改系統時間,可以通過在程序中加入自動更新系#統時間的命令來解決此問題。
#測試都已通過,請放心使用!

unshc解密

wget https://files-cdn.cnblogs.com/files/meilong/unshc.sh
[*] Usage : ./unshc.sh [OPTIONS] <file.sh.x>
         -h | --help                          : print this help message
         -a OFFSET | --arc4 OFFSET            : specify the arc4() offset arbitrarily (without 0x prefix)
         -d DUMPFILE | --dumpfile DUMPFILE    : provide an object dump file (objdump -D script.sh.x > DUMPFILE)
         -s STRFILE | --stringfile STRFILE    : provide a string dump file (objdump -s script.sh.x > STRFILE)
         -o OUTFILE | --outputfile OUTFILE    : indicate the output file name

[*] e.g :
        ./unshc.sh script.sh.x
        ./unshc.sh script.sh.x -o script_decrypted.sh
        ./unshc.sh script.sh.x -a 400f9b
        ./unshc.sh script.sh.x -d /tmp/dumpfile -s /tmp/strfile
        ./unshc.sh script.sh.x -a 400f9b -d /tmp/dumpfile -s /tmp/strfile -o script_decrypted.sh


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM