Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
denyhosts Unlock
#!/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
You can’t perform that action at this time.