Skip to content

Commit 69786ae

Browse files
authored
Merge pull request #190 from PabloLec/main
Add TOTP URIs
2 parents 07f167c + c7418ff commit 69786ae

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

fixtures/file

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,6 @@ nano_1c46rz7xnk98ozhzdjq7thwty844sgnqxk9496yysit1bnio1rcdzshc5ymn
9191

9292
b2ced6f5-2542-4f7d-b131-e3ada95d8b75
9393
5fc7c33a7ef88b139122a38a
94-
01ERJ58HMWDN3VTRRHZQV2T5R5
94+
01ERJ58HMWDN3VTRRHZQV2T5R5
95+
96+
otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example

pywhat/Data/regex.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,19 @@
971971
"Nano"
972972
]
973973
},
974+
{
975+
"Name": "Time-Based One-Time Password (TOTP) URI",
976+
"Regex": "^([^?\\n]+:\/\/totp\/[^\\n]+secret=[A-Z2-7=]+[^\\n]+)$",
977+
"plural_name": false,
978+
"Description": null,
979+
"Rarity": 1,
980+
"URL": null,
981+
"Tags": [
982+
"Credentials",
983+
"TOTP",
984+
"Bug Bounty"
985+
]
986+
},
974987
{
975988
"Name": "Google Cloud Platform API Key",
976989
"Regex": "(?i)^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",

tests/test_click.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,3 +618,10 @@ def test_file_fixture_ulid():
618618
result = runner.invoke(main, ["fixtures/file"])
619619
assert result.exit_code == 0
620620
assert re.findall("ULID", str(result.output))
621+
622+
623+
def test_file_fixture_totp_URI():
624+
runner = CliRunner()
625+
result = runner.invoke(main, ["fixtures/file"])
626+
assert result.exit_code == 0
627+
assert re.findall("Time-Based One-Time Password [(]TOTP[)] URI", str(result.output))

tests/test_regex_identifier.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,21 @@ def test_objectid():
10131013
def test_ulid():
10141014
res = r.check(["01ERJ58HMWDN3VTRRHZQV2T5R5"])
10151015
assert "ULID" in str(res)
1016+
1017+
1018+
def test_totp_URI():
1019+
res = r.check(
1020+
[
1021+
"otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
1022+
]
1023+
)
1024+
_assert_match_first_item("Time-Based One-Time Password (TOTP) URI", res)
1025+
1026+
1027+
def test_complex_totp_URI():
1028+
res = r.check(
1029+
[
1030+
"otpauth://totp/My_Ex0T1c-L00king.name?issuer=ArgsShouldBeCommutable&secret=JBSWY3DPEHPK3PXP&digits=6&period=30"
1031+
]
1032+
)
1033+
_assert_match_first_item("Time-Based One-Time Password (TOTP) URI", res)

0 commit comments

Comments
 (0)