Skip to content

Commit

Permalink
Merge pull request #121 from obsidianforensics/hsts-hash-cookie-domains
Browse files Browse the repository at this point in the history
Update built list of HSTS `host` hashes to include domains from cookies
  • Loading branch information
obsidianforensics authored Dec 19, 2021
2 parents 43cc007 + 10f36ba commit 1e2c424
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyhindsight/browsers/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,14 @@ def build_hsts_domain_hashes(self):
domains = set()
for artifact in self.parsed_artifacts:
if isinstance(artifact, self.HistoryItem):
domain = urllib.parse.urlparse(artifact.url).hostname
artifact_url = artifact.url

# Cookie artifact's "URLs" will be in the form ".example.com",
# which won't parse, so modify it so it will
if artifact_url.startswith('.'):
artifact_url = 'http://' + artifact_url[1:]

domain = urllib.parse.urlparse(artifact_url).hostname
# Some URLs don't have a domain, like local PDF files
if domain:
domains.add(domain)
Expand Down

0 comments on commit 1e2c424

Please sign in to comment.