Skip to content

Commit

Permalink
Fixes missing str conversion for murmur hashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
3c7 committed Jun 21, 2024
1 parent 919191f commit 98adb7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions common_osint_model/models/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def from_shodan(cls, d: Dict):
raw = d["http"]["favicon"]["data"]
raw = base64.b64decode(raw)
md5, sha1, sha256, murmur = hash_all(raw)
shodan_murmur = mmh3.hash(d["http"]["favicon"]["data"])
shodan_murmur = str(mmh3.hash(d["http"]["favicon"]["data"]))
cls.info(
"Shodan's favicon hash only hashes the base64 encoded favicon, not the data itself. The hash can be "
'found as "shodan_murmur" in this instance. "murmur" and the other hashes are calculated based on '
Expand All @@ -55,15 +55,18 @@ def from_shodan(cls, d: Dict):

@classmethod
def from_censys(cls, d: Dict):
"""Not supported by Censys right now."""
"""
Not supported by Censys right now.
TODO: Censys implemented Favicons.
"""
return None

@classmethod
def from_binaryedge(cls, d: Union[Dict, List]):
favicon = d["result"]["data"]["response"]["favicon"]["content"]
favicon_bytes = base64.b64decode(favicon.encode("utf-8"))
md5, sha1, sha256, murmur = hash_all(favicon_bytes)
shodan_murmur = mmh3.hash(favicon.encode("utf-8"))
shodan_murmur = str(mmh3.hash(favicon.encode("utf-8")))
return HTTPComponentContentFavicon(
raw=favicon,
md5=md5,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "common-osint-model"
version = "0.6.0-beta4"
version = "0.6.0-beta5"
description = "Converting data from services like BinaryEdge, Censys and Shodan to a common data model."
authors = ["3c7 <3c7@posteo.de>"]
license = "MIT"
Expand Down

0 comments on commit 98adb7f

Please sign in to comment.