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

Fixed AWS SNS and Google Calendar regexes and added tests for them #176

Merged
merged 2 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions pywhat/Data/regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
},
{
"Name": "Google Calendar URI",
"Regex": "(?i)^(https://www\\.google\\.com/calendar/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+)$",
"Regex": "(?i)^(https:\/\/calendar.google.com\/calendar\/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+)$",
"plural_name": false,
"Description": null,
"Exploit": null,
Expand Down Expand Up @@ -855,7 +855,7 @@
},
{
"Name": "Amazon SNS Topic",
"Regex": "(?i)^(arn:aws:sns:[a-z0-9-]+:[0-9]+:[A-Za-z0-9-_]{128})$",
"Regex": "(?i)^((arn:aws:sns:)[a-z0-9-]+:[0-9]+:[A-Za-z0-9-_]{1,128})$",
"plural_name": false,
"Description": null,
"Exploit": null,
Expand Down
14 changes: 14 additions & 0 deletions tests/test_regex_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,11 @@ def test_aws_org_id():
assert "Amazon Web Services Organization identifier" in str(res)


def test_aws_sns():
res = r.check(["arn:aws:sns:us-east-2:123456789012:MyTopic"])
assert "Amazon SNS Topic" in str(res)


def test_asin():
res = r.check(["B07ND5BB8V"])
_assert_match_first_item("Amazon Standard Identification Number (ASIN)", res)
Expand All @@ -620,6 +625,15 @@ def test_google_oauth_token():
_assert_match_first_item("Google OAuth Token", res)


def test_google_cal():
res = r.check(
[
"https://calendar.google.com/calendar/embed?src=ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com&ctz=Europe%2FLondon"
]
)
assert "Google Calendar URI" in str(res)


def test_aws_access_key_id():
res = r.check(["AKIA31OMZKYAARWZ3ERH"])
_assert_match_first_item("Amazon Web Services Access Key", res)
Expand Down