Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Last 30d IPv6 vandalism ratio per subnets (fiwiki)
by
Jmk
This query is marked as a draft
This query has been published
by
Zache
.
Based on similar tool by Zache for IPv4 vandalism. distinct_addresses_c = how many different addresses in the IPv6 range contributed edits.
Toggle Highlighting
SQL
use fiwiki_p; SET @username_filter="%2001:14BB:%"; SET @timestamp_filter=20170000000000; SELECT reverts_c, reverts_d, edits_c, edits_d, distinct_addresses_c, reverts_c/edits_c AS ratio, reverts_d/edits_d AS ratio2, reverts_ip_range AS ip_range FROM ( SELECT SUM(1) AS reverts_c, count(distinct(floor(rev_timestamp/1000000))) as reverts_d, CONCAT(SUBSTR(REGEXP_SUBSTR(rev_comment,'/([0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:)'),2),"*") AS reverts_ip_range FROM revision_userindex WHERE rev_timestamp > @timestamp_filter AND rev_comment LIKE @username_filter AND rev_comment REGEXP "(ontributions|uokkaukset)/([0-9A-F]{1,4}:){7,7}[0-9A-F]{1,4}" GROUP BY reverts_ip_range ) AS reverts LEFT JOIN ( SELECT SUM(1) AS edits_c, count(distinct(floor(rev_timestamp/1000000))) as edits_d, COUNT(DISTINCT rev_user_text) AS distinct_addresses_c, CONCAT(SUBSTR(REGEXP_SUBSTR(rev_user_text,'^([0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:)'),1),"*") AS edits_ip_range FROM revision_userindex WHERE rev_timestamp > @timestamp_filter AND rev_user_text LIKE @username_filter AND rev_user_text REGEXP "^([0-9A-F]{1,4}:){7,7}[0-9A-F]{1,4}" AND rev_user = 0 group by edits_ip_range ) AS edits ON edits_ip_range=reverts_ip_range ORDER BY reverts_c desc LIMIT 100;
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...