Merge pull request #115 from gallypette/master

Wikimedia
pull/117/head
Alexandre Dulaunoy 2019-09-12 11:18:26 +02:00 committed by GitHub
commit ffb76b2286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 0 deletions

31
lists/wikimedia/list.json Normal file
View File

@ -0,0 +1,31 @@
{
"name": "List of known Wikimedia address ranges",
"version": 20190912,
"description": "Wikimedia address ranges (http://noc.wikimedia.org/conf/reverse-proxy.php.txt)",
"type": "cidr",
"list": [
"208.80.153.0/27",
"208.80.153.32/27",
"208.80.153.64/27",
"208.80.153.96/27",
"208.80.154.0/26",
"208.80.154.128/26",
"208.80.154.64/26",
"208.80.155.96/27",
"2620:0:860:1::/64",
"2620:0:860:2::/64",
"2620:0:860:3::/64",
"2620:0:860:4::/64",
"2620:0:861:1::/64",
"2620:0:861:2::/64",
"2620:0:861:3::/64",
"2620:0:861:4::/64",
"2620:0:862:1::/64",
"91.198.174.0/25"
],
"matching_attributes": [
"ip-src",
"ip-dst",
"domain|ip"
]
}

34
tools/generate-wikimedia.py Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import datetime
import urllib.request
import re
import ipaddress
res = urllib.request.urlopen('http://noc.wikimedia.org/conf/reverse-proxy.php.txt')
res_body = res.read()
decoded = res_body.decode("unicode_escape", "utf-8")
l = []
for line in decoded.split('\n'):
if re.search("public", line):
matched = re.findall(r'\'(.*?)\'', line)
if matched:
try:
ipaddress.ip_network(matched[0])
l.append(matched[0])
except ValueError:
pass
warninglist = {}
warninglist['name'] = 'List of known Wikimedia address ranges'
warninglist['version'] = int(datetime.date.today().strftime('%Y%m%d'))
warninglist['description'] = 'Wikimedia address ranges (http://noc.wikimedia.org/conf/reverse-proxy.php.txt)'
warninglist['type'] = 'cidr'
warninglist['list'] = sorted(set(l))
warninglist['matching_attributes'] = ["ip-src", "ip-dst", "domain|ip"]
print(json.dumps(warninglist))