blob: 499db2c7f7d664597e442e6cc0fc2d5923853f16 (
plain) (
blame)
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
|
PRAGMA DisableSimpleColumns;
/* postgres can not */
USE plato;
$records = (
SELECT
key as ip,
subkey AS recordType,
Url::GetHost(value) AS host
FROM spider_info
);
$results = (
SELECT
ip,
host,
count(*) AS request_count
FROM $records
WHERE host IS NOT NULL AND recordType == "RESULT"
GROUP BY ip, host
);
$bans = (
SELECT
ip,
host,
count(*) AS fetcher_count
FROM $records
WHERE host IS NOT NULL AND recordType == "BAN_DETECTED"
GROUP BY ip, host
);
SELECT
results.ip AS ip,
results.host AS host,
results.request_count AS request_count,
bans.fetcher_count AS fetcher_count
FROM
$results AS results
INNER JOIN
$bans AS bans
ON bans.ip == results.ip
AND bans.host == results.host
ORDER BY fetcher_count DESC
;
|