Class: Mihari::Structs::Urlscan::Result
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::Urlscan::Result
- Defined in:
- lib/mihari/structs/urlscan.rb
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ String
- #metadata ⇒ Array<String, Integer>
- #page ⇒ Page
- #sort ⇒ Array<String, Integer>
- #to_artifacts ⇒ Array<Mihari::Artifact>
Class Method Details
.from_dynamic!(d) ⇒ Result
99 100 101 102 103 104 105 106 107 |
# File 'lib/mihari/structs/urlscan.rb', line 99 def from_dynamic!(d) d = Types::Hash[d] new( page: Page.from_dynamic!(d.fetch("page")), id: d.fetch("_id"), sort: d.fetch("sort"), metadata: d ) end |
Instance Method Details
#id ⇒ String
65 66 67 |
# File 'lib/mihari/structs/urlscan.rb', line 65 def id attributes[:id] end |
#metadata ⇒ Array<String, Integer>
79 80 81 |
# File 'lib/mihari/structs/urlscan.rb', line 79 def attributes[:metadata] end |
#page ⇒ Page
58 59 60 |
# File 'lib/mihari/structs/urlscan.rb', line 58 def page attributes[:page] end |
#sort ⇒ Array<String, Integer>
72 73 74 |
# File 'lib/mihari/structs/urlscan.rb', line 72 def sort attributes[:sort] end |
#to_artifacts ⇒ Array<Mihari::Artifact>
86 87 88 89 90 91 |
# File 'lib/mihari/structs/urlscan.rb', line 86 def to_artifacts values = [page.url, page.domain, page.ip].compact values.map do |value| Mihari::Artifact.new(data: value, metadata: ) end end |