SUCCESS - You are likely no bot, you may pass!
This is an example usage of the
"botsec.php" script. It'll redirect you to
https://www.google.com/ if the user-agent of the request is in the array defined in the file called
"botsec.def.php" or defined in the url / file
"https://botsec.kimhauser.ch/bots2ignore.txt" - depends on your setting in the
config.php file - and so one of the following strings:
- empty user agent string
- *
- bot\*
- bot\\*
- feed
- Go-http-client
- Unknown robot identified by bot\*
- Unknown robot identified by bot\\*
- AhrefsBot
- DotBot
- empty user agent string
- MJ12bot
- Barkrowler
- bingbot
- nbot
- Go-http-client
- SemrushBot
- facebookexternalhit
- robot
- Yandex ( catchall )
- link
- CCBot
- crawl
- YandexBot
- zoominfobot
- Baidu ( catchall )
- Curl
- Apache-HttpClient
- SeznamBot
- spider
- YisouSpider
- YandexImages
- 360Spider
- Baiduspider
- Mail.RU Bot
- MojeekBot
- Dalvik
- 2345Explorer
- SurdotlyBot
- trendiction
- survey
- CFNetwork
- Unknown robot identified by \*bot
- yacybot
- Screaming Frog SEO Spider
- Wget
- Seobility
- libwww-perl
- Validator.nu
- BLEXBot
- yak-linkfluence
- blog
Testing the script
You can test the botsec.php script with your own User-Agents like so:
Setup the BotSec script:
- Copy the files to a directory of your choice
- Amend the config.php file and:
- Set whether to load agents2ignore from URL or botsec.def.php
- Amend the botsec.def.php or the https://botsec.kimhauser.ch/bots2ignore.txt with you own agents
- Set the URL to redirect request from ignored user agents to
- Include botsec.php in your index.php or other startup PHP-scripts that will be loaded for the requests in question
Start Test-Server locally:
- Goto the directory containing the files in a terminal
- Execute "php -S 127.0.0.1:8888" in the terminal
- Open the address "127.0.0.1:8888" with your Webbrowser of choice
- Now you should see the success message
- With Google Chrome you can amend the User-Agent for the Request like so
- Open the developer console of Google Chrome with CMD+Option+J (macOS)
- In the developer console click the three dots in the upper right corner
- Click on "More Tools" > "Network Conditions"
- In the bottom panel you should see the User-Agent and you can change it to a custom agent
Github repo of "botsec.php" script
Version history of BotSec
- 0.0.1 - 2024-07-29
Initial version with user-agents for personal usage
- 0.0.2 - 2024-08-03
Exracted user-agent array from "botsec.php" into "botsec.def.php" file for easier Update. Extended demo index.php script (Styling / Layout, Github-Link, Version history)
- 0.0.3 - 2024-08-05
Added ability to load user-agents from URL / file like "https://botsec.kimhauser.ch/bots2ignore.txt" for easier Update.