Skip to content

Commit

Permalink
Merge pull request #124 from ninoseki/let-it-crash
Browse files Browse the repository at this point in the history
refactor: let it crash
  • Loading branch information
ninoseki committed Dec 19, 2019
2 parents f7b1fff + 72331c9 commit e8c6772
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 30 deletions.
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/circl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def lookup
else
raise InvalidInputError, "#{@query}(type: #{@type || 'unknown'}) is not supported."
end
rescue ::PassiveCIRCL::Error => _e
nil
end

def passive_dns_lookup
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/dnpedia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def lookup
rows.map do |row|
[row.dig("name"), row.dig("zoneid")].join(".")
end
rescue ::DNPedia::Error => _e
nil
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/dnstwister.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ def lookup
Parallel.map(domains) do |domain|
resolvable?(domain) ? domain : nil
end.compact
rescue ::DNSTwister::Error => _e
nil
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/passivetotal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def lookup
else
raise InvalidInputError, "#{query}(type: #{type || 'unknown'}) is not supported." unless valid_type?
end
rescue ::PassiveTotal::Error => _e
nil
end

def passive_dns_lookup
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/pulsedive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def lookup
(properties.dig("dns") || []).map do |property|
property.dig("value") if ["A", "PTR"].include?(property.dig("name"))
end.compact
rescue ::Pulsedive::ResponseError => _e
nil
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/securitytrails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def lookup
else
raise InvalidInputError, "#{query}(type: #{type || 'unknown'}) is not supported." unless valid_type?
end
rescue ::SecurityTrails::Error => _e
nil
end

def domain_lookup
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/securitytrails_domain_feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def lookup
new_domains.select do |domain|
regexp.match? domain
end
rescue ::SecurityTrails::Error => _e
nil
end

def new_domains
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/shodan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def api

def search_with_page(query, page: 1)
api.host.search(query, page: page)
rescue ::Shodan::Error => _e
nil
end

def search
Expand Down
2 changes: 0 additions & 2 deletions lib/mihari/analyzers/urlscan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def api

def search
api.search(query, size: 10_000)
rescue ::UrlScan::ResponseError => _e
nil
end

def valid_target_type?
Expand Down
14 changes: 2 additions & 12 deletions lib/mihari/analyzers/virustotal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@ def lookup
else
raise InvalidInputError, "#{indicator}(type: #{type || 'unknown'}) is not supported." unless valid_type?
end
rescue ::VirusTotal::Error => _e
nil
end

def domain_lookup
begin
res = api.domain.resolutions(indicator)
rescue ::VirusTotal::Error => _e
return nil
end
res = api.domain.resolutions(indicator)

data = res.dig("data") || []
data.map do |item|
Expand All @@ -68,11 +62,7 @@ def domain_lookup
end

def ip_lookup
begin
res = api.ip_address.resolutions(indicator)
rescue ::VirusTotal::Error => _e
return nil
end
res = api.ip_address.resolutions(indicator)

data = res.dig("data") || []
data.map do |item|
Expand Down

0 comments on commit e8c6772

Please sign in to comment.