in reply to Bot vs human User Agent strings
Alternation?
#!/usr/bin/perl -w use strict; my @bad = (); my ($f, $fh, $baddies, $sql, $badregex) = ('./badactors.txt',undef, un +def, '', undef); open($fh, '<', $f) or die $!; while(<$fh>){ chomp; next if m/^$/; push @bad, $_; } close($f); $baddies = join qq{\|},@bad; $badregex = qr~$baddies~; # easy test my $junk = 'doodle bot'; if ($junk=~m/$badregex/) { print qq~\nSee....?\n~; } 1; __DATA__ $dbh->do("INSERT INTO Site_Visit SET firstVisit = NOW(), lastPage = ?, + firstPage = ?, IP = ?, userAgent = ?, orsa = ?, orta = ?, Person_idP +erson = ?", undef, $ENV{'REQUEST_URI'}, $ENV{'REQUEST_URI'}, $ENV{'REMOTE_ADDR'}, $E +NV{'HTTP_USER_AGENT'}, $cookie{'orsa'}, $data{'orta'}, $user) unless $ENV{'HTTP_USER_AGENT'} =~ /bot/i or $ENV{'HTTP_USER_AGENT' +} =~ /facebook/i or $ENV{'HTTP_USER_AGENT'} =~ /dataprovider/i; <code>
Celebrate Intellectual Diversity
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bot vs human User Agent strings
by Bod (Parson) on Feb 10, 2024 at 22:09 UTC | |
by hippo (Archbishop) on Feb 11, 2024 at 00:02 UTC |