15AH, San Francisco

California, United States.

Send Your Mail At:

tianyingkejishe@sina.cn

Working Hours

Mon-Sat: 9.30am To 7.00pm

【shell】sh脚本生成二进制文件

1、叙述

脚本的好处是便捷、高效,拿起来就可以写,写完就能跑,都不用编译。但坏处也显而易见,一些敏感的、不想让外人知道的东西都是明文写在里面的。

2、安装shc编译器

下载安装:
tar xzvf shc.tar.tgz 
cd shr/
make && make install 
直接安装:
sudo apt install shc

3、使用方法

shc -r -f ./demo.sh

运行成功后会在当前目录下生成两个文件:

demo.sh.x   是脚本所对应的可执行程序
demo.sh.c   对应的c语言实现的源码

4、参数列表:

 The command line options are:

 -e date
      Expiration date in dd/mm/yyyy format [none]

 -m message
      message to display  upon  expiration  ["Please  contact
      your provider"]

 -f script_name
      File name of the script to compile

 -i inline_option
      Inline option for the shell interpreter i.e: -e

 -x comand
      eXec    command,    as    a    printf    format    i.e:
      exec(\\'%s\\',@ARGV);

 -l last_option
      Last shell option i.e: --

 -r   Relax security. Make  a  redistributable  binary  which
      executes  on different systems running the same operat-
      ing system.

 -v   Verbose compilation

 -D   Switch on debug exec calls

 -T   Allow binary to be  traceable  (using  strace,  ptrace,
      truss, etc.)

 -C   Display license and exit

 -A   Display abstract and exit

 -h   Display help and exit
anyShare分享到:
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。
stormwind