V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
aocif23
V2EX  ›  Linux

shc 加密的 shell 脚本在运行时卡住没反应。

  •  
  •   aocif23 · 2020-11-23 21:24:01 +08:00 · 1879 次点击
    这是一个创建于 1266 天前的主题,其中的信息可能已经有所发展或是发生改变。
    hello.sh 脚本内容
    #!/bin/bash
    echo "hello"
    
    ./hello.sh
    hello
    

    运行 shc 并生成 hello.sh.x 和 hello.sh.x.c

    shc -v -f hello.sh
    
    shc shll=bash
    shc [-i]=-c
    shc [-x]=exec '%s' "$@"
    shc [-l]=
    shc opts=
    shc: cc  hello.sh.x.c -o hello.sh.x
    shc: strip hello.sh.x
    shc: chmod go-r hello.sh.x
    
    file hello.sh.x
    
    hello.sh.x: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f0a0b69bf0de61bd28c34fe9d4a5c0655321bdaa, stripped
    
    file hello.sh.x.c
    
    hello.sh.x.c: C source, ASCII text
    

    运行 hello.sh.x,然后就卡住,没反应,只能按 ctrl+c 取消

    运行 hello.sh.x 卡住时,在另一个终端运行 ps -efww | grep hello.sh.x

    ./hello.sh.x -c exec './hello.sh.x' "$@" ./hello.sh.x
    

    请问这是什么问题?网上看教程都是直接"shc -f 脚本名" 就可以,我自己试就不行。

    第 1 条附言  ·  2020-11-26 07:12:21 +08:00
    经测试后,发现是版本问题(ubuntu 18.04 在 apt 直接安装是 3.8.9b),安装 4.0.x 版本后可以正常运行了。
    2 条回复    2020-11-26 10:37:45 +08:00
    aloxaf
        1
    aloxaf  
       2020-11-24 10:33:51 +08:00
    看了下, 这玩意儿最终还是把代码送给 bash 执行的。那这种所谓的加密就没有任何意义……

    建议不要在没有意义的事情上浪费时间
    0zero0
        2
    0zero0  
       2020-11-26 10:37:45 +08:00
    哈哈,只是起到了一个障眼法的作用
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3145 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:30 · PVG 22:30 · LAX 07:30 · JFK 10:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.