Skip to content

Commit

Permalink
Update hostname parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jul 19, 2023
1 parent b58d5cf commit 2c87135
Show file tree
Hide file tree
Showing 24 changed files with 11,098 additions and 152 deletions.
2 changes: 2 additions & 0 deletions 03-dns-empirical/plot/plot_iot_data_cname.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def pseudonize_hostname(name):
'abcdX.example42.1.bg'
>>> pseudonize_hostname("test34.abcd123.example42.com")
'testX.abcdX.example42.com'
>>> pseudonize_hostname("kagoshima-6385.herokussl.com")
'kagoshima-X.herokussl.com'
"""
name = name.strip(".")
if (
Expand Down
6 changes: 6 additions & 0 deletions 03-dns-empirical/plot/plot_iot_data_hostname_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def extract_hostname(name):
else:
if tld.endswith("amazonaws.com"):
tld = "com"
elif tld == "awsdns-22.co.uk":
tld = "co.uk" # pragma: no cover
elif tld == "azurewebsites.net":
tld = "net"
elif tld == "cloudapp.net":
Expand All @@ -60,6 +62,10 @@ def extract_hostname(name):
tld = "net"
elif tld == "googleapis.com":
tld = "com"
elif tld == "herokussl.com":
tld = "com"
elif tld == "xs4all.nl":
tld = "nl" # pragma: no cover
etld_comps = tld.split(".")
name_comps = name.split(".")
hostname = ".".join(name_comps[: -(len(etld_comps) + 1)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"elasticbeanstalk.com",
"fastly.net",
"googleapis.com",
"herokussl.com",
],
)
def test_extract_hostname_tld_exceptions(tld_exception):
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit 2c87135

Please sign in to comment.