Class: Aikido::Zen::Scanners::SSRF::DNSLookups

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/aikido/zen/scanners/ssrf/dns_lookups.rb

Overview

Simple per-request cache of all DNS lookups performed for a given host. We can store this in the context after performing a lookup, and have the SSRF scanner make sure the hostname being inspected doesn’t actually resolve to an internal/dangerous IP.

Instance Method Summary collapse

Constructor Details

#initializeDNSLookups

Returns a new instance of DNSLookups.



13
14
15
# File 'lib/aikido/zen/scanners/ssrf/dns_lookups.rb', line 13

def initialize
  super(Hash.new { |h, k| h[k] = [] })
end

Instance Method Details

#===(hostname) ⇒ Object



21
22
23
# File 'lib/aikido/zen/scanners/ssrf/dns_lookups.rb', line 21

def ===(hostname)
  key?(hostname)
end

#add(hostname, addresses) ⇒ Object



17
18
19
# File 'lib/aikido/zen/scanners/ssrf/dns_lookups.rb', line 17

def add(hostname, addresses)
  self[hostname].concat(Array(addresses))
end