zoukankan      html  css  js  c++  java
  • Shell脚本加密--shc/gzexe

    Shell脚本加密--shc/gzexe

    官方网站:http://www.datsi.fi.upm.es/~frosal/

    说明:shc是一个脚本编译工具, 使用RC4加密算法, 它能够把shell程序转换成二进制可执行文件(支持静态链接和动态链接)。当shell脚本存在敏感信息如账号密码,想加强脚本的安全性又或是不想让别人查看及修改您shell核心代码等情况。都可使用以下工具进行加密。


    安装
    wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
    yum -y install gcc gcc-c++
    mkdir -p /usr/local/man/man1
    make install

    常用参数:
    -e date
    -m message
    -f script_name
    -r Relax security
    -v Verbose compilation

    使用说明
    shc -v -r -T -f test.bash
    运行后会生成两个文件:
    test.bash.x 和 test.bash.x.c
    test.bash.x为二进制文件,赋予执行权限更改名字mv test.bash.x test.sh
    test.bash.x.c 是c源文件,可以删除

    Shell脚本加密--shc/gzexe

    注意:生成的二进制文件是动态链接形式, 所以在其它平台上不能运行

    编译参数来生成静态链接库的脚本

    CFLAGS=-static shc -v -r -T -f test.bash

    Shell脚本加密--shc/gzexe

    错误解决:


    /usr/bin/ld: cannot find -lc

    collect2: ld returned 1 exit status

    如果编译静态脚本时出错,说明没有找到静态链接库lib.a,请yum -y install glibc-static



    过期时间

    shc -e 01/01/2016 -m "liujun_live@icloud.com" -f test.csh
    如果在过期后执行,则会有如下提示:
    root@db:shc-3.8.9b#./test.csh.x
    ./test.csh.x: has expired!
    liujun_live@icloud.com
    提示:以上方法需防止用户更改系统时间,可通过在程序中加入自动更新系统时间(ntpdate time.nist.gov)来解决。



    gzexe
    gzexe foo.sh
    原来的 foo.sh 就被存为 foo.sh~,新的 foo.sh 是乱码,但是可以用 sh 的方式运行

    Shell脚本加密--shc/gzexe

  • 相关阅读:
    回溯法之图的着色问题
    回溯法基本思想
    L2-006 树的遍历
    P1540 机器翻译
    P1067 多项式输出
    C++STL之map映照容器
    C++STL之multiset多重集合容器
    C++STL之set集合容器
    C++之string基本字符系列容器
    C++STL之vector向量容器
  • 原文地址:https://www.cnblogs.com/lixuebin/p/10814347.html
Copyright © 2011-2022 走看看