Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated definitions #25

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 133 additions & 22 deletions definitions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"Email":{
"Email": {
"regex":"[A-Za-z0-9._+\\-\\']+@[A-Za-z0-9.\\-]+\\.[A-Za-z]{2,}",
"region":null,
"keywords":null
},
"Phone Number":{
"Phone Number": {
"regex":"((\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]\\d{3}[\\s.-]\\d{4}|[0-9]{10}|\\+{1}[0-9 ]{11,15}|[0-9]{4} [0-9]{6})",
"region":null,
"keywords":[
Expand All @@ -30,7 +30,7 @@
"regex": ["\\b(?:\\d{4}[ -]?){3}(?=\\d{4}\\b)(?:\\d{4})"],
"region": null
},
"Aadhaar Card":{
"Aadhaar Card": {
"regex":"([0-9]{4} [0-9]{4} [0-9]{4}|[0-9]{4}-[0-9]{4}-[0-9]{4}|[0-9]{12})",
"region":"India",
"keywords":[
Expand All @@ -49,7 +49,7 @@
"regex": "[A-Z]{5}?[0-9]{4}[A-Z]",
"region": "India"
},
"Election Photo ID Card":{
"Election Photo ID Card": {
"regex":"[A-Za-z]{3}[0-9]{7}",
"region":"India",
"keywords":[
Expand All @@ -61,7 +61,7 @@
"Constituency"
]
},
"Social Security Number":{
"Social Security Number": {
"regex":"[0-9]{3}-[0-9]{2}-[0-9]{3,4}",
"region":"United States",
"keywords":[
Expand All @@ -71,7 +71,7 @@
"Security"
]
},
"Social Insurance Number":{
"Social Insurance Number": {
"regex":"([0-9]{3}-[0-9]{3}-[0-9]{3}|[0-9]{3} [0-9]{3} [0-9]{3})",
"region":"Canada",
"keywords":[
Expand All @@ -83,7 +83,7 @@
"Canada"
]
},
"Permanent Resident Card":{
"Permanent Resident Card": {
"regex":"^([0-9]{4}-[0-9]{4})$",
"region":"Canada",
"keywords":[
Expand All @@ -95,7 +95,7 @@
"Canada"
]
},
"Permanent Identity Card":{
"Permanent Identity Card": {
"regex":"^([0-9]{4}-[0-9]{4})$",
"region":"Hong Kong",
"keywords":[
Expand All @@ -105,7 +105,7 @@
"Hong Kong"
]
},
"Resident ID Card":{
"Resident ID Card": {
"regex":"[0-9]{6}20[0-9]{2}[0-1][0-9][0-3][0-9][0-9]{3}[0-9]{1,2}",
"region":"China",
"keywords":[
Expand All @@ -123,7 +123,7 @@
"<<<<"
]
},
"Indian Passport":{
"Indian Passport": {
"regex":"(?:P<IND)(?:[A-Z0-9<].+)",
"region":"India",
"keywords":[
Expand All @@ -132,7 +132,7 @@
"<<<<"
]
},
"United States Passport":{
"United States Passport": {
"regex":"(?:P<USA)(?:[A-Z0-9<].+)",
"region":"United States",
"keywords":[
Expand All @@ -141,7 +141,7 @@
"<<<<"
]
},
"Nebraska Driver's License":{
"Nebraska Driver's License": {
"regex":"[A-Z]{1}[0-9]{9,11}",
"region":"United States",
"keywords":[
Expand All @@ -161,7 +161,7 @@
"Class"
]
},
"Maharashtra Driver's License":{
"Maharashtra Driver's License": {
"regex":"[A-Z]{2}[0-9]{2} [0-9]{12}",
"region":"India",
"keywords":[
Expand All @@ -172,7 +172,7 @@
"Motor"
]
},
"Goa Driver's License":{
"Goa Driver's License": {
"regex":"GA[0-9]{2} \\d{11}",
"region":"India",
"keywords":[
Expand All @@ -183,7 +183,7 @@
"Motor"
]
},
"Karnataka Driver's License":{
"Karnataka Driver's License": {
"regex":"GA[0-9]{2} \\d{11}",
"region":"India",
"keywords":[
Expand All @@ -194,12 +194,12 @@
"Motor"
]
},
"UUID4":{
"UUID4": {
"regex":"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}",
"region":null,
"keywords":null
},
"Professional Resume":{
"Professional Resume": {
"regex":null,
"region":null,
"keywords":[
Expand All @@ -211,7 +211,7 @@
"Work"
]
},
"Ukraine ID Card":{
"Ukraine ID Card": {
"regex":"(?:IDUKR)(?:[A-Z0-9<].+)",
"region":"Ukraine",
"keywords":[
Expand All @@ -222,7 +222,7 @@
"<<"
]
},
"Ukrainian Passport":{
"Ukrainian Passport": {
"regex":"(?:P<UKR)(?:[A-Z0-9<].+)",
"region":"Ukraine",
"keywords":[
Expand All @@ -233,7 +233,7 @@
"<<"
]
},
"Russian Passport":{
"Russian Passport": {
"regex":"(?:P<RUS)(?:[A-Z0-9<].+)",
"region":"Russia",
"keywords":[
Expand All @@ -244,16 +244,127 @@
"<<"
]
},
"Russia Driver's License":{
"Russia Driver's License": {
"regex":"^[0-9 ]{9,11}$",
"region":"Russia",
"keywords":[
"4a)",
"4b)",
"4c)",
"P<RUS",
"9.",
"TOBEP"
]
},
"Singaporean National Registration Identity Card": {
"regex": "(?i)[a-z0-9]{9}?",
"region": "Singapore",
"keywords": [
"Identity Card No",
"Singapura",
"Republic of Singapore"
]
},
"Singaporean Passport": {
"regex": "(?:P<SGP|PASGP)<<(?:[A-Z0-9<].+)",
"region": "Sinagpore",
"keywords": [
"Singapore Citizen",
"SGP",
"PA",
"Passport"
]
},
"South African Identity Card": {
"regex": "^[0-9]{5,}$",
"region": "South Africa",
"keywords": [
"South Africa",
"Identity Number"
]
},
"South African Passport": {
"regex": "(?:P<ZAF|PMZAF)<<(?:[A-Z0-9<].+)",
"region": "South Africa",
"keywords": [
"South Africa",
"Republique",
"ZAF",
"Passport"
]
},
"South Korean Passport": {
"regex": "(?:P<KOR|PPKOR)(?:[A-Z0-9<].+)",
"region": "South Korea",
"keywords": [
"Korea",
"KOR",
"Passport",
"PM"
]
},
"North Korean Passport": {
"regex": "(?:P<PRK|PPPRK)(?:[A-Z0-9<].+)",
"region": "North Korea",
"keywords": [
"PRK",
"Pyongyang",
"Korea",
"Passport"
]
},
"Israeli Passport": {
"regex": "(?:P<ISR|PMISR)(?:[A-Z0-9<].+)",
"region": "Israel",
"keywords": [
"Israel",
"Passport",
"ISR"
]
},
"Palestinian Passport": {
"regex": "(?:P<PSE|PDPSE)(?:[A-Z0-9<].+)",
"region": "Palestine",
"keywords": [
"Palestinian",
"Palestine",
"Passport",
"PSE"
]
},
"Australian Passport": {
"regex": "(?:P<PSE|PDPSE)(?:[A-Z0-9<].+)",
"region": "Australia",
"keywords": [
"Australia",
"Passport",
"AUS",
"Australian"
]
},
"Canadian Passport": {
"regex": "(?:P<CAN|PPCAN)(?:[A-Z0-9<].+)",
"region": "Canada",
"keywords": [
"PPCAN",
"P<CAN",
"CAN",
"<<<",
"Passport",
"Canadian"
]
},
"Irish Public Services Card": {
"regex": "[A-Z][0-9]{7}",
"region": "Ireland",
"keywords": [
"Public",
"Services",
"Card",
"Ireland",
"Eire",
"Carta",
"Seirbhisi",
"Poibli"
]
}
}
2 changes: 1 addition & 1 deletion octopii.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def search_pii(file_path):

try:
results = search_pii (file_path)
print(json.dumps(results, indent=4).replace("{", "").replace("}", "").replace(" ", ""))
print(json.dumps(results, indent=4))
file_utils.append_to_output_file(results, output_file)
print ("\nOutput saved in " + output_file)

Expand Down
Loading