與 IPv4 一起使用時出現奇怪的錯誤“(22 - '無效參數')”

與 IPv4 一起使用時出現奇怪的錯誤“(22 - '無效參數')”

我有“(22 - '無效參數')”使用nmap.我用谷歌搜尋並得到了https://seclists.org/nmap-dev/,但那是在討論 IPv6,而我在使用 IPv4 時遇到了這個錯誤。它沒有提到 IPv4,那為什麼我會收到這個奇怪的錯誤呢?

我進入了:

$ nmap --send-eth --release-memory --nsock-engine=epoll --allports --fuzzy \
     --randomize-hosts --log-errors  --max-os-tries=9 -n --reason          \
     --append-output --scanflags=URGACKPSHRSTSYNFIN --max-retries=6        \
     --host-timeout=225s --stats-every=10m --ttl=255 --min-hostgroup=5 .   \
     --max-hostgroup=25 --max-rtt-timeout=60s --scan-delay=250ms .         \
     --max-scan-delay=25s --stats-every=1 -v5 -sT -sV -A -p 80-82          \
     0.18.0.0

並得到這個結果:

Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-17 16:05 CET
NSE: Loaded 148 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 2) scan.
Initiating NSE at 16:05
Completed NSE at 16:05, 0.00s elapsed
NSE: Starting runlevel 2 (of 2) scan.
Initiating NSE at 16:05
Completed NSE at 16:05, 0.00s elapsed
Initiating Ping Scan at 16:05
Scanning 0.18.0.0 [2 ports]
Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing Ping Scan
Ping Scan Timing: About 0.00% done
Strange read error from 0.18.0.0 (22 - 'Invalid argument')
Strange read error from 0.18.0.0 (22 - 'Invalid argument')
Completed Ping Scan at 16:05, 0.50s elapsed (1 total hosts)
NSE: Script Post-scanning.
NSE: Starting runlevel 1 (of 2) scan.
Initiating NSE at 16:05
Completed NSE at 16:05, 0.00s elapsed
NSE: Starting runlevel 2 (of 2) scan.
Initiating NSE at 16:05
Completed NSE at 16:05, 0.00s elapsed
Read data files from: /usr/bin/../share/nmap
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.46 seconds

當嘗試使用更少的參數時nmap -p 80-82 0.18.0.0 得到:

Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-17 16:24 CET
Strange read error from 0.18.0.0 (22 - 'Invalid argument')
Strange read error from 0.18.0.0 (22 - 'Invalid argument')
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.12 seconds

當我嘗試時ncat得到:

$ nc -vvv 0.18.0.0 80
0.18.0.0: inverse host lookup failed: Unknown host
(UNKNOWN) [0.18.0.0] 80 (http) : Invalid argument
 sent 0, rcvd 0

$ nc -vvv 0.18.0.0 81
0.18.0.0: inverse host lookup failed: Unknown host
(UNKNOWN) [0.18.0.0] 81 (hosts2-ns) : Invalid argument
 sent 0, rcvd 0

我仍然有“無效參數”,但這次我得到的是郵政號碼和服務,而不是 22:

80 (http)
81 (hosts2-ns)

這提出了幾個問題:

  1. ncat和的「無效論證」是否nmap與同一件事有關?
  2. 我怎樣才能提供nmap資訊而不是列印 22?
  3. 我怎麼能說遠端連接埠確實是關閉的,還是真的是開放的並且由於防火牆而拒絕?

答案1

地址0.18.0.0(分別。0.0.0.0/8) 不允許作為標準™ 的目標 IP 位址:

RFC 6890

2.2.2. IPv4 特殊用途位址註冊表項


下面的表 1 至表 16 代表了 IANA最初填入 IPv4 特殊用途位址登錄的條目。

          +----------------------+----------------------------+
          | Attribute            | Value                      |
          +----------------------+----------------------------+
          | Address Block        | 0.0.0.0/8                  |
          | Name                 | "This host on this network"|
          | RFC                  | [RFC1122], Section 3.2.1.3 |
          | Allocation Date      | September 1981             |
          | Termination Date     | N/A                        |
          | Source               | True                       |
          | Destination          | False                      |
          | Forwardable          | False                      |
          | Global               | False                      |
          | Reserved-by-Protocol | True                       |
          +----------------------+----------------------------+

                Table 1: "This host on this network"

因此0.0.0.0/8因此0.18.0.0沒有有效的目標位址,因此核心傳回EINVALID嘗試將其用作目標的套接字操作。

提示:您可能想使用RFC 1918您本地管理的網路的位址。

相關內容