当前位置: > shell编程 >

shell脚本修复bash漏洞

时间:2014-12-12 01:35来源:linux.it.net.cn 作者:IT
在网上搜资料找到一个大神写的shell修复bash漏洞脚本,觉得很不错,拖到我blog里来共享给大家.
脚本内容:

01 #/bin/bash
02  
03 #Author Alex Fang. Updates may apply soon.
04  
05 clear
06  
07 echo "Press anykey to continue..." $anykey ; read anykey
08 echo "BBBBBBBBBBBAAAAAAAAAAAAAAAAAAAASSSSSSSSSSSSSSSSSSHHHHHHHHHHHHHHHHHHHH!"
09 echo "ShellShockFixer v0.1 by Alex Fang. Liscence: GNU GPLv2"
10 echo "######################################################"
11 echo "Select on option:"
12 echo "1) CentOS"
13 echo "2) Debian Wheezy"
14 echo "3) Debian Squeeze x64(Provided by Aliyun)"
15 echo "4) Debian Squeeze x32(Provided by Aliyun)"
16 echo "5) Ubuntu"
17 echo "6) OpenSuSE x64(Beta, provided by Aliyun)"
18 echo "7) OpenSuSE x32(Beta Aliyun)"
19 echo "8) Aliyun Linux x64"
20 echo "9) Aliyun Linux x32"
21 echo "0) iptables way"
22 echo "11) Temporily disable bash through chmod"
23 echo "######################################################"
24 read x
25 if test $x -eq 1; then
26     clear
27     echo "Fixing......"
28     yum clean all
29     yum makecache
30     yum update bash
31     echo "Finished!"
32      
33 elif test $x -eq 2; then
34   clear
35   echo "Fixing for Debian Wheezy..."
36   apt-get update
37   apt-get -y install --only-upgrade bash
38   echo "Finished!"
39  
40 elif test $x -eq 3; then
41   echo "Fixing for Debian Squeeze x64..."
42   wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_amd64.deb &&  dpkg -i bash_4.1-3+deb6u2_amd64.deb  
43   echo "Finished!"
44    
45 elif test $x -eq 4; then
46   echo "Fixing for Debian Squeeze x32..."
47   wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_i386.deb &&  dpkg -i bash_4.1-3+deb6u2_i386.deb 
48   echo "Finished!"
49    
50 elif test $x -eq 5; then
51   echo "Fixing for Ubuntu..."
52   apt-get update
53   apt-get -y install --only-upgrade bash
54   echo "Finished!"
55    
56 elif test $x -eq 6; then
57   echo "Fixing for OpenSuSE x64"
58   wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.x86_64.rpm && rpm -Uvh bash-4.2-68.4.1.x86_64.rpm 
59   echo "Finished!"
60    
61 elif test $x -eq 7; then
62   echo "Fixing for OpenSuSE x32"
63   wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.i586.rpm && rpm -Uvh bash-4.2-68.4.1.i586.rpm 
64  echo "Finished!"
65   
66 elif test $x -eq 8; then
67   echo "Fixing for Aliyun Linux x64..."
68   wget http://mirrors.aliyun.com/centos/5/updates/x86_64/RPMS/bash-3.2-33.el5_10.4.x86_64.rpm && rpm -Uvh bash-3.2-33.el5_10.4.x86_64.rpm  
69   echo "Finished!"
70  
71 elif test $x -eq 9; then
72   echo "Fixing for Aliyun Linux x32..."
73   wget http://mirrors.aliyun.com/centos/5/updates/i386/RPMS/bash-3.2-33.el5_10.4.i386.rpm  && rpm -Uvh bash-3.2-33.el5_10.4.i386.rpm  
74  
75 elif test $x -eq 0; then
76   echo "Deploying iptables rules..."
77   iptables --append INPUT -m string --algo kmp --hex-string '|28 29 20 7B|' --jump DROP
78   iptables using -m string --hex-string '|28 29 20 7B|'
79   echo "Finishing..."
80    
81 elif test $x -eq 11; then
82   echo "Chmod way configuring..."
83   chmod o-x bash
84   echo "Finishing..."
85  
86 else
87   echo "Invalid Operation."
88   exit
89 fi
(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容