Skip to content
Closed
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
14 changes: 13 additions & 1 deletion pywhat/Data/regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,17 @@
"Password",
"Username"
]
}
},
{
"Name": "Media Access Control (MAC) Address",
"Regex": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}\\.[0-9a-fA-F]{4})$",
"plural_name": false,
"Description": null,
"Rarity": 0.2,
"URL": null,
"Tags": [
"Identifiers",
"Networking"
]
}
]
20 changes: 20 additions & 0 deletions tests/test_regex_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,23 @@ def test_arn4():
r = regex_identifier.RegexIdentifier()
res = r.check(["arn:aws:s3:::my_corporate_bucket/Development/*"])
assert "ARN" in str(res)


def test_mac1():
r = regex_identifier.RegexIdentifier()
res = r.check(["01-23-35-67-89-A6"])
print(res[0])
assert "Media Access Control Address" in res[0]["Regex Pattern"]["Name"]


def test_mac2():
r = regex_identifier.RegexIdentifier()
res = r.check(["01:23:35:67:89:A6"])
assert "Media Access Control Address" in res[0]["Regex Pattern"]["Name"]


def test_mac3():
r = regex_identifier.RegexIdentifier()
res = r.check(["0123.3567.89A6"])
assert "" in res[0]["Regex Pattern"]["Name"]
assert "Media Access Control Address" in res[1]["Regex Pattern"]["Name"]