参考:https://blog.csdn.net/whatday/article/details/104730095?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162219044316780274117588%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=162219044316780274117588&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_v2~rank_v29-2-104730095.nonecase&utm_term=shell++变二进制文件&spm=1018.2226.3001.4450

注意⚠️: 写的脚本第一行必须是#!/bin/bash -x

下载地址:

http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz

简介:

NAME

     shc - Generic shell script compiler

SYNOPSIS

     shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ][ -l lopt ] [ -ACDhTv ] -f script

DESCRIPTION

     shc creates a stripped  binary  executable  version  of  thescript specified with -f on the command line.The binary version will get a .x extension appended and willusually  be  a  bit  larger  in size than the original asciicode. Generated C source code is saved in a  file  with  theextension .x.cIf you supply an expiration date with the -e option the com-piled  binary  will  refuse to run after the date specified.The message "Please contact your provider" will be displayedinstead.  This message can be changed with the -m option.You can compile any kind of shell script, but  you  need  tosupply valid -i, -x and -l options.The compiled binary will still be  dependent  on  the  shellspecified  in  the  first  line  of  the  shell  code  (i.e.#!/bin/sh), thus shc does not create completely  independentbinaries.shc itself is not a compiler such as cc, it  rather  encodesand encrypts a shell script and generates C source code withthe added expiration capability. It  then  uses  the  systemcompiler  to compile a stripped binary which behaves exactlylike the  original  script.  Upon  execution,  the  compiledbinary  will  decrypt and execute the code with the shell -coption.  Unfortunatelly, it will  not  give  you  any  speedimprovement as a real C program would.shc's main purpose is to protect  your  shell  scripts  frommodification  or  inspection.  You can use it if you wish todistribute your scripts but don't want  them  to  be  easilyreadable by other people.

OPTIONS

     The command line options are:-e dateExpiration date in dd/mm/yyyy format [none]-m messagemessage to display  upon  expiration  ["Please  contactyour provider"]-f script_nameFile name of the script to compile-i inline_optionInline option for the shell interpreter i.e: -e-x comandeXec    command,    as    a    printf    format    i.e:exec(\\'%s\\',@ARGV);-l last_optionLast shell option i.e: ---r   Relax security. Make  a  redistributable  binary  whichexecutes  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

ENVIRONMENT VARIABLES

     CC   C compiler command [cc]CFLAGSC compiler flags [none]

EXAMPLES

     Compile a script which can be run on other systems with  thetrace option enabled:example% shc -v -r -T -f myscript

shc - Generic shell script compiler相关推荐

  1. 如何使用 SHC 加密 Shell 脚本

    如何在Linux环境中加密shell脚本?shell脚本包含密码,不希望其他具有执行权限的人查看shell脚本并获取密码.可以安装使用shc工具,普通用户无法读取shc创建的加密Shell脚本.SHC ...

  2. 「学习笔记-Linux」学习Shell Script

    学习Shell Script Table of Contents 1 什么是Shell Scipt 1.1 程序书写 1.2 程序执行 2 简单Shell练习 2.1 例1 接收用户输入 2.2 例2 ...

  3. linux 下 将 shell script 与 一个桌面图标联系在一起 (2)

    Cy163注: 步骤如下: (1)         建立 xxxxx.sh (2)         在 vnc 虚拟终端 的desktop上,右键,然后选择"创建启动器" (3)  ...

  4. Linux08--Shell程序设计03 shell script

    第一个Shell脚本--HelloWorld [root@localhost ~]# vi sh01.sh #!/bin/bash #!表明使用哪种shell # this is my first s ...

  5. 那些年我们一起追过的Shell Script

    原本这是自己在几个月前为公司的一个分享活动写的一个投影片,今天趁大脑负荷比较小,把这个话题拿到blog上面来分享一下.从知道shell算起至今也就几个年头而已,如今勉强算是入门了.对某一个新事物的掌握 ...

  6. Linux shell script 的语法汇总

    2019独角兽企业重金招聘Python工程师标准>>> 条件判断式 if判断式 if [ 条件判断式1 ]:then执行动作 elif [ 条件判断式2 ]:then执行动作 els ...

  7. linux-basic(13)学习shell script

    [13.1]什么是shell script? 1)shell script 是利用 shell 的功能所写的一个『程序 (program)』,这个程序是使用纯文字档,将一些 shell 的语法与命令( ...

  8. Shell Script 学习一

    Shell Script编写注意事项: 1.命令的执行是从上而下,从左至右地分析与执行. 2.命令执行中,命令与参数间的多个空白都会被忽略掉. 3.空白行也被将忽略掉,并且[tab]按键所得的空白同样 ...

  9. shell script if嵌套for循环脚本

    通过一个脚本介绍shell script编写的三个注意事项 文章目录 脚本内容 脚本关键点讲解 脚本内容 输出设备告警并将其清除 bash-4.3$ cat clear_alarm.sh #!/bin ...

最新文章

  1. 运行ORB-SLAM笔记_使用篇(二)
  2. 硬货 | 一文解读完五篇重磅ACL2017 NLP论文
  3. 在.Net 模板页中使用CSS样式
  4. jquery mobile 从一个html的page跳转到另一个html的page
  5. MySQL 8.0 在关系数据库方面有这些新特性
  6. Maven私服的配置和使用
  7. node.js学习之路(1)
  8. ref改变样式 vue_我用React和Vue构建了同款应用,对比看看(2020版)
  9. Android自定义控件7--自定义开关--绘制界面内容
  10. 作为技术人员,年会中尽量找熟人喝酒
  11. java基于springboot小区水电量电费管理系统
  12. 网页对话框:window.showModalDialog的基本用法
  13. C语言 结构体定义方法
  14. 同事篇(12年至今)
  15. 变量命名神器 CODELF
  16. math_泰勒多项式/Taylor级数常用麦克劳林级数
  17. 简单的图书管理系统(类的练习)
  18. 基于域集中式架构的汽车车载通信安全方案
  19. 创新实训(2)-Scrapy 学习
  20. 【虹科方案】新能源车测试-雷诺Kangoo电动汽车充电故障诊断

热门文章

  1. volatile限定符{C}
  2. boss直聘一句话介绍优势_95后职场前夜,BOSS直聘想跟够“敢”的你聊聊
  3. 控制器Controller
  4. +1学姐玩跳棋 (SG函数)
  5. 基于色度或其他彩色属性设计一个简单的肤色检测器
  6. selenium基础教程_弹性Selenium基础设施
  7. UI入门——血条制作
  8. 数字转换成k,w单位
  9. cookies、sessionStorage和localStorage以及vuex解释及区别
  10. 有没有大佬帮我解答一下归约证明的疑惑