Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F13810069
findBots.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
510 B
Subscribers
None
findBots.sh
View Options
#!/bin/bash
#
# Generates a Go map containing all bots that have accessed Write.as
#
cat /var/log/
$1
|
grep -i
'bot\|crawler\|voltron'
|
awk -F
\"
'{print $4}'
|
sort
|
uniq > bots.txt
rm bots.go
cat > bots.go
<< EOM
package bots
var bots = map[string]bool {
EOM
while
read
b
;
do
if
[
-n
"
$b
"
]
;
then
echo
" \"
$b
\": true,"
>> bots.go
fi
done
<bots.txt
cat >> bots.go
<< EOM
};
func IsBot(ua string) bool {
if _, ok := bots[ua]; ok {
return true
}
return false
}
EOM
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Wed, Feb 11, 7:47 PM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3624018
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment