Skip to content

Commit 9c47c05

Browse files
UPDATE Blacklist Generator - Introduce Fake GoogleBots Blocking
1 parent 231207d commit 9c47c05

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.dev-tools/generate-blacklists.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ input9=${TRAVIS_BUILD_DIR}/_generator_lists/nibbler-seo.list
6161
input10=${TRAVIS_BUILD_DIR}/_generator_lists/cloudflare-ip-ranges.list
6262
input11=${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list
6363
input12=${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents-fail2ban-additional.list
64+
input13=${TRAVIS_BUILD_DIR}/_generator_lists/fake-googlebots.list
6465

6566
# *******************************************************
6667
# Declare temporary database files used during generation
@@ -77,6 +78,7 @@ inputdb7=/tmp/bing-ip-ranges.db
7778
inputdb8=/tmp/wordpress-theme-detectors.db
7879
inputdb9=/tmp/nibbler-seo.db
7980
inputdb10=/tmp/cloudflare-ip-ranges.db
81+
inputdb13=/tmp/fake-googlebots.db
8082

8183

8284
# ******************************************
@@ -99,6 +101,7 @@ tmpapache7=tmpapache7
99101
tmpapache8=tmpapache8
100102
tmpapache9=tmpapache9
101103
tmpapache10=tmpapache10
104+
tmpapache13=tmpapache13
102105

103106
# ***********************************************
104107
# Sort lists alphabetically and remove duplicates
@@ -115,6 +118,7 @@ sort -u ${input8} -o ${input8}
115118
sort -u ${input9} -o ${input9}
116119
sort -u ${input10} -o ${input10}
117120
sort -u ${input12} -o ${input12}
121+
sort -u ${input13} -o ${input13}
118122

119123
# ***************************************************************
120124
# Start and End Strings to Search for to do inserts into template
@@ -140,6 +144,8 @@ start9="# START NIBBLER ### DO NOT EDIT THIS LINE AT ALL ###"
140144
end9="# END NIBBLER ### DO NOT EDIT THIS LINE AT ALL ###"
141145
start10="# START CLOUDFLARE IP RANGES ### DO NOT EDIT THIS LINE AT ALL ###"
142146
end10="# END CLOUDFLARE IP RANGES ### DO NOT EDIT THIS LINE AT ALL ###"
147+
start13="# START FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###"
148+
end13="# END FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###"
143149
startmarker="### Version Information #"
144150
endmarker="### Version Information ##"
145151

@@ -426,6 +432,32 @@ q
426432
IN
427433
rm ${inputdb10}
428434

435+
436+
# ***********************************
437+
# FAKE GOOGLEBOTS - Create and Insert
438+
# ***********************************
439+
440+
printf '%s\n' "${start13}" >> ${tmpapache13}
441+
while IFS= read -r LINE
442+
do
443+
printf '%s%s\n' "Deny from " "${LINE}" >> ${tmpapache13}
444+
done < ${input13}
445+
printf '%s\n' "${end13}" >> ${tmpapache13}
446+
mv ${tmpapache13} ${inputdb13}
447+
ed -s ${inputdb13}<<\IN
448+
1,/# START FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/d
449+
/# END FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/,$d
450+
,d
451+
.r /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/.dev-tools/apache2.2.template
452+
/# START FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/x
453+
.t.
454+
.,/# END FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/-d
455+
w /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/.dev-tools/apache2.2.template
456+
q
457+
IN
458+
rm ${inputdb13}
459+
460+
429461
# Copy files to correct folders
430462
# **********************************************
431463
sudo cp ${apache} /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/Apache_2.2/custom.d/globalblacklist.conf
@@ -705,6 +737,32 @@ q
705737
IN
706738
rm ${inputdb10}
707739

740+
# ***********************************
741+
# FAKE GOOGLEBOTS - Create and Insert
742+
# ***********************************
743+
744+
printf '%s\n' "${start13}" >> ${tmpapache13}
745+
while IFS= read -r LINE
746+
do
747+
printf '\t%s%s\n' "Require not ip " "${LINE}" >> ${tmpapache13}
748+
done < ${input13}
749+
printf '%s\n' "${end13}" >> ${tmpapache13}
750+
mv ${tmpapache13} ${inputdb13}
751+
ed -s ${inputdb13}<<\IN
752+
1,/# START FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/d
753+
/# END FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/,$d
754+
,d
755+
.r /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/.dev-tools/apache2.4.template
756+
/# START FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/x
757+
.t.
758+
.,/# END FAKE GOOGLEBOTS ### DO NOT EDIT THIS LINE AT ALL ###/-d
759+
w /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/.dev-tools/apache2.4.template
760+
q
761+
IN
762+
rm ${inputdb13}
763+
764+
765+
708766
# Copy file to correct folder
709767
# **********************************************
710768
sudo cp ${apache2} /home/travis/build/mitchellkrogza/apache-ultimate-bad-bot-blocker/Apache_2.4/custom.d/globalblacklist.conf

0 commit comments

Comments
 (0)