urbanadventurer / WhatWeb

Next generation web scanner
https://www.morningstarsecurity.com/research/whatweb
GNU General Public License v2.0
5.2k stars 885 forks source link

adds ability to specify bind address #303

Closed audibleblink closed 3 years ago

audibleblink commented 4 years ago

Attempt at implementing #302

urbanadventurer commented 3 years ago

@audibleblink first of all, thanks 🙇 for this pull request. It's a good idea 💡

Before I'm ready to merge it, I want to discuss some options with you and @bcoles.

Do we want to let the user select the bind address, the hostname, the interface, or all three?

@audibleblink 's pull request lets someone select the IP address.

I'm in favour of interface or bind address, assuming the former will be more popular.

Some examples from other popular tools are:

The local port

The $local_port gets set to 61000. Why did you set this and did it cause problems if left as nil? The ideal situation would be for the local port to be whatever the OS chooses, even when selecting an interface or bind IP address.

    when '-b', '--bind'
      $local_host = arg
      $local_port = 61000

Should we allow the user to select the local port?

This could be useful for bypassing mis-configured firewalls.

nmap -g/--source-port <portnum>: Use given port number

ncat -p, --source-port port Specify source port to use

Note -- to get interfaces and IP addresses

require 'socket'
Socket.ip_address_list
bcoles commented 3 years ago

I like this idea.

Before I'm ready to merge it, I want to discuss some options with you and @bcoles.

In regards to command line convention, I'm in favor of -I / --interface if the interfacecan be specified by name (ie, eth0).

If using the adapter name isn't easy/possible, then --bind or --source seem more appropriate, as these imply an address.

The $local_port gets set to 61000. Why did you set this and did it cause problems if left as nil?

I, too, would like to see the hard-coded port removed, if possible.

urbanadventurer commented 3 years ago

@bcoles and @audibleblink I'm working on it on the bind-interface branch.

Currently working on the interface validation

urbanadventurer commented 3 years ago

Hi @audibleblink, did this patch work for you, and if so what OS are you using?

audibleblink commented 3 years ago

hey all. thanks for looking at this. currently dealing with a 3 day power outage, a newborn, and in-laws. will be a bit before I can add anything here.

urbanadventurer commented 3 years ago
image

--interface tests under Linux successfully send the traffic through the correct network interface.

urbanadventurer commented 3 years ago
image

--interface tests under macOS fail. Everything "just works"

urbanadventurer commented 3 years ago
image

--source-port under Linux with 1 thread, fails with source port reuse problems.

urbanadventurer commented 3 years ago
image

--source-port under Linux even fails with source port reuse problems, even when using --wait

urbanadventurer commented 3 years ago
image

--source-port under macOS fails with source port reuse problems.

urbanadventurer commented 3 years ago
image image

--source-port under Linux only works when --source-address (or --interface) is also specified.