From 50ec9ca29b4e9c4d692ccc1d9038f10b7cf72aa0 Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Mon, 10 Jul 2017 10:41:15 +0200 Subject: [PATCH] Referrers (+) - Some syntax fixes in scripts --- _generator_lists/bad-referrers.list | 14 +++++++++ travisCI/generate-blacklist.sh | 40 +++++++++++++------------- travisCI/generate-robots.sh | 4 +-- travisCI/modify-config-readme-files.sh | 6 ++-- travisCI/run-curl-tests.sh | 31 +++++++++++++++++++- 5 files changed, 69 insertions(+), 26 deletions(-) diff --git a/_generator_lists/bad-referrers.list b/_generator_lists/bad-referrers.list index 36cd21ddf..38302152a 100755 --- a/_generator_lists/bad-referrers.list +++ b/_generator_lists/bad-referrers.list @@ -1,3 +1,17 @@ +brainboosting.club +video-chat.love +video-chat.in +i-hobot.ru +yellowstonesafaritours.com +download-wallpaper.net +profit-opportunity.com +duplicashapp.com +freegamesplay.online +sardinie.us +advertex.info +suggest-keywords.com +omoikiri-japan.ru +demian.kz 000free.us 007angels.com 00author.com diff --git a/travisCI/generate-blacklist.sh b/travisCI/generate-blacklist.sh index f2295b1b9..da75a4e21 100755 --- a/travisCI/generate-blacklist.sh +++ b/travisCI/generate-blacklist.sh @@ -145,12 +145,12 @@ _action4="3;" # GOOD USER AGENTS - Create and Insert # ************************************ -printf '%s\n' "$_start1" >> $_tmpnginx1 +printf '%s\n' "$_start1" >> "$_tmpnginx1" while IFS= read -r LINE do printf '\t"~*%s"\t\t%s\n' "${LINE}" "$_action1" >> "$_tmpnginx1" done < $_input1 -printf '%s\n' "$_end1" >> $_tmpnginx1 +printf '%s\n' "$_end1" >> "$_tmpnginx1" mv $_tmpnginx1 $_inputdb1 ed -s $_inputdb1<<\IN 1,/# START GOOD BOTS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -171,12 +171,12 @@ rm $_inputdb1 # ALLOWED BOTS - Create and Insert # ******************************** -printf '%s\n' "$_start2" >> $_tmpnginx2 +printf '%s\n' "$_start2" >> "$_tmpnginx2" while IFS= read -r LINE do printf '\t"~*%s"\t\t%s\n' "${LINE}" "$_action2" >> "$_tmpnginx2" done < $_input2 -printf '%s\n' "$_end2" >> $_tmpnginx2 +printf '%s\n' "$_end2" >> "$_tmpnginx2" mv $_tmpnginx2 $_inputdb2 ed -s $_inputdb2<<\IN 1,/# START ALLOWED BOTS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -195,12 +195,12 @@ rm $_inputdb2 # LIMITED BOTS - Create and Insert # ******************************** -printf '%s\n' "$_start3" >> $_tmpnginx3 +printf '%s\n' "$_start3" >> "$_tmpnginx3" while IFS= read -r LINE do printf '\t"~*%s"\t\t%s\n' "${LINE}" "$_action3" >> "$_tmpnginx3" done < $_input3 -printf '%s\n' "$_end3" >> $_tmpnginx3 +printf '%s\n' "$_end3" >> "$_tmpnginx3" mv $_tmpnginx3 $_inputdb3 ed -s $_inputdb3<<\IN 1,/# START LIMITED BOTS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -219,12 +219,12 @@ rm $_inputdb3 # BAD BOTS - Create and Insert # **************************** -printf '%s\n' "$_start4" >> $_tmpnginx4 +printf '%s\n' "$_start4" >> "$_tmpnginx4" while IFS= read -r LINE do printf '\t"~*%s"\t\t%s\n' "${LINE}" "$_action4" >> "$_tmpnginx4" done < $_input4 -printf '%s\n' "$_end4" >> $_tmpnginx4 +printf '%s\n' "$_end4" >> "$_tmpnginx4" mv $_tmpnginx4 $_inputdb4 ed -s $_inputdb4<<\IN 1,/# START BAD BOTS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -243,12 +243,12 @@ rm $_inputdb4 # BAD REFERERS - Create and Insert # ******************************** -printf '%s\n' "$_start5" >> $_tmpnginx5 +printf '%s\n' "$_start5" >> "$_tmpnginx5" while IFS= read -r LINE do printf '\t"~*%s"\t\t%s\n' "${LINE}" "$_action2" >> "$_tmpnginx5" done < $_input5 -printf '%s\n' "$_end5" >> $_tmpnginx5 +printf '%s\n' "$_end5" >> "$_tmpnginx5" mv $_tmpnginx5 $_inputdb5 ed -s $_inputdb5<<\IN 1,/# START BAD REFERRERS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -267,12 +267,12 @@ rm $_inputdb5 # GOOGLE IP RANGES - Create and Insert # ************************************ -printf '%s\n' "$_start6" >> $_tmpnginx6 +printf '%s\n' "$_start6" >> "$_tmpnginx6" while IFS= read -r LINE do printf '\t%s\t\t%s\n' "${LINE}" "$_action1" >> "$_tmpnginx6" done < $_input6 -printf '%s\n' "$_end6" >> $_tmpnginx6 +printf '%s\n' "$_end6" >> "$_tmpnginx6" mv $_tmpnginx6 $_inputdb6 ed -s $_inputdb6<<\IN 1,/# START GOOGLE IP RANGES ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -291,12 +291,12 @@ rm $_inputdb6 # BING IP RANGES - Create and Insert # ********************************** -printf '%s\n' "$_start7" >> $_tmpnginx7 +printf '%s\n' "$_start7" >> "$_tmpnginx7" while IFS= read -r LINE do printf '\t%s\t\t%s\n' "${LINE}" "$_action1" >> "$_tmpnginx7" done < $_input7 -printf '%s\n' "$_end7" >> $_tmpnginx7 +printf '%s\n' "$_end7" >> "$_tmpnginx7" mv $_tmpnginx7 $_inputdb7 ed -s $_inputdb7<<\IN 1,/# START BING IP RANGES ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -315,12 +315,12 @@ rm $_inputdb7 # Wordpress Theme Detectors - Create and Insert # ********************************************* -printf '%s\n' "$_start8" >> $_tmpnginx8 +printf '%s\n' "$_start8" >> "$_tmpnginx8" while IFS= read -r LINE do printf '%s\n' "${LINE}" >> "$_tmpnginx8" done < $_input8 -printf '%s\n' "$_end8" >> $_tmpnginx8 +printf '%s\n' "$_end8" >> "$_tmpnginx8" mv $_tmpnginx8 $_inputdb8 ed -s $_inputdb8<<\IN 1,/# START WP THEME DETECTORS ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -339,12 +339,12 @@ rm $_inputdb8 # Nibbler SEO - Create and Insert # ******************************* -printf '%s\n' "$_start9" >> $_tmpnginx9 +printf '%s\n' "$_start9" >> "$_tmpnginx9" while IFS= read -r LINE do printf '\t%s\t\t%s\n' "${LINE}" "$_action2" >> "$_tmpnginx9" done < $_input9 -printf '%s\n' "$_end9" >> $_tmpnginx9 +printf '%s\n' "$_end9" >> "$_tmpnginx9" mv $_tmpnginx9 $_inputdb9 ed -s $_inputdb9<<\IN 1,/# START NIBBLER ### DO NOT EDIT THIS LINE AT ALL ###/d @@ -363,12 +363,12 @@ rm $_inputdb9 # CLOUDFLARE IP RANGES - Create and Insert # **************************************** -printf '%s\n' "$_start10" >> $_tmpnginx10 +printf '%s\n' "$_start10" >> "$_tmpnginx10" while IFS= read -r LINE do printf '\t%s\t\t%s\n' "${LINE}" "$_action1" >> "$_tmpnginx10" done < $_input10 -printf '%s\n' "$_end10" >> $_tmpnginx10 +printf '%s\n' "$_end10" >> "$_tmpnginx10" mv $_tmpnginx10 $_inputdb10 ed -s $_inputdb10<<\IN 1,/# START CLOUDFLARE IP RANGES ### DO NOT EDIT THIS LINE AT ALL ###/d diff --git a/travisCI/generate-robots.sh b/travisCI/generate-robots.sh index 584fda0d4..e9b3a4a73 100755 --- a/travisCI/generate-robots.sh +++ b/travisCI/generate-robots.sh @@ -62,9 +62,9 @@ _endmarker="### Version Information ##" printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s\n\n%s\n%s\n%s\n' "$_startmarker" "###################################################" "### Version: " "$MY_GIT_TAG" "### Updated: " "$_now" "### Bad Bot Count: " "$BAD_BOTS" "###################################################" "$_endmarker" "User-agent: *" "Disallow: /wp-admin/" "Allow: /wp-admin/admin-ajax.php" >> "$_tmprobots" while IFS= read -r LINE do -printf 'User-agent: %s\n%s\n' "${LINE}" "Disallow:/" >> $_tmprobots +printf 'User-agent: %s\n%s\n' "${LINE}" "Disallow:/" >> "$_tmprobots" done < $_input1 -printf '\n' >> $_tmprobots +printf '\n' >> "$_tmprobots" sudo cp $_tmprobots $TRAVIS_BUILD_DIR/robots.txt/robots.txt exit 0 diff --git a/travisCI/modify-config-readme-files.sh b/travisCI/modify-config-readme-files.sh index 1f13a29f8..7b96d93de 100755 --- a/travisCI/modify-config-readme-files.sh +++ b/travisCI/modify-config-readme-files.sh @@ -55,7 +55,7 @@ _endmarker="### Version Information ##" # PRINT VERSION INFORMATION INTO README.md # **************************************** -printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> $_tmpnginxA +printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> "$_tmpnginxA" mv $_tmpnginxA $_inputdbA ed -s $_inputdbA<<\IN 1,/### Version Information #/d @@ -76,7 +76,7 @@ rm $_inputdbA # PRINT VERSION INFORMATION INTO AUTO-CONFIGURATION.md # **************************************************** -printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> $_tmpnginxA +printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> "$_tmpnginxA" mv $_tmpnginxA $_inputdbA ed -s $_inputdbA<<\IN 1,/### Version Information #/d @@ -97,7 +97,7 @@ rm $_inputdbA # PRINT VERSION INFORMATION INTO MANUAL-CONFIGURATION.md # ****************************************************** -printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> $_tmpnginxA +printf '%s\n%s\n%s%s\n%s%s\n%s%s\n%s\n%s' "$_startmarker" "********************************************" "#### Version: " "$MY_GIT_TAG" "#### Bad Referrer Count: " "$BAD_REFERRERS" "#### Bad Bot Count: " "$BAD_BOTS" "********************************************" "$_endmarker" >> "$_tmpnginxA" mv $_tmpnginxA $_inputdbA ed -s $_inputdbA<<\IN 1,/### Version Information #/d diff --git a/travisCI/run-curl-tests.sh b/travisCI/run-curl-tests.sh index c377cfb7d..d15660848 100755 --- a/travisCI/run-curl-tests.sh +++ b/travisCI/run-curl-tests.sh @@ -1,7 +1,12 @@ #!/bin/bash # Curl Testing Script for Nginx Ultimate Bad Bot Blocker +# Created by: Mitchell Krog (mitchellkrog@gmail.com) +# Copyright: Mitchell Krog - https://github.com/mitchellkrogza +# Repo Url: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker +# ******************************************* # Set Location of our Curl Test Results Files +# ******************************************* _curltest1=$TRAVIS_BUILD_DIR/travisCI/_curl_tests/curltest1.txt _curltest2=$TRAVIS_BUILD_DIR/travisCI/_curl_tests/curltest2.txt @@ -11,7 +16,10 @@ _curltest5=$TRAVIS_BUILD_DIR/travisCI/_curl_tests/curltest5.txt _curltest6=$TRAVIS_BUILD_DIR/travisCI/_curl_tests/curltest6.txt +# ************************************************* # Function Curl Test 1 - Check for Bad Bot "80legs" +# ************************************************* + run_curltest1 () { truncate -s 0 $_curltest1 curl -A "80legs" http://localhost:9000/index.php 2> $_curltest1 @@ -23,7 +31,10 @@ else fi } +# ************************************************** # Function Curl Test 2 - Check for Bad Bot "masscan" +# ************************************************** + run_curltest2 () { truncate -s 0 $_curltest2 curl -A "masscan" http://localhost:9000/index.php 2> $_curltest2 @@ -35,7 +46,10 @@ else fi } +# ****************************************************************** # Function Curl Test 3 - Check for Bad Referrer "100dollars-seo.com" +# ****************************************************************** + run_curltest3 () { truncate -s 0 $_curltest3 curl -I http://localhost:9000/index.php -e http://100dollars-seo.com 2> $_curltest3 @@ -47,7 +61,10 @@ else fi } +# ****************************************************** # Function Curl Test 4 - Check for Bad Referrer "zx6.ru" +# ****************************************************** + run_curltest4 () { truncate -s 0 $_curltest4 curl -I http://localhost:9000/index.php -e http://zx6.ru 2> $_curltest4 @@ -59,7 +76,10 @@ else fi } +# ***************************************************** # Function Curl Test 5 - Check for Good Bot "GoogleBot" +# ***************************************************** + run_curltest5 () { truncate -s 0 $_curltest5 curl -v -A "GoogleBot" http://localhost:9000/index.php 2>&1 >> $_curltest5 @@ -71,7 +91,10 @@ else fi } +# *************************************************** # Function Curl Test 6 - Check for Good Bot "BingBot" +# *************************************************** + run_curltest6 () { truncate -s 0 $_curltest6 curl -v -A "BingBot" http://localhost:9000/index.php 2>&1 >> $_curltest6 @@ -84,7 +107,10 @@ fi } -# Trigger our functions to run +# ********************************* +# Trigger our curl functions to run +# ********************************* + run_curltest1 run_curltest2 run_curltest3 @@ -92,6 +118,9 @@ run_curltest4 run_curltest5 run_curltest6 +# **************************************** # If everything passed then we exit with 0 +# **************************************** + exit 0