Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
3c7 committed Jul 15, 2023
2 parents 1a7c44b + d4af246 commit d0f67b4
Show file tree
Hide file tree
Showing 5 changed files with 4,104 additions and 93 deletions.
10 changes: 7 additions & 3 deletions common_osint_model/models/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import mmh3
from pydantic import BaseModel
from hhhash import hash_from_banner

from common_osint_model.models import ShodanDataHandler, CensysDataHandler, BinaryEdgeDataHandler, Logger
from common_osint_model.utils import hash_all
Expand Down Expand Up @@ -111,7 +112,7 @@ def from_shodan(cls, d: Dict):

raw = d["http"]["securitytxt"].encode("utf-8")
md5, sha1, sha256, murmur = hash_all(raw)
return HTTPComponentContentRobots(
return HTTPComponentContentSecurity(
raw=raw,
md5=md5,
sha1=sha1,
Expand Down Expand Up @@ -219,6 +220,7 @@ class HTTPComponent(BaseModel, ShodanDataHandler, CensysDataHandler, BinaryEdgeD
headers: Optional[Dict[str, str]]
content: Optional[HTTPComponentContent]
shodan_headers_hash: Optional[str]
hhhash: Optional[str]

@classmethod
def from_shodan(cls, d: Dict):
Expand All @@ -240,7 +242,8 @@ def from_shodan(cls, d: Dict):
return HTTPComponent(
headers=headers,
content=content,
shodan_headers_hash=d.get("http", {}).get("headers_hash", None)
shodan_headers_hash=d.get("http", {}).get("headers_hash", None),
hhhash=hash_from_banner(banner)
)

@classmethod
Expand All @@ -267,7 +270,8 @@ def from_censys(cls, d: Dict):
return HTTPComponent(
headers=headers,
content=HTTPComponentContent.from_censys(d),
shodan_headers_hash=headers_hash
shodan_headers_hash=headers_hash,
hhhash=hash_from_banner(d["banner"])
)

@classmethod
Expand Down
Loading

0 comments on commit d0f67b4

Please sign in to comment.