"Virtual" interfaces not working · Issue #43 · robertdavidgraham/masscan
2018-06-22 01:33:01 Author: github.com(查看原文) 阅读量:1051 收藏

[MY SOLUTION]
I recently had this problem with a 'tap0' interface which was accessed by an OpenVPN client. Disabling the interface was not an option.

Original Error:
root@kali:~# masscan 10.1.1.0/24 -p 110 -e tap0
FAIL: failed to detect router for interface: "tap0"
[hint] try something like "--router-mac 66-55-44-33-22-11"

Verbose Original Error:
root@kali:~# masscan 10.1.1.0/24 -p 110 -e tap0 -vv
pfring: error: dlopen('libpfring.so'): No such file or directory
initializing adapter
auto-detected: adapter-ip=10.1.0.153
tap0: type=0x 1
auto-detected: adapter-mac=5*-**-**-**-**-**
pcap: libpcap version 1.7.4
pcap:'tap0': opening...
pcap:'tap0': successfully opened
rawsock: looking for default gateway
auto-detected: router-ip=0.0.0.0
arp: opcode=1, not reply(2)
^C

I stopped the output at "router-ip=0.0.0.0" since I knew 0.0.0.0 to be incorrect for my tap0 interface. Once I specified the correct gateway IP with "--router-ip", all was well. Here's how:

First, find the gateway IP for the interface you want masscan to use.

Finding Gateway IP for All Interfaces:
root@kali:~# ip route
default via 192.168.1.1 dev wlan0 proto static metric 600
10.1.0.0/16 dev tap0 proto kernel scope link src 10.1.0.153
10.31.31.0/24 via 10.1.0.1 dev tap0
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.10 metric 600

In my case, the gateway IP I needed for tap0 was "10.1.0.1", which is shown above as 10.31.31.0/24 via 10.1.0.1 dev tap0. Setting the "--router-ip" parameter value to "10.1.0.1" when calling masscan fixed the issue for me as shown:

Masscan Command Solution Example:
root@kali:~# masscan 10.1.1.0/24 -p 110 -e tap0 --router-ip 10.1.0.1
Starting masscan 1.0.3 (http://bit.ly/14GZzcT) at 2017-04-04 06:11:19 GMT
-- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
Initiating SYN Stealth Scan
Scanning 256 hosts [1 port/host]
Discovered open port 110/tcp on 10.1.1.30
Discovered open port 110/tcp on 10.1.1.140
Discovered open port 110/tcp on 10.1.1.128
Discovered open port 110/tcp on 10.1.1.76
Discovered open port 110/tcp on 10.1.1.215

So in short, the solution that worked for me was as simple as finding the IP address of the gateway for the interface I wanted masscan to use. Then, merely providing the gateway IP and desired interface using the "--router-ip" parameter for the gateway IP and the "-e" parameter for the desired interface. Generically, the command would look like this:

Generic Masscan Command Solution Example:
masscan <TARGET_IP_RANGE> -p <TARGET_PORT> -e <DESIRED_INTERFACE> --router-ip <GATEWAY_IP_OF_DESIRED_INTERFACE>


文章来源: https://github.com/robertdavidgraham/masscan/issues/43
如有侵权请联系:admin#unsafe.sh