add: New Warninglist for phone numbers that should never be attributed

- First examples filling the list of regexes: the
  phone numbers used for audiovisual works, or
  the communications companies internal numbers.
  Those phone numbers are reserved and should
  never be given to any user
- We'll add as well the numbers reserved for the
  american audiovisual works soon
pull/168/head
chrisr3d 2020-10-27 04:03:44 +01:00
parent feed9b71ac
commit 543406dff4
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
3 changed files with 61 additions and 0 deletions

View File

@ -21,6 +21,7 @@ python3 generate_moz-top500.py
# Deprecate?
#python3 generate-office365-cn.py > lists/microsoft-office365-cn/list.json
python3 generate-office365.py
python3 generate_phone_numbers.py
python3 generate-publicdns.py
python3 generate-tlds.py
python3 generate_tranco.py

View File

@ -0,0 +1,19 @@
{
"description": "Numbers that should never be attributed.",
"list": [
"/((?:\\+|00)33?|0?)(19900)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(26191)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(35301)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(46571)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(53649)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(63998)([0-9]{4})/g",
"/((?:\\+|00)33?|0?)(999)([0-9]{6})/g"
],
"matching_attributes": [
"phone-number",
"whois-registrant-phone"
],
"name": "List of phone numbers that cannot be used.",
"type": "regex",
"version": 20201027
}

View File

@ -0,0 +1,41 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from generator import get_version, write_to_file
def generate_french_warninglist():
regex = '/((?:\+|00)33?|0?)(%s)([0-9]{%s})/g'
# Warning list for numbers dedicated to communications companies internal use: numbers starting with 09 99
warninglist = [regex % ('999', '6')]
# Warning list for numbers dedicated to audiovisual works: starting with any of the following list
prefixes = ('19900', '26191', '35301', '46571', '53649', '63998')
warninglist.extend(regex % (prefix, '4') for prefix in prefixes)
return warninglist
def process(warninglist_name):
description = {
'description': 'Numbers that should never be attributed.',
'name': 'List of phone numbers that cannot be used.',
'matching_attributes': [
'phone-number',
'whois-registrant-phone'
],
'type': 'regex',
'version': get_version()
}
warninglist = generate_french_warninglist()
# The list can be extended by adding other entries: `warninglist.extend(generate_some_warninglist())`
description['list'] = warninglist
write_to_file(description, warninglist_name)
if __name__ == '__main__':
warninglist_name = 'phone_numbers'
process(warninglist_name)