Skip to content

Commit

Permalink
Merge pull request #27 from othmanalikhan-security/master
Browse files Browse the repository at this point in the history
Added a Regex Definition for Saudi Arabian Passports
  • Loading branch information
0x4f53 authored Nov 23, 2023
2 parents d2f9627 + 6b415b6 commit 9b266f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@
"<<<<"
]
},
"Saudi Arabian Passport": {
"regex":"(?:P<SAU)(?:[A-Z0-9<].+)",
"region":"Saudi Arabia",
"keywords":[
"Passport",
"Saudi Arabia",
"SAU",
"<<<<"
]
},
"Nebraska Driver's License": {
"regex":"[A-Z]{1}[0-9]{9,11}",
"region":"United States",
Expand Down
4 changes: 2 additions & 2 deletions text_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def string_tokenizer(text):
def similarity(a, b): return difflib.SequenceMatcher(None, a, b).ratio() * 100

def get_regexes():
with open('definitions.json') as json_file:
with open('definitions.json', "r", encoding='utf-8') as json_file:
_rules = json.load(json_file)
return _rules

Expand Down Expand Up @@ -133,4 +133,4 @@ def keywords_classify_pii(rules, intelligible_text_list):
) > 80: scores[key] += 1

return scores


0 comments on commit 9b266f5

Please sign in to comment.