-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirewall.php
More file actions
1690 lines (1447 loc) · 29.6 KB
/
firewall.php
File metadata and controls
1690 lines (1447 loc) · 29.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Firewall is a companion project intended to function as a barrier to
* abusive requests and malicious bots.
*
* Firewall runs before any other application code and it requries only
* a single write-enabled directory to function.
*
* Set the SKIP_LOCAL constant to be defined in your code to prevent
* this file from being called on its own. Firewall will keep track of
* your traffic in the firewall.db file set below.
*
* A lot of this was inspired by the Bad Behavior package but does not
* use the same code.
*
* @link http://bad-behavior.ioerror.us
*/
// Your custom denied message
define( 'KILL_MSG', <<<HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Denied</title>
</head>
<body>
<p>Access to this resource is restricted</p>
</body>
</html>
HTML
);
// Location of your database file (based on relative path)
// This will be where Firewall creates a SQLite database
// Make sure to create the /data folder, if you're logging, and set permissions to 0755 on *nix
define( 'FIREWALL_DB',
\realpath( \dirname( __FILE__ ) ) . '/data/firewall.db' );
// Use this instead if your code is outside the web root directory
// define( 'FIREWALL_DB',
// \realpath( \dirname( __FILE__, 2 ) ) . '/data/firewall.db' );
// Firewall search engines based on IP address
// (this may block legitimate traffic)
define( 'FIREWALL_IP_BOTS', 0 );
// Whitelist of HTTP methods (these fall through to be handled by your script)
define( 'FIREWALL_METHODS',
'get, post, head, connect, options, patch, delete, put' );
// Enable/Disable firewall database logging (defaults to not logging)
define( 'FIREWALL_DB_LOG', 0 );
// Maximum header size
define( 'FIREWALL_MAX_HEADER', 512 );
// Enable in depth header checking
define( 'FIREWALL_HEADER_CHECK', 1 );
// Enable browser UA checking
define( 'FIREWALL_UA_CHECK', 1 );
/**********************
* Configuration end
**********************/
if ( !defined( 'DATA_TIMEOUT' ) ) {
define( 'DATA_TIMEOUT', 10 );
}
if ( !defined( 'SKIP_LOCAL' ) ) {
fw_instaKill();
}
// Each command is separated by a -- -- string
define( 'FIREWALL_DB_PREP', <<<SQL
CREATE TABLE firewall (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
reason TEXT NOT NULL,
ip TEXT NOT NULL,
ua TEXT NOT NULL,
uri TEXT NOT NULL,
method TEXT NOT NULL,
headers TEXT NOT NULL,
expires DATETIME DEFAULT NULL,
updated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);-- --
CREATE INDEX idx_firewall_on_reason ON firewall ( reason );-- --
CREATE INDEX idx_firewall_on_ip ON firewall ( ip ASC );-- --
CREATE INDEX idx_firewall_on_ua ON firewall ( ua ASC );-- --
CREATE INDEX idx_firewall_on_uri ON firewall ( uri ASC );-- --
CREATE INDEX idx_firewall_on_method ON firewall ( method ASC );-- --
CREATE INDEX idx_firewall_on_expires ON firewall ( expires DESC );-- --
CREATE INDEX idx_firewall_on_created ON firewall ( created ASC );-- --
CREATE TRIGGER firewall_exp_insert AFTER INSERT ON firewall FOR EACH ROW
WHEN NEW.expires IS NULL
BEGIN
UPDATE firewall SET
expires = datetime(
( strftime( '%s','now' ) + 604800 ),
'unixepoch'
) WHERE rowid = NEW.rowid;
END;-- --
CREATE TRIGGER firewall_insert AFTER INSERT ON firewall FOR EACH ROW
BEGIN
DELETE FROM firewall WHERE
strftime( '%s', expires ) <
strftime( '%s', updated );
END;
SQL
);
define( 'FIREWALL_DB_INSERT', <<<SQL
INSERT INTO firewall ( reason, ip, ua, uri, method, headers )
VALUES ( :reason, :ip, :ua, :uri, :method, :headers );
SQL
);
function fw_getDb( bool $close = false ) {
static $db;
if ( isset( $db ) ) {
if ( $close ) {
$db = null;
return;
}
return $db;
}
try {
// Connection options
$opts = [
\PDO::ATTR_TIMEOUT => \DATA_TIMEOUT,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
\PDO::ATTR_PERSISTENT => false,
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_ERRMODE =>
\PDO::ERRMODE_EXCEPTION
];
$first_run = false;
if ( !\file_exists( \FIREWALL_DB ) ) {
$first_run = true;
}
$db =
new \PDO( 'sqlite:' . \FIREWALL_DB, null, null, $opts );
// New database? Create tables and presets
if ( $first_run ) {
$db->exec( 'PRAGMA encoding = "UTF-8";' );
$db->exec( 'PRAGMA page_size = "16384";' );
$db->exec( 'PRAGMA auto_vacuum = "2";' );
$db->exec( 'PRAGMA temp_store = "2";' );
$db->exec( 'PRAGMA secure_delete = "1"' );
// Run create
$sql = \explode( '-- --', \FIREWALL_DB_PREP );
foreach( $sql as $q ) {
if ( empty( trim( $q ) ) ) {
continue;
}
$db->exec( $q );
}
}
$db->exec( 'PRAGMA journal_mode = WAL;' );
return $db;
} catch ( \PDOException $e ) {
die( 'Error creating firewall database. Check if you have write permissions to the data folder' );
}
return $db;
}
// End response immediately
function fw_instaKill( string $reason ) {
$fw = trim( 'Firewall ' . $reason );
fw_insertLog( $fw );
\http_response_code( 403 );
die( KILL_MSG );
}
// String to list helper
function fw_trimmedList( $text, $lower = false ) {
$map = \array_map( 'trim', \explode( ',', $text ) );
return $lower ? \array_map( 'strtolower', $map ) : $map;
}
// String contains a fragment
function fw_has( $source, $term ) {
return
( empty( $source ) || empty( $term ) ) ?
false : ( false !== \strpos( $source, $term ) );
}
// String starts with
function fw_startsWith( $find, $collection ) {
foreach ( $collection as $c ) {
if ( 0 === \strncasecmp( $find, $c, \strlen( $c ) ) ) {
return true;
}
}
return false;
}
// Search string for a fragment in an array
function fw_needleSearch( $find, $collection ) {
foreach ( $collection as $c ) {
if ( fw_has( $find, $c ) ) {
return true;
}
}
return false;
}
// IP v4 address in given subnet
function fw_inIPv4Range( $ip, $subnet ) {
// Set default subnet to 32
if ( !fw_has( $subnet, '/' ) ) {
$subnet .= '/32';
}
list( $range, $mask ) = \explode( '/', $subnet, 2 );
$ndec = -1 << ( 32 - $mask );
return
( \ip2long( $ip ) & $ndec ) === ( \ip2long( $range ) & $ndec );
}
// Convert IPv6 mask to byte array for easier matching
function fw_IPv6Array( $net ) {
$ip = \str_repeat( 'f', $net / 4 );
switch( $net % 4 ) {
case 1:
$ip .= '8';
break;
case 2:
$ip .= 'c';
break;
case 3:
$ip .= 'e';
break;
}
// Fill out mask
return \pack( 'H*', \str_pad( $ip, 32, '0' ) );
}
// IP v6 address in given subnet
function fw_inIPv6Range( $ip, $subnet ) {
// Set default subnet to 64
if ( !fw_has( $subnet, '/' ) ) {
$subnet .= '/64';
}
list( $range, $mask ) = \explode( '/', $subnet, 2 );
$sbit = \inet_pton( $ip );
return
( $sbit & fw_IPv6Array( $mask ) ) == \inet_pton( $range );
}
// IP Address in given range collection
function fw_inSubnet( $ip, $subnet ) {
// If this is an IPv6 address
if ( \filter_var(
$ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6
) ) {
foreach ( $subnet as $net ) {
// Skip searching IPv4 addresses
if ( !fw_has( $net, ':' ) ) {
continue;
}
if ( fw_inIPv6Range( $ip, $net ) ) {
return true;
}
}
// This is an IPv4 address
} else {
foreach ( $subnet as $net ) {
// Skip searching IPv6 addresses
if ( fw_has( $net, ':' ) ) {
continue;
}
if ( fw_inIPv4Range( $ip, $net ) ) {
return true;
}
}
}
return false;
}
// Forwarded HTTP header chain from load balancer
function fw_getForwarded() : array {
static $fwd;
if ( isset( $fwd ) ) {
return $fwd;
}
$fwd = [];
$terms =
$_SERVER['HTTP_FORWARDED'] ??
$_SERVER['FORWARDED'] ??
$_SERVER['HTTP_X_FORWARDED'] ?? '';
// No headers forwarded
if ( empty( $terms ) ) {
return [];
}
$pt = explode( ';', $terms );
// Gather forwarded values
foreach ( $pt as $p ) {
// Break into comma delimited list, if any
$chain = \array_map( 'trim', explode( ',', $p ) );
if ( empty( $chain ) ) {
continue;
}
foreach ( $chain as $c ) {
$k = explode( '=', $c );
// Skip empty or odd values
if ( count( $k ) != 2 ) {
continue;
}
// Existing key?
if ( isset( $fwd[$k[0]] ) ) {
// Existing array? Append
if ( \is_array( $fwd[$k[0]] ) ) {
$fwd[$k[0]][] = $k[1];
// Multiple values?
// Convert to array and then append new
} else {
$tmp = $fwd[$k[0]];
$fwd[$k[0]] = [];
$fwd[$k[0]][] = $tmp;
$fwd[$k[0]][] = $k[1];
}
// Fresh value
} else {
$fwd[$k[0]] = $k[1];
}
}
}
return $fwd;
}
// Get the current IP address connection chain including given proxies
function fw_getProxyChain() : array {
static $chain;
if ( isset( $chain ) ) {
return $chain;
}
$chain =
\array_map( 'trim',
explode( ',',
$_SERVER['HTTP_X_FORWARDED_FOR'] ??
$_SERVER['HTTP_CLIENT_IP'] ??
$_SERVER['REMOTE_ADDR'] ?? ''
)
);
return $chain;
}
// Browser User Agent
function fw_getUA() {
static $ua;
if ( isset( $ua ) ) {
return $ua;
}
$ua = trim( $_SERVER['HTTP_USER_AGENT'] ?? '' );
return $ua;
}
// Current querystring, if present
function fw_getQS() {
static $qs;
if ( isset( $qs ) ) {
return $qs;
}
$qs = $_SERVER['QUERY_STRING'] ?? '';
return $qs;
}
// Best effort IP address
function fw_getIP() {
static $ip;
if ( isset( $ip ) ) {
return $ip;
}
$fwd = fw_getForwarded();
// Get IP from reverse proxy, if set
if ( \array_key_exists( 'for', $fwd ) ) {
$ip =
\is_array( $fwd['for'] ) ?
\array_shift( $fwd['for'] ) :
( string ) $fwd['for'];
// Get from sent headers
} else {
$raw = fw_getProxyChain();
if ( empty( $raw ) ) {
$ip = '';
return '';
}
$ip = ( string ) \array_shift( $raw );
}
$va =
( SKIP_LOCAL ) ?
\filter_var( $ip, \FILTER_VALIDATE_IP ) :
\filter_var(
$ip,
\FILTER_VALIDATE_IP,
\FILTER_FLAG_NO_PRIV_RANGE |
\FILTER_FLAG_NO_RES_RANGE
);
$ip = ( false === $va ) ? '' : $ip;
return $ip;
}
function fw_uaCheck() {
if ( !\FIREWALL_UA_CHECK ) {
return false;
}
$ua = fw_getUA();
// User Agent contains non-ASCII characters?
if ( !\mb_check_encoding( $ua, 'ASCII' ) ) {
return true;
}
// Starting flags
static $ua_start = [
' ',
'\"',
'-',
';',
'%',
'$',
'<?',
'(',
'Android',
'iTunes',
'U;',
'Korvo',
'MSIE',
'user'
];
if ( fw_startsWith( $ua, $ua_start ) ) {
return true;
}
// Suspicious user agent fragments
static $ua_frags = [
// Injection in the UA
'<?php',
'IDATH.c\<?',
'<?=`$_',
'IDATH.c??<script',
'IDATHKc??<script',
'{ :; }',
// There's no space in front of ;
' ; MSIE',
// Invalid tokens
'~~',
'**',
'...',
'\\\\',
// Doesn't exist
'.NET CLR 1)',
'.NET CLR1',
'.NET_CLR',
'.NET-CLR',
// Troublesome TLDs
'.bid',
'.cam',
'.cf',
'.gq',
'.ml',
'.surf',
'.today',
'.work',
'.xyz',
'\r',
'<sc',
'(Chrome)',
'Widows',
'360Spider',
'8484 Boston Project',
// There shouldn't be HTML in user agent strings
'a href=',
'Aboundex',
'Acunetix',
'adwords',
'AIBOT',
'Alexibot',
'ALittle Client',
// Misspelled "Android"
'Andriod',
'Andreod',
'Andirod',
'Angroid',
// Forged Android
'Android --',
'Android 2.x',
'AntivirXP08',
'AOLBuild /',
// Misspelled "Apple"
'Appel',
'Appl ',
'Aplle',
'asterias',
'Atomic',
'attach',
'atSpider',
'autoemail',
'AWI ',
'BackDoor',
'BackWeb',
'BadBehavior',
'Bad Behavior',
// Fake Baidu
'baidu /',
'baidu/ ',
'bai du/',
'baiduspider/ ',
'baiduspider /',
'baidu spider',
'baiduspider/1.',
'Bandit',
'BatchFTP',
'Bigfoot',
// Fake Bingbot
'bingbot /',
'bingbot/ ',
'bing bot/',
'Black.Hole',
'BlackHole',
'BlackWidow',
'blogsearchbot-martin',
'BlowFish',
'Bot mailto:craftbot@yahoo.com',
'BotALot',
'BrowserEmulator',
'Buddy',
'BUILDDATE',
'BuiltBotTough',
'Bullseye',
'BunnySlippers',
'bwh3',
'CAIME0',
'CAIMEO',
'CCBot',
'Cegbfeieh',
'centurybot',
'changedetection',
'ChatGPT',
'CheeseBot',
'CherryPicker',
'China Local Browse',
'ChinaClaw',
'Clarity',
'Clearswift',
'clipping',
'Cogentbot',
'Collector',
'ContactBot',
'ContactSmartz',
'ContentSmartz',
// Fake compatibility
'compatible ;',
'compatible-',
'Cool ',
'cognitiveseo',
'CoralWebPrx',
'core-project',
'Copier',
'CopyRightCheck',
'cosmos',
'Crescent',
'Cryptoapi',
'Custo',
'DataCha0s',
'DBrowse',
'Demo Bot',
'Diamond',
'Digger',
'DIIbot',
'DISCo',
'DittoSpyder',
'discovery',
'DnyzBot',
'Download',
'dragonfly',
'Drip',
'DSurf',
'DTS Agent',
'eCatch',
'Easy',
'EBrowse',
'ecollector',
'Educate Search',
'Email',
'Emulator',
'Enchanc',
'EroCrawler',
'Exabot',
'expanseinc',
'Express WebPictures',
// Extractors
'Extrac',
'evc-batch',
'EyeNetIE',
// Fake Facebook bot
'Facebot Twitterbot',
'facebookexternal/',
'facebookexternal /',
'facebookexternalhit/ ',
'facebookexternalhit /',
'Fail',
'Fatal',
'FlashGet',
'FHscan',
// Too old to be viable
'Firebird',
'Firefox/40',
'flunky',
'Franklin Locator',
'Foobot',
'Forum Poster',
'FrontPage',
'FSurf',
'Full Web Bot',
'FunWeb',
'Gecko/2525',
'Generic',
'GetRight',
'GetWeb!',
'Ghost',
'Gluten Free Crawler',
'Go!Zilla',
'Go-Ahead-Got-It',
'Go-http-client',
'gotit',
// Fake Googlebot
'googlebot /',
'googlebot/ ',
'googlebot/1.',
'Googlebot Image',
'Googlebot-Image/ ',
'Googlebot-Image /',
'Googlebot Video',
'Googlebot-Video/ ',
'Googlebot-Video /',
'Mediapartners Google',
'Gowikibot',
'Grab',
'Grafula',
'GrapeshotCrawler',
'grub',
'hanzoweb',
'Harvest',
'Havij',
'hloader',
'HMView',
'HttpProxy',
// Resource-hungry archiver (comment to make exception)
'HTTrack',
'human',
'hverify',
// Amazon Alexa
'ia_archiver',
'IlseBot',
'IndeedBot',
'Indy Library',
'InfoNaviRobot',
'InfoPath',
'InfoTekies',
'informant',
'Insuran',
'Intelliseek',
'InterGET',
// *Not* IE. UA is likely a bot
'Internet Explorer',
// Misspelled "Intel"
'Intle',
'Itele',
'Intle',
'Intraformant',
// Fake iPhone
'iPhone/',
'iPhone /',
'iPhoneOS',
'iPhone OS/',
'ISC Systems iRc',
'Iria',
'Java 1.',
'Java/1',
'Jakarta',
'Jenny',
'JetCar',
'JOC',
'JustView',
'Jyxobot',
'Kenjin',
'Keyword',
'larbin',
'Leacher',
'LexiBot',
'LeechFTP',
'libwhisker',
'libwww-perl',
'lftp',
'libWeb/clsHTTP',
'likse',
'LinkScan',
'Lightning',
'linkdexbot',
'LNSpiderguy',
'LinkWalker',
'Lobster',
'Locator',
'LWP',
// Misspelled "Macintosh"
'Macnitosh',
'Macinotsh',
'Mackintosh',
'Macintohs',
'Mcintosh',
'Magnet',
'Mag-Net',
'MarkWatch',
'Mata.Hari',
// Automated tool (can be abused)
'Mechanize',
'Memo',
'Meterpreter/Windows',
'Microsoft URL',
'Microsoft.URL',
'MIDown',
'Ming Mong',
'Missigua',
'Mister',
'MJ12bot/v1.0.8',
'moget',
'Mole',
'Morfeus',
// Not the blog engine
'Movable Type',
// Fake Mozilla
'Mozilla.*NEWT',
'Mozilla/0',
'Mozilla/1',
'Mozilla/2',
'Mozilla/3',
'Mozilla/4.0(',
'Mozilla/4.0+(compatible;+',
'Mozilla/4.0 (Hydra)',
'Mozilla /',
'Mozilla/9.0',
// Fake MSNBot
'msnbot /',
'MS Search 6.0 Robot',
'MSIE 7.0 ; Windows NT',
'MSIE 7.0; Windows NT 5.2',
'MSIE 7.0; Windows NT 5.2',
'Murzillo',
'MVAClient',
'MyApp',
'MyFamily',
'Navroad',
'NearSite',
'NetAnts',
'NetMechanic',
'Netsparker',
'NetSpider',
'Net Vampire',
'NetZIP',
'Nessus',
'NG',
'NICErsPRO',
'Nikto',
'Ninja',
'Nimble',
'Nmap',
'NPbot',
'Nomad',
'Nutch',
'Nutscrape',
'NextGen',
'Octopus',
'okhttp/',
'OmniExplorer',
'Opera/9.64(',
// Offline anything is a scraper
'Offline',
'Openfind',
'OutfoxBot',
'panscient',
'Papa Foto',
'PaperLiBot',
'Parser',
'pavuk',
'pcBrowser',
'PECL::',
'PeoplePal',
'Perman Surfer',
'PHP',
'Pockey',
'PMAFind',
'POE-Component',
'PowerMapper',
'ProPowerBot',
'proximic',
'psamma',
'psbot',
'psycheclone',
'Pump',
'PussyCat',
'PycURL',
'python-requests',
'Python-urllib',
'qiqi',
'QueryN',
'raventools',
'RealDownload',
'Reaper',
'Recorder',
'ReGet',
'RepoMonkey',
'Research',
'RMA',
'revolt',
'RukiCrawler',
// Revisions are always numbers, not x
'rv:x.',
// Misconfigured bot
'rv:geckoversion',
// Scraper
'Scrapy',
'scaninfo',
'Shockwave Flash',
'SemrushBot',
'sentiment',
'SeoBotM6',
'seocharger',
'SEOkicks-Robot',
'Siphon',
'SiteSnagger',
'SlySearch',
'SmartDownload',
'SMTBot',
'Snake',
'Snapbot',
'sogou',
'SpaceBison',
'Spank',
'spanner',
'sqlmap',
'Sqworm',
'Stress',
'Stripper',
'Strateg',
'strange',
'study',
'Sucker',
'SuperBot',
'SuperCleaner',
'Super Happy Fun',
'SuperHTTP',
'Surfbot',
'suzuran',
'Synapse',
'Szukacz',
'taboola',
'tAkeOut',
'Test',
'TightTwatBot',
'Titan',
'Teleport',
'Telesoft',
'TO-Browser/TOB',
// No space before ;
'Touch ;',
'TrackBack',
'trandoshan',
'Trellian',
// Misspelled "Trident"
'Tridet',
'Tridnet',
'Tridnet /',
'Trident /',
'True_Robot',
'Turing Machine',
'turingos',
'TurnitinBot',
'like TwitterBot',
'Tweetmeme',
'Ultraseek',
'Unknown',
'Ubuntu/9.25',
'unspecified',
'user',
// Strange formatting of the two words
'User Agent:',
'User-Agent:',
// Fake emulator
'Version/ ',
'Version /',
'VoidEYE',
'w3af',
'Warning',
'Web Image Collector',
'WebaltBot',
'WebAuto',
'WebFetch',
'WebGo',