From 6d49d3386f2aa3486c08b0d9ce53dcf84e27bd62 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Fri, 30 Oct 2020 23:29:18 +0100 Subject: [PATCH 1/2] add: Added regexes for the american fictitious numbers in the list --- lists/phone_numbers/list.json | 4 +++- tools/generate_phone_numbers.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lists/phone_numbers/list.json b/lists/phone_numbers/list.json index 3ed89e4..2b1de57 100644 --- a/lists/phone_numbers/list.json +++ b/lists/phone_numbers/list.json @@ -1,6 +1,8 @@ { "description": "Numbers that cannot be attributed because they reserved for different purposes.", "list": [ + "/((?:\\+|00)1?)([0-9]{3})55501([0-9]{2})/g", + "/((?:\\+|00)1?)55501([0-9]{2})/g", "/((?:\\+|00)33?|0?)(19900|26191|35301|46571|53649|63998)([0-9]{4})/g", "/((?:\\+|00)33?|0?)(999)([0-9]{6})/g" ], @@ -10,5 +12,5 @@ ], "name": "Unattributed phone number.", "type": "regex", - "version": 20201028 + "version": 20201030 } diff --git a/tools/generate_phone_numbers.py b/tools/generate_phone_numbers.py index 0dfece5..7502b73 100644 --- a/tools/generate_phone_numbers.py +++ b/tools/generate_phone_numbers.py @@ -4,6 +4,15 @@ from generator import get_version, write_to_file +def generate_american_warninglist(): + # Warning list for fictitious telephone numbers in the US + warninglist = [ + '/((?:\+|00)1?)55501([0-9]{2})/g', + '/((?:\+|00)1?)([0-9]{3})55501([0-9]{2})/g' + ] + return warninglist + + def generate_french_warninglist(): regex = '/((?:\+|00)33?|0?)(%s)([0-9]{%s})/g' @@ -30,6 +39,7 @@ def process(warninglist_name): } warninglist = generate_french_warninglist() + warninglist.extend(generate_american_warninglist()) # The list can be extended by adding other entries: `warninglist.extend(generate_some_warninglist())` description['list'] = warninglist From 7154bfc01f96f0d1e839be96f66d08f0574eff51 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Sat, 31 Oct 2020 22:06:20 +0100 Subject: [PATCH 2/2] add: A few more phone numbers regexes --- lists/phone_numbers/list.json | 37 +++++++++++++-- tools/generate_phone_numbers.py | 80 +++++++++++++++++++++++++++++++-- 2 files changed, 110 insertions(+), 7 deletions(-) diff --git a/lists/phone_numbers/list.json b/lists/phone_numbers/list.json index 2b1de57..988998b 100644 --- a/lists/phone_numbers/list.json +++ b/lists/phone_numbers/list.json @@ -1,10 +1,39 @@ { "description": "Numbers that cannot be attributed because they reserved for different purposes.", "list": [ - "/((?:\\+|00)1?)([0-9]{3})55501([0-9]{2})/g", - "/((?:\\+|00)1?)55501([0-9]{2})/g", + "/((?:\\+|00)1)?([0-9]{3})55501([0-9]{2})/g", + "/((?:\\+|00)1)?55501([0-9]{2})/g", "/((?:\\+|00)33?|0?)(19900|26191|35301|46571|53649|63998)([0-9]{4})/g", - "/((?:\\+|00)33?|0?)(999)([0-9]{6})/g" + "/((?:\\+|00)33?|0?)(999)([0-9]{6})/g", + "/((?:\\+|00)353)?02091([0-9]{5})/g", + "/((?:\\+|00)44)?01(13|14|15|16|17|18|21|31|41|51|61)4960([0-9]{3})/g", + "/((?:\\+|00)44)?01632960([0-9]{3})/g", + "/((?:\\+|00)44)?01914980([0-9]{3})/g", + "/((?:\\+|00)44)?02(89|92)0180([0-9]{3})/g", + "/((?:\\+|00)44)?02079460([0-9]{3})/g", + "/((?:\\+|00)44)?03069990([0-9]{3})/g", + "/((?:\\+|00)44)?07700900([0-9]{3})/g", + "/((?:\\+|00)44)?08081570([0-9]{3})/g", + "/((?:\\+|00)44)?09098790([0-9]{3})/g", + "/((?:\\+|00)46)?07017406(0[5-9]|[1-9][0-9])/g", + "/((?:\\+|00)46)?3139006([0-9]{2})/g", + "/((?:\\+|00)46)?4062804([0-9]{2})/g", + "/((?:\\+|00)46)?8465004([0-9]{2})/g", + "/((?:\\+|00)46)?9803192([0-9]{2})/g", + "/((?:\\+|00)61)?(02|03|07|08)(5550|7010)([0-9]{4})/g", + "/((?:\\+|00)61)?0491570(006|156|157|158|159|110|313|737)/g", + "/((?:\\+|00)61)?0491571(266|491|804)/g", + "/((?:\\+|00)61)?0491572(549|665|983)/g", + "/((?:\\+|00)61)?0491573(770|087)/g", + "/((?:\\+|00)61)?0491574(118|632)/g", + "/((?:\\+|00)61)?0491575(254|789)/g", + "/((?:\\+|00)61)?0491576(398|801)/g", + "/((?:\\+|00)61)?0491577(426|644)/g", + "/((?:\\+|00)61)?0491578(957|148|888)/g", + "/((?:\\+|00)61)?0491579(212|760|455)/g", + "/((?:\\+|00)61)?1(3|8)00975707|08|09|10|11/g", + "/((?:\\+|00)61)?1800160401/g", + "/((?:\\+|00)61)?1900654321/g" ], "matching_attributes": [ "phone-number", @@ -12,5 +41,5 @@ ], "name": "Unattributed phone number.", "type": "regex", - "version": 20201030 + "version": 20201031 } diff --git a/tools/generate_phone_numbers.py b/tools/generate_phone_numbers.py index 7502b73..4f7fd94 100644 --- a/tools/generate_phone_numbers.py +++ b/tools/generate_phone_numbers.py @@ -5,11 +5,45 @@ from generator import get_version, write_to_file def generate_american_warninglist(): + # Warning list for fictitious telephone numbers in the US warninglist = [ - '/((?:\+|00)1?)55501([0-9]{2})/g', - '/((?:\+|00)1?)([0-9]{3})55501([0-9]{2})/g' + '/((?:\+|00)1)?55501([0-9]{2})/g', + '/((?:\+|00)1)?([0-9]{3})55501([0-9]{2})/g' ] + + return warninglist + + +def generate_australian_warninglist(): + prefix = '((?:\+|00)61)?' + + # Australian Fictitious numbers + warninglist = [f'/{prefix}1900654321/g', f'/{prefix}1800160401/g'] + location = ('02', '03', '07', '08') + numbers = ('5550', '7010') + rate_numbers = ('07', '08', '09', '10', '11') + warninglist = [ + f'/{prefix}1900654321/g', + f'/{prefix}1800160401/g', + f"/{prefix}1(3|8)009757{'|'.join(rate_numbers)}/g", + '/%s(%s)(%s)([0-9]{4})/g' % (prefix, '|'.join(location), '|'.join(numbers)) + ] + + mobile_numbers = { + '570': ('006', '156', '157', '158', '159', '110', '313', '737'), + '571': ('266', '491', '804'), + '572': ('549', '665', '983'), + '573': ('770', '087'), + '574': ('118', '632'), + '575': ('254', '789'), + '576': ('398', '801'), + '577': ('426', '644'), + '578': ('957', '148', '888'), + '579': ('212', '760', '455') + } + warninglist.extend([f"/{prefix}0491{key}({'|'.join(values)})/g" for key, values in mobile_numbers.items()]) + return warninglist @@ -26,6 +60,42 @@ def generate_french_warninglist(): return warninglist +def generate_irish_warninglist(): + return ['/((?:\+|00)353)?02091([0-9]{5})/g'] + + +def generate_swedish_warninglist(): + prefix = '((?:\+|00)46)?' + numbers = ( + '3139006', + '4062804', + '8465004', + '9803192' + ) + warninglist = ['/%s07017406(0[5-9]|[1-9][0-9])/g' % prefix] + warninglist.extend('/%s%s([0-9]{2})/g' % (prefix, number) for number in numbers) + return warninglist + + +def generate_uk_warninglist(): + prefix = '((?:\+|00)44)?' + end = '([0-9]{3})' + codes = ('13', '14', '15', '16', '17', '18', '21', '31', '41', '51', '61') + + warninglist = [ + f"/{prefix}01({'|'.join(codes)})4960{end}/g", + f'/{prefix}01914980{end}/g', + f'/{prefix}02079460{end}/g', + f'/{prefix}02(89|92)0180{end}/g', + f'/{prefix}01632960{end}/g', + f'/{prefix}07700900{end}/g', + f'/{prefix}03069990{end}/g', + f'/{prefix}08081570{end}/g', + f'/{prefix}09098790{end}/g' + ] + return warninglist + + def process(warninglist_name): description = { 'description': 'Numbers that cannot be attributed because they reserved for different purposes.', @@ -38,8 +108,12 @@ def process(warninglist_name): 'version': get_version() } - warninglist = generate_french_warninglist() + warninglist = generate_australian_warninglist() warninglist.extend(generate_american_warninglist()) + warninglist.extend(generate_french_warninglist()) + warninglist.extend(generate_irish_warninglist()) + warninglist.extend(generate_swedish_warninglist()) + warninglist.extend(generate_uk_warninglist()) # The list can be extended by adding other entries: `warninglist.extend(generate_some_warninglist())` description['list'] = warninglist