{"id":212519,"date":"2021-03-04T08:43:06","date_gmt":"2021-03-04T00:43:06","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=212519"},"modified":"2021-02-26T10:43:29","modified_gmt":"2021-02-26T02:43:29","slug":"shc-encrypt-shell","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/shc-encrypt-shell.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528SHC\u52a0\u5bc6Shell\u811a\u672c"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5982\u4f55\u5728Linux\u73af\u5883\u4e2d\u52a0\u5bc6shell\u811a\u672c\uff1fshell\u811a\u672c\u5305\u542b\u5bc6\u7801\uff0c\u4e0d\u5e0c\u671b\u5176\u4ed6\u5177\u6709\u6267\u884c\u6743\u9650\u7684\u4eba\u67e5\u770bshell\u811a\u672c\u5e76\u83b7\u53d6\u5bc6\u7801\u3002\u53ef\u4ee5\u5b89\u88c5\u4f7f\u7528shc\u5de5\u5177\uff0c\u666e\u901a\u7528\u6237\u65e0\u6cd5\u8bfb\u53d6shc\u521b\u5efa\u7684\u52a0\u5bc6Shell\u811a\u672c\u3002SHC\u662f\u6307\uff1aShell\u811a\u672c\u7f16\u8bd1\u5668(Shell Script Compiler)\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u73af\u5883<\/strong><\/div>\n

Centos8<\/p>\n

\u5b89\u88c5shc<\/strong><\/div>\n
\r\n[root@localhost ~]# yum -y install shc\r\n<\/pre>\n

\"\"<\/p>\n

\u521b\u5efa\u4e00\u4e2ashell\u811a\u672c<\/strong><\/div>\n

\u4e0b\u9762\u521b\u5efa\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\uff1a<\/p>\n

\r\n[root@localhost ~]# vim welcome.sh\r\n\r\n#!\/bin\/sh\r\necho \"Welcome to linux world\"\r\n<\/pre>\n
\u4f7f\u7528shc\u52a0\u5bc6\u8be5\u811a\u672c\u6587\u4ef6<\/strong><\/div>\n

\u5982\u4e0b\u6240\u793a\uff0c\u4f7f\u7528shc\u52a0\u5bc6welcome.sh\u811a\u672c\u3002<\/p>\n

\r\n[root@localhost scripts]# shc -v -f welcome.sh \r\nshc shll=sh\r\nshc [-i]=-c\r\nshc [-x]=exec '%s' \"$@\"\r\nshc [-l]=\r\nshc opts=\r\nshc: cc   welcome.sh.x.c -o welcome.sh.x\r\nshc: strip welcome.sh.x\r\nshc: chmod ug=rwx,o=rx welcome.sh.x\r\n<\/pre>\n

