前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux下Shell加密-shc脚本加密

Linux下Shell加密-shc脚本加密

原创
作者头像
pooky
发布2021-01-06 17:12:24
4.2K0
发布2021-01-06 17:12:24
举报
文章被收录于专栏:开发随笔开发随笔开发随笔

今天在LInux了接触到一个命令:“shc”,以前还真没遇到过,这个也不是内置的 ,不过挺有意思的 记录一下

这个是一个专门给shell脚本进行二进制加密的一个小程序,安装的话

直接

yum install shc

当然也可以源码安装

https://github.com/neurobin/shc

./configure
make
sudo make install

下面看下一些命令

shc Version 4.0.3, Generic Shell Script Compiler
shc GNU GPL Version 3 Md Jahidul Hamid <jahidulhamid@yahoo.com>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-o outfile] [-rvDSUHCABh] -f script

    -e %s  Expiration date in dd/mm/yyyy format [none]
    -m %s  Message to display upon expiration ["Please contact your provider"]
    -f %s  File name of the script to compile
    -i %s  Inline option for the shell interpreter i.e: -e
    -x %s  eXec command, as a printf format i.e: exec('%s',@ARGV);
    -l %s  Last shell option i.e: --
    -o %s  output filename
    -r     Relax security. Make a redistributable binary
    -v     Verbose compilation
    -S     Switch ON setuid for root callable programs [OFF]
    -D     Switch ON debug exec calls [OFF]
    -U     Make binary untraceable [no]
    -H     Hardening : extra security protection [no]
           Require bourne shell (sh) and parameters are not supported
    -C     Display license and exit
    -A     Display abstract and exit
    -B     Compile for busybox
    -h     Display help and exit

    Environment variables used:
    Name    Default  Usage
    CC      cc       C compiler command
    CFLAGS  <none>   C compiler flags
    LDFLAGS <none>   Linker flags

    Please consult the shc man page.

举个例子:

编写一个hello.sh

#!/bin/bash
echo "helloWorld"

加密:

shc -r -f hello.sh

会生成几个文件

[root@VM-88-103-centos ~/tmp/shc]# ls
hello.sh  hello.sh.x  hello.sh.x.c

其中hello.sh.x 是可执行二进制文件,直接复制给其他人就可以直接使用了

[root@VM-88-103-centos ~/tmp/shc]# ./hello.sh.x 
helloWorld

而hello.sh.x.c 是c源码 这里就不贴了

二进制文件是不可查看的,所以有些脚本要给别人用,但是不想源码开放的话可以用这个工具

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云开发 CloudBase
云开发(Tencent CloudBase,TCB)是腾讯云提供的云原生一体化开发环境和工具平台,为200万+企业和开发者提供高可用、自动弹性扩缩的后端云服务,可用于云端一体化开发多种端应用(小程序、公众号、Web 应用等),避免了应用开发过程中繁琐的服务器搭建及运维,开发者可以专注于业务逻辑的实现,开发门槛更低,效率更高。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档