Shell Scripting Encryption

Source: Internet
Author: User

First, Background introduction

DBA Daily Update Insert|update More, delay a lot of time. The development of tools, although the user password in the script encryption and strict operation, but carefully query internal logic or may reveal the password, today, using Gzexe method to encrypt the shell script.

Second, start testing

1. Find a test script to execute. (The online script content is inconvenient to publish, write the test script yourself.) )

  

2. Encrypt operation [[email protected]] #gzexe automatic_update.sh automatic_update.sh:63.0%[[email protected]] #lsAutomatic_ update.sh  automatic_update.sh~  bak  conf  selectdbname.sh  sh_lib

  

3. Encrypted script content [[[email protected]] #cat automatic_update.sh#!/bin/shskip=44tab= "nl=" ifs= "$tab $nl" umask= ' umask '  Umask 77gztmpdir=trap ' res=$? Test-n "$gztmpdir" && rm-fr "$gztmpdir" (Exit $res); Exit $res ' 0 1 2 3 5 15if type mktemp >/dev/null 2>&1; Then gztmpdir= ' mktemp-dt ' else gztmpdir=/tmp/gztmp$$; mkdir $gztmpdirfi | | {(exit 127); Exit 127;} gztmp= $gztmpdir/$0case $ in-* | */* ') mkdir-p "$gztmp" && rm-r "$gztmp";; */*) gztmp= $gztmpdir/' basename ' $ "';; Esac | | {(exit 127); Exit 127;} Case ' echo X | Tail-n +1 2>/dev/null ' InX) tail_n=-n;; *) tail_n=;; ESACIF tail $tail _n + $skip < "$ A" | GZIP-CD > "$gztmp"; Then umask $umask chmod "$gztmp" (Sleep 5; rm-fr "$gztmpdir") 2>/dev/null & "$gztmp" ${1+ "[Email prot Ected] "}; Res=$?else echo >&2 "Cannot decompress" (Exit 127); Res=127fi;                                                                                                                   Exit $res                                       ~1±automatic_update.sh? [o~? Scremˉ?m? R? rz5r! q£^?)? §?? L?j#yz??? Fn??? %~?? -???? Μ#??? N?? 髜 {? n?? Su??? Q??????? Ij!? Uv?ǐ$?2¨?l?′d]>b?£6???? H±? G?? 19?+de "NCUWL0±MDZ±R-2A??? Principles??? |] <\?] &z#|-q%e-d with P05?? 毼 1:?<?????? °p t? 鱐 3?5x?? K4g-3?2w??? m={) 5? w?uaa?xp±v?r#1 [email protected]#???? Bargaining???? E? S?¤£e¨v3¤? G%=PD????? Gz:q¥ 誎?? T (??? >>?%?5lnq| E?? E?lz?? hjov¤t ao*r!) Pipelines. Qb?5 畒-z%! K1? T? r| _r!e????? n%\17a=1y xб v*;? 2? Kea?k¤52? K§*?? ??? %3% A (? §e5avoˉ|???? S415r2? o\?? T?=g dims Gl8?¢??? AO x?? zoc??| 7. ¥a??????? [M????? <???? ~? yfl\t¥>?????                                                                 2 @,?? ?? S (Yw????? I???? /y?o£?????  ?] >?| /??? Frt?? ˉt?? Hbvzh???? | Īoc (2 "; £ (M?? *??? T?? L0???????9?ˉb?????  dφ????? Y3?? Sessokyo chι?? O?

4. Do the content again, and confirm that the add parameter can be executed.

  

5. Decrypt gzexe-d automatic_update.sh Check to make sure the contents of the script are correct

  

6. Repeat the confirmation and find that it's all fine. #另外一种shell加密方式shc, self-study.

  

Shell Scripting Encryption

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.