\"\"<\/p>\n

    \n
  • welcome.sh \u662f\u539f\u59cb\u7684\u672a\u52a0\u5bc6shell\u811a\u672c<\/li>\n
  • welcome.sh.x \u662f\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\u52a0\u5bc6shell\u811a\u672c<\/li>\n
  • welcome.sh.x.c \u662fwelcome.sh\u6587\u4ef6\u7684C\u6e90\u4ee3\u7801\u3002\u7f16\u8bd1\u8be5C\u6e90\u4ee3\u7801\u4ee5\u521b\u5efa\u4e0a\u9762\u7684\u52a0\u5bc6\u7684welcome.sh.x\u6587\u4ef6\u3002<\/li>\n<\/ul>\n

    \u53ef\u4ee5\u4f7f\u7528file<\/code>\u547d\u4ee4\u67e5\u770b\u6587\u4ef6\u7684\u7c7b\u578b\uff1a<\/p>\n

    \r\n[root@localhost scripts]# file welcome.sh\r\nwelcome.sh: POSIX shell script, ASCII text executable\r\n[root@localhost scripts]# file welcome.sh.x\r\nwelcome.sh.x: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter \/lib64\/ld-linux-x86-64.so.2, for GNU\/Linux 3.2.0, BuildID[sha1]=35e0e2569eca90774e379d6fef51ad6fedf346f5, stripped\r\n[root@localhost scripts]# file welcome.sh.x.c\r\nwelcome.sh.x.c: C source, ASCII text\r\n[root@localhost scripts]# \r\n<\/pre>\n

    \"\"<\/p>\n

    \u6267\u884c\u52a0\u5bc6\u540e\u7684shell\u811a\u672c<\/strong><\/div>\n

    \u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u6267\u884c\u52a0\u5bc6\u7684Shell\u811a\u672c\uff0c\u786e\u4fdd\u80fd\u591f\u8fd0\u884c\uff1a<\/p>\n

    \r\n[root@localhost scripts]# .\/welcome.sh.x \r\nWelcome to linux world\r\n<\/pre>\n

    \"\"<\/p>\n

    \u6307\u5b9aShell\u811a\u672c\u7684\u8fc7\u671f\u65f6\u95f4<\/strong><\/div>\n

    \u4f7f\u7528shc\uff0c\u60a8\u8fd8\u53ef\u4ee5\u6307\u5b9a\u5230\u671f\u65e5\u671f\u3002\u5373\u5728\u8fd9\u4e2a\u5230\u671f\u65e5\u671f\u4e4b\u540e\uff0c\u5f53\u6709\u4eba\u5c1d\u8bd5\u6267\u884cShell\u811a\u672c\u65f6\uff0c\u5c06\u6536\u5230\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528shc -e<\/code>\u9009\u9879\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u52a0\u5bc6Shell\u811a\u672c\uff0c\u6307\u5b9a\u5230\u671f\u65e5\u671f\u3002\u5230\u671f\u65e5\u671f\u4ee5dd\/mm\/yyyy \u683c\u5f0f\u6307\u5b9a\u3002<\/p>\n

    \r\n# \u5220\u9664\u4e4b\u524d\u521b\u5efa\u7684.x , .x.c\u6587\u4ef6\r\n[root@localhost scripts]# rm -rf welcome.sh.x*\r\n# \u521b\u5efa\u5e26\u6709\u8fc7\u671f\u65f6\u95f4\u7684\u52a0\u5bc6\u811a\u672c\r\n[root@localhost scripts]# shc -e 01\/02\/2021 -v -f welcome.sh \r\nshc shll=sh\r\nshc [-i]=-c\r\nshc [-x]=exec '%s' \"$@\"\r\nshc [-l]=\r\nshc opts=\r\nshc: cc   welcome.sh.x.c -o welcome.sh.x\r\nshc: strip welcome.sh.x\r\nshc: chmod ug=rwx,o=rx welcome.sh.x\r\n<\/pre>\n

    \"\"
    \n\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u5982\u679c\u6709\u4eba\u5c1d\u8bd5\u6267\u884cwelcome.sh.x\u811a\u672c\u6587\u4ef6\uff0c\u4f1a\u63d0\u793a\u5df2\u8fc7\u671f\u3002<\/p>\n

    \r\n[root@localhost scripts]# .\/welcome.sh.x \r\n.\/welcome.sh.x: has expired!\r\nPlease contact your provider jahidulhamid@yahoo.com\r\n<\/pre>\n

    \"\"
    \n\u5982\u679c\u8981\u6307\u5b9a\u81ea\u5b9a\u4e49\u5230\u671f\u6d88\u606f\uff0c\u9700\u8981\u52a0\u5165-m<\/code>\u9009\u9879\u3002<\/p>\n

    \r\n[root@localhost scripts]# shc -e 01\/02\/2021 -m \"Please contact admin@example.com!\" -v -f welcome.sh \r\nshc shll=sh\r\nshc [-i]=-c\r\nshc [-x]=exec '%s' \"$@\"\r\nshc [-l]=\r\nshc opts=\r\nshc: cc   welcome.sh.x.c -o welcome.sh.x\r\nshc: strip welcome.sh.x\r\nshc: chmod ug=rwx,o=rx welcome.sh.x\r\n<\/pre>\n

    \"\"<\/p>\n

    \u603b\u7ed3<\/strong><\/div>\n

    \u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528shc\u52a0\u5bc6shell\u811a\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

    Centos8 [root@localhost ~]# yum -y install shc \u4e0b\u9762\u521b\u5efa\u4e00\u4e2a\u811a\u672c […]<\/p>\n","protected":false},"author":309,"featured_media":212520,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-212519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=212519"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212519\/revisions"}],"predecessor-version":[{"id":212528,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212519\/revisions\/212528"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/212520"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=212519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=212519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=212519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}