佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > shell腳本加密工具shc使用詳解

shell腳本加密工具shc使用詳解

熱門標(biāo)簽:地方門戶網(wǎng)站 AI電銷 鐵路電話系統(tǒng) 網(wǎng)站排名優(yōu)化 呼叫中心市場需求 服務(wù)外包 Linux服務(wù)器 百度競價(jià)排名

shell腳本加密工具shc

shc是一個(gè)加密shell腳本的工具.它的作用是把shell腳本轉(zhuǎn)換為一個(gè)可執(zhí)行的二進(jìn)制文件.

應(yīng)用場景

用shell腳本對系統(tǒng)進(jìn)行自動化維護(hù),簡單,便捷而且可移植性好.但shell腳本是可讀寫的,很有可能會泄露敏感信息,如用戶名,密碼,路徑,IP等.

對于腳本中含有一些敏感信息的,通常我們都想做成二進(jìn)制程序,不讓用戶看到源碼,對于有這種需求的通常我們一般采用shc或者gzexe,我個(gè)人還是比較推薦shc。

shc 安裝 和使用

yum -y install shc 或 apt install shc

我們隨便寫一個(gè)腳本

# cat test.sh
#!/bin/bash

echo "this is shc test"

用shc加密

shc -r -v -f test.sh

shc -r -f script-name 注意:要有-r選項(xiàng), -f 后跟要加密的腳本名.

# ls -l
total 36
-rw-r--r-- 1 root root    37 12月 20 21:48 test.sh
-rwx--x--x 1 root root 11160 12月 20 21:48 test.sh.x
-rw-r--r-- 1 root root  9433 12月 20 21:48 test.sh.x.c

加密后會生成二個(gè)文件
test.sh 源文件
test.sh.x 加密后二進(jìn)制文件
test.sh.x.c 腳本對應(yīng)的C語言版本源碼

執(zhí)行一下加密后文件

# ./test.sh.x
this is shc test

shc解密

市面上面現(xiàn)在有對應(yīng)的unshc解密程序,我們直接去github看看

https://github.com/yanncam/UnSHc/
支持x86 mips arm架構(gòu)CPU
但對于我測試結(jié)果對于x86支持應(yīng)該是最好的,作者自己維護(hù)的,其它的是第三方個(gè)人維護(hù),兼容性不好。

 # ./unshc.sh /tmp/test.sh.x  -o test.txt
 _   _       _____ _   _
| | | |     /  ___| | | |
| | | |_ __ \ `--.| |_| | ___
| | | | '_ \ `--. \  _  |/ __|
| |_| | | | /\__/ / | | | (__
 \___/|_| |_\____/\_| |_/\___|

--- UnSHc - The shc decrypter.
--- Version: 0.8
------------------------------
UnSHc is used to decrypt script encrypted with SHc
Original idea from Luiz Octavio Duarte (LOD)
Updated and modernized by Yann CAM
- SHc   : [http://www.datsi.fi.upm.es/~frosal/]
- UnSHc : [https://www.asafety.fr/unshc-the-shc-decrypter/]
------------------------------

[*] Input file name to decrypt [/tmp/test.sh.x]
[+] Output file name specified [test.txt]
[+] ARC4 address call candidate : [0x400d06]
[*] Extracting each args address and size for the 14 arc4() calls with address [0x400d06]...
	[0] Working with var address at offset [0x602179] (0x2a bytes)
	[1] Working with var address at offset [0x602121] (0x1 bytes)
	[2] Working with var address at offset [0x602319] (0xa bytes)
	[3] Working with var address at offset [0x602170] (0x3 bytes)
	[4] Working with var address at offset [0x6020e0] (0xf bytes)
	[5] Working with var address at offset [0x602141] (0x1 bytes)
	[6] Working with var address at offset [0x602127] (0x16 bytes)
	[7] Working with var address at offset [0x602144] (0x16 bytes)
	[8] Working with var address at offset [0x60215d] (0x13 bytes)
	[9] Working with var address at offset [0x6021ad] (0x1 bytes)
	[10] Working with var address at offset [0x6021ae] (0x1 bytes)
	[11] Working with var address at offset [0x6020f9] (0x26 bytes)
	[12] Working with var address at offset [0x6021b3] (0x13 bytes)
	[13] Working with var address at offset [0x6021c8] (0x13 bytes)
[*] Extracting password...
	[+] PWD address found : [0x6021ec]
	[+] PWD size found : [0x100]
[*] Executing [/tmp/MYoKED] to decrypt [/tmp/test.sh.x]
[*] Retrieving initial source code in [test.txt]
[*] All done!
root@Develop:~/UnSHc-master/latest# cat test.txt
#!/bin/bash

echo "this is shc test"

可見直接解密出來源碼,對于x86的這種,支持非常的好。 其原理 就是 頭部增加4096字節(jié)亂碼。并且 shc加密的腳本在運(yùn)行時(shí)ps -ef可以看到shell的源碼。 因此,shc其實(shí)不是真的很有用!

以上就是shell腳本加密工具shc的詳細(xì)內(nèi)容,更多關(guān)于shell腳本加密工具的資料請關(guān)注腳本之家其它相關(guān)文章!

您可能感興趣的文章:
  • 使用shc工具加密shell腳本詳解
  • Powershell實(shí)現(xiàn)加密解密文本文件方法實(shí)例
  • CentOS下對shell腳本加密的二種方法
  • 對Shell 腳本加密的方法
  • asp木馬代碼解密的隨機(jī)加密webshell

標(biāo)簽:湖南 仙桃 崇左 銅川 湘潭 衡水 蘭州 黃山

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《shell腳本加密工具shc使用詳解》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    原阳县| 灯塔市| 乐清市| 云南省| 临沧市| 临朐县| 额济纳旗| 阳城县| 墨竹工卡县| 永福县| 棋牌| 永靖县| 隆子县| 青川县| 慈溪市| 清涧县| 马公市| 甘谷县| 浦县| 陈巴尔虎旗| 泾阳县| 台东市| 石家庄市| 合阳县| 无棣县| 安远县| 长泰县| 三原县| 右玉县| 金乡县| 汪清县| 顺昌县| 汝南县| 沾化县| 克什克腾旗| 杭锦旗| 寻甸| 太谷县| 崇阳县| 包头市| 高密市|