replace blacklist with blacklistFile

This commit is contained in:
tuplink 2016-10-20 13:50:13 -04:00
parent ab24e61754
commit a79da9a0ff

View file

@ -50,8 +50,8 @@ HandleOther(){
PopBlacklistFile(){
#check blacklist file exists, and if not, create it
if [[ ! -f ${blacklist} ]];then
touch ${blacklist}
if [[ ! -f ${blacklistFile} ]];then
touch ${blacklistFile}
fi
for dom in "${domList[@]}"; do
if "$addmode"; then
@ -65,13 +65,13 @@ PopBlacklistFile(){
AddDomain(){
#| sed 's/\./\\./g'
bool=false
grep -Ex -q "$1" ${blacklist} || bool=true
grep -Ex -q "$1" ${blacklistFile} || bool=true
if ${bool}; then
#domain not found in the blacklist file, add it!
if ${verbose}; then
echo -n "::: Adding $1 to blacklist file..."
fi
echo "$1" >> ${blacklist}
echo "$1" >> ${blacklistFile}
echo " done!"
else
if ${verbose}; then
@ -83,7 +83,7 @@ AddDomain(){
RemoveDomain(){
bool=false
grep -Ex -q "$1" ${blacklist} || bool=true
grep -Ex -q "$1" ${blacklistFile} || bool=true
if ${bool}; then
#Domain is not in the blacklist file, no need to Remove
if ${verbose}; then
@ -94,7 +94,7 @@ RemoveDomain(){
if ${verbose}; then
echo "::: Un-blacklisting $dom..."
fi
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${blacklist}
echo "$1" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' ${blacklistFile}
fi
}