Skip to content
New issue

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

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

Already on GitHub? # to your account

Added Turkish regexes #169

Merged
merged 2 commits into from
Oct 4, 2021
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
5 changes: 5 additions & 0 deletions fixtures/file
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ Pnn+We1aTBhaGa86AQ==
-----END PGP PRIVATE KEY BLOCK-----
=======
B07ND5BB8V

34A2344
13-08-1987
12345678902
1234567890
46 changes: 46 additions & 0 deletions pywhat/Data/regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,28 @@
"Bug Bounty"
]
},
{
"Name": "Turkish License Plate Number",
"Regex": "^(0[1-9]|[1-7][0-9]|8[01])(([A-Z])(\\d{4,5})|([A-Z]{2})(\\d{3,4})|([A-Z]{3})(\\d{2,3}))$",
"plural_name": false,
"Description": "The [#CAE4F1][link=https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Turkey]vehicle registration plate number of Turkey[/link][/#CAE4F1]",
"Rarity": 0.4,
"URL": null,
"Tags": [
"Identifiers"
]
},
{
"Name": "Date of Birth",
"Regex": "^([1-9]|[12][0-9]|3[01])(|\\/|\\.|\\-|\\s)?(0[1-9]|1[12])\\2(19[0-9]{2}|200[0-9]|201[0-8])$",
"plural_name": false,
"Description": null,
"Rarity": 0.4,
"URL": null,
"Tags": [
"Identifiers"
]
},
{
"Name": "Monero (XMR) Wallet Address",
"Regex": "(?i)^([48][0-9AB][1-9A-HJ-NP-Za-km-z]{93})$",
Expand Down Expand Up @@ -1537,6 +1559,30 @@
"UNIX Timestamp"
]
},
{
"Name": "Turkish Identification Number",
"Regex": "^([1-9]{1}[0-9]{9}[02468]{1})$",
"plural_name": false,
"Description": null,
"Rarity": 0.2,
"URL": null,
"Tags": [
"Credentials",
"Identifiers"
]
},
{
"Name": "Turkish Tax Number",
"Regex": "^([0-9]{10})$",
"plural_name": false,
"Description": null,
"Rarity": 0.1,
"URL": null,
"Tags": [
"Credentials",
"Identifiers"
]
},
{
"Name": "Key:Value Pair",
"Regex": "^([^:\\s]+[ ]?:[ ]?[^:\\s]+)$",
Expand Down
28 changes: 28 additions & 0 deletions tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,3 +562,31 @@ def test_pgp_private_key():
result = runner.invoke(main, ["-db", "fixtures/file"])
assert result.exit_code == 0
assert re.findall("PGP Private Key", str(result.output))


def test_file_fixture_turkish_car_plate():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))


def test_file_fixture_date_of_birth():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Date of Birth", str(result.output))


def test_file_fixture_turkish_id_number():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Identification Number", str(result.output))


def test_file_fixture_turkish_tax_number():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
65 changes: 65 additions & 0 deletions tests/test_regex_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,3 +801,68 @@ def test_new_relic_synthetics_api_key():
def test_new_relic_user_api_key():
res = r.check(["NRAK-WI4JTVS049IF5A3FGS5N51XS3Y5"])
_assert_match_first_item("New Relic User API Key", res)


def test_turkish_car_plate():
res = r.check(["34A2344"])
_assert_match_first_item("Turkish License Plate Number", res)


def test_turkish_car_plate2():
res = r.check(["34A23415"])
_assert_match_first_item("Turkish License Plate Number", res)


def test_turkish_car_plate3():
res = r.check(["06BK123"])
_assert_match_first_item("Turkish License Plate Number", res)


def test_turkish_car_plate4():
res = r.check(["06JK1234"])
_assert_match_first_item("Turkish License Plate Number", res)


def test_turkish_car_plate5():
res = r.check(["81ABC75"])
_assert_match_first_item("Turkish License Plate Number", res)


def test_date_of_birth():
res = r.check(["13.08.1987"])
_assert_match_first_item("Date of Birth", res)


def test_date_of_birth2():
res = r.check(["13081987"])
_assert_match_first_item("Date of Birth", res)


def test_date_of_birth3():
res = r.check(["13/08/1987"])
_assert_match_first_item("Date of Birth", res)


def test_date_of_birth4():
res = r.check(["13-08-1987"])
_assert_match_first_item("Date of Birth", res)


def test_date_of_birth5():
res = r.check(["13 08 1987"])
_assert_match_first_item("Date of Birth", res)


def test_turkish_id_number():
res = r.check(["12345678902"])
assert "Turkish Identification Number" in str(res)


def test_turkish_id_number2():
res = r.check(["12345678900"])
assert "Turkish Identification Number" in str(res)


def test_turkish_tax_number():
res = r.check(["1234567890"])
assert "Turkish Tax Number" in str(res)