mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-10 23:34:41 +00:00
Introduce Random Bot Testing in Builds
This commit is contained in:
parent
3448d02162
commit
78e7c1098a
5 changed files with 132 additions and 8 deletions
|
@ -257,14 +257,23 @@ fi
|
|||
}
|
||||
run_curltest15
|
||||
|
||||
#IFS=$'\n' read -d '' -r -a lines < ${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list
|
||||
#echo "${lines[@]}"
|
||||
#IFS=$'\n'
|
||||
#file=${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list
|
||||
#lines=`cat $file`
|
||||
#for line in $lines; do
|
||||
# curl -v -A "$line" http://localhost:9000 2>&1
|
||||
#done
|
||||
#Test 50 Random User-Agents from Bad-User-Agents
|
||||
shuf -n 50 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test.tmp
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test.tmp > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test.list
|
||||
sudo rm ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test.tmp
|
||||
|
||||
echo "Testing 50 Random Bots"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
for line in ${lines}; do
|
||||
if
|
||||
curl -v -A "${line}" http://localhost:9000 2>&1 | grep -i '(52)'; then
|
||||
echo "$(tput setaf 1)BAD BOT DETECTED - $(tput setaf 2)TEST PASSED"
|
||||
else
|
||||
echo "$(tput setaf 1)BAD REFERRER NOT DETECTED - TEST FAILED"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo "Tests Completed"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue