Skip to content

Commit 4224dff

Browse files
authored
Merge pull request #102 from RackReaver/update-american-social-security-number
Update American Social Security Number.
2 parents f028579 + 7949e71 commit 4224dff

File tree

2 files changed

+67
-13
lines changed

2 files changed

+67
-13
lines changed

pywhat/Data/regex.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -703,19 +703,19 @@
703703
]
704704
},
705705
{
706-
"Name": "American Social Security Number",
707-
"Regex": "^[0-9]{3}-[0-9]{2}-[0-9]{4}$",
708-
"plural_name": false,
709-
"Description": "An [#CAE4F1][link=https://en.wikipedia.org/wiki/Social_Security_number]American Identification Number[/link][/#CAE4F1]",
710-
"Rarity": 0.2,
711-
"URL": null,
712-
"Tags": [
713-
"Credentials",
714-
"Password",
715-
"Username",
716-
"SSN"
717-
]
718-
},
706+
"Name": "American Social Security Number",
707+
"Regex": "^([0-9][0-9][0-9])(?<!666|000|9[0-9][0-9])(=|\\+|_|\\#|:|;|\\.|-|\\s){0,3}([1-9][1-9]|0[1-9]|[1-9]0)(=|\\+|_|\\#|:|;|\\.|-|\\s){0,3}([0-9][0-9][0-9][0-9])(?<!0000)(=|\\+|_|\\#|:|;|\\.|-|\\s){0,3}?$",
708+
"plural_name": false,
709+
"Description": "An [#CAE4F1][link=https://en.wikipedia.org/wiki/Social_Security_number]American Identification Number[/link][/#CAE4F1]",
710+
"Rarity": 0.5,
711+
"URL": null,
712+
"Tags": [
713+
"Credentials",
714+
"Password",
715+
"Username",
716+
"SSN"
717+
]
718+
},
719719
{
720720
"Name": "Key:Value Pair",
721721
"Regex": "[^:\\s]+[ ]?:[ ]?[^:\\s]+",

tests/test_regex_identifier.py

+54
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,60 @@ def test_ssn():
364364
assert "Social" in str(res)
365365

366366

367+
def test_ssn2():
368+
r = regex_identifier.RegexIdentifier()
369+
res = r.check(["001:01:0001"])
370+
assert "Social" in str(res)
371+
372+
373+
def test_ssn3():
374+
r = regex_identifier.RegexIdentifier()
375+
res = r.check(["001.01.0001"])
376+
assert "Social" in str(res)
377+
378+
379+
def test_ssn4():
380+
r = regex_identifier.RegexIdentifier()
381+
res = r.check(["001 01 0001"])
382+
assert "Social" in str(res)
383+
384+
385+
def test_ssn5():
386+
r = regex_identifier.RegexIdentifier()
387+
res = r.check(["900-01-2222"])
388+
assert "Social" not in str(res)
389+
390+
391+
def test_ssn6():
392+
r = regex_identifier.RegexIdentifier()
393+
res = r.check(["999-21-2222"])
394+
assert "Social" not in str(res)
395+
396+
397+
def test_ssn7():
398+
r = regex_identifier.RegexIdentifier()
399+
res = r.check(["666-21-2222"])
400+
assert "Social" not in str(res)
401+
402+
403+
def test_ssn8():
404+
r = regex_identifier.RegexIdentifier()
405+
res = r.check(["000-21-5544"])
406+
assert "Social" not in str(res)
407+
408+
409+
def test_ssn9():
410+
r = regex_identifier.RegexIdentifier()
411+
res = r.check(["122-00-5544"])
412+
assert "Social" not in str(res)
413+
414+
415+
def test_ssn10():
416+
r = regex_identifier.RegexIdentifier()
417+
res = r.check(["122-32-0000"])
418+
assert "Social" not in str(res)
419+
420+
367421
def test_cors():
368422
r = regex_identifier.RegexIdentifier()
369423
res = r.check(["Access-Control-Allow: *"])

0 commit comments

Comments
 (0)