In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article brings you how to use the MD5 value of the inux recording command. Most of the knowledge points are often used by everyone, so I will share them for you as a reference. Let's follow the editor and have a look.
1. Record the current command:
Sh CheckCommDDCW.sh
two。 Record new commands or modified commands (the keyword add can be replaced with any non-empty string):
Sh CheckCommDDCW.sh add
The code is as follows:
Git download: https://codeload.github.com/ddcw/shell/zip/master
#! / bin/env bash#write by ddcw# https://cloud.tencent.com/developer/column/6121#scriptname:CheckCommDDCW.shbegintime=`date +% s`file _ name=~/.UserCheckCom.txtnew_comm_n=0change_comm_n=0new_comm= "" change_comm= "[- f ${file_name}] | | touch ${file_name} for i in $(compgen-c) do if which $I > / dev/null 2 > & 1 then md5_n=$ (md5sum $(which $I) | awk '{print $1}') if cat ${file_name} | grep "\ # $I\ #" > / dev/null 2 > & 1 then # echo $(cat ${file_name} | grep "\ # $I\ #") md5_o=$ (cat ${file_name} | grep "\ # $I\ #" | tail-1 | awk'{print $NF}') if ["${md5_" N} "! =" ${md5_o} "] then # echo-e" COMMD [1 41 33m $I\ 033 [0m may be Changed: old_MD5: ${md5_o} new_MD5: ${md5_n} "[- z $1] | | echo-e" # ${I} #\ t $(date +% Y%m%d-%H:%M:%S)\ t ${md5_n} "> ${file_name} change_comm_n=$ [${change_comm_n}] + 1] change_comm= "${change_comm} ${I}" fi else if ["${I}"! ='['] then new_comm_n=$ [${new_comm_n} + 1] new_comm= "${new_comm} ${I}" # echo-e "\ 033 [32 40m$i\ 033 [0m "echo-e" # ${I} #\ t $(date +% Y%m%d-%H:%M:%S)\ t ${md5_n} "> ${file_name} fi doneecho"if [${new_comm_n}-gt 0] then echo-e"\ 033 [31 40m Total Add ${new_comm_n} commd\ 033 [0m "echo" ${new_comm} "else echo-e"\ 033 [32x 40m No Command Added, It's Seccurity!\ 033 [0m\ n "fiif [${change_comm_n}-gt 0] then echo-e"\ 033 [31ter40m Total Changed ${change_comm_n} commd\ 033 [0m "echo" ${change_comm} "else echo-e"\ 033 [32] 40m No Command Changed, It's Seccurity!\ 033 [0m "fiendtime= `date +% s`costm = `echo ${begintime} ${endtime} | awk'{print ($2liche 1) / 60} '`echo-e"\ n\ 033 [32th 40m `date +% Y%m%d-%H:%M:% S`cost ${costm} minutes\ 033 [0m "
The above is the use of the inux record command MD5 value, the code example is simple and straightforward, if you encounter this problem in your daily work. Through this article, I hope you can get something. For more details, please follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.