Created
January 19, 2012 12:50
-
-
Save brokendish/1639929 to your computer and use it in GitHub Desktop.
denyhosts Unlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#--------------------------- | |
#denyhosts Unlock | |
# | |
# perm1:IP-Address | |
# | |
# Brokendish | |
#--------------------------- | |
# | |
echo '***************************************************' | |
echo '** denyhosts Unlock **' | |
echo '***************************************************' | |
#入力パラメータチェック1 | |
if [ -z "$1" ] | |
then | |
echo "引数にIPアドレスを指定して!" | |
echo "ex) " $0 " IPアドレス" | |
exit | |
fi | |
#入力パラータがIPアドレスであること | |
if [ -z "`echo $1 |sed -e "/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$/g"`" ] | |
then | |
#IPなので処理するよ!! | |
for i in /etc/hosts.deny /var/lib/denyhosts/* | |
do | |
echo "--------------------------------------------------" | |
echo "SelectFile-----:"$i | |
echo "deleteLine------------:"$1 | |
sed -i -e "/$1/d" $i | |
echo "--------------------------------------------------" | |
cat $i | |
done | |
else | |
echo "IPアドレスじゃねーし!!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment