Module: Aikido::Zen::Sinks::Socket::IPSocketExtensions
- Defined in:
- lib/aikido/zen/sinks/socket.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.scan_socket(hostname, socket) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aikido/zen/sinks/socket.rb', line 17 def self.scan_socket(hostname, socket) # ["AF_INET", 80, "10.0.0.1", "10.0.0.1"] addr_family, *, remote_address = socket.peeraddr # We only care about IPv4 (AF_INET) or IPv6 (AF_INET6) sockets # This might be overcautious, since this is _IP_Socket, so you # would expect it's only used for IP connections? return unless addr_family.start_with?("AF_INET") if (context = Aikido::Zen.current_context) context["dns.lookups"] ||= Aikido::Zen::Scanners::SSRF::DNSLookups.new context["dns.lookups"].add(hostname, remote_address) end SINK.scan( hostname: hostname, addresses: [remote_address], request: context && context["ssrf.request"], operation: "open" ) end |
Instance Method Details
#open(name) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/aikido/zen/sinks/socket.rb', line 39 def open(name, *) socket = super IPSocketExtensions.scan_socket(name, socket) socket end |