Nmap Development mailing list archives

[NSE] lua 'host' table has wrong ip_src of virtual interface


From: Victor Rudnev <victor.rudnev () gmail com>
Date: Mon, 7 Jun 2010 14:11:47 +0300

Hi All

Since 5.30 I noticed that I cannot reach original ip address of virtual
interface in lua 'host' table when I'm doing a scan. It looks like a bug.


Side A:                                    SideB:
eth0 192.168.1.20/24               eth0 192.168.0.4/24
eth0:1 192.168.0.5/24

test.nse
--------------------------------------
description = "Test"

require"shortport"
require"packet"

categories = {}
portrule = shortport.port_or_service ("22",{"ssh"},{"tcp"},{"open"})

action = function(host, port)
local t = {}

t[#t+1] = "Address: " .. packet.toip (host.bin_ip_src)
t[#t+1] = "Interface: " .. host.interface

return " \n" .. table.concat(t, "\n")
end
--------------------------

lets' make tests
# nmap --script ./test.nse -n -sT --open -p 22 192.168.0.4

Starting Nmap 5.30BETA1 ( http://nmap.org ) at 2010-06-07 13:55 EEST
Nmap scan report for 192.168.0.4
Host is up (0.0012s latency).
PORT   STATE SERVICE
22/tcp open  ssh
| test:
| Address: 192.168.1.20
|_Interface: eth0
MAC Address: 00:15:F2:E0:7A:ED (Asustek Computer)


# nmap --script ./test.nse -n -sT --open -p 22 192.168.0.4

Starting Nmap 5.21 ( http://nmap.org ) at 2010-06-07 13:56 EEST
NSE: Script Scanning completed.
Nmap scan report for 192.168.0.4
Host is up (0.0016s latency).
PORT   STATE SERVICE
22/tcp open  ssh
| test:
| Address: 192.168.0.5
|_Interface: eth0
MAC Address: 00:15:F2:E0:7A:ED (Asustek Computer)


Regards, Victor
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: