Revert "Squashed commit of the following:"

This reverts commit 71f5f22e79bdb44fffa14edd5d3ffa570efde8ed.
This commit is contained in:
patrik 2012-10-06 19:25:04 +00:00
parent 85c1ce9ce5
commit 2e5a448aa5
7 changed files with 68 additions and 52 deletions

View file

@ -66,8 +66,10 @@ Driver =
if ( not(status) and err:match("I HATE YOU") ) then
-- let's store the repositories in the registry so the brute
-- script can use them later.
self.host.registry.cvs_repos = self.host.registry.cvs_repos or {}
table.insert(self.host.registry.cvs_repos, password)
nmap.registry.cvs = nmap.registry.cvs or {}
nmap.registry.cvs[self.host.ip] = nmap.registry.cvs[self.host.ip] or {}
nmap.registry.cvs[self.host.ip].repos = nmap.registry.cvs[self.host.ip].repos or {}
table.insert(nmap.registry.cvs[self.host.ip].repos, password)
return true, brute.Account:new(username, password, 0)
end
return false, brute.Error:new( "Incorrect password" )

View file

@ -79,11 +79,14 @@ Driver =
local function getDiscoveredRepos(host)
if ( not(host.registry.cvs_repos)) then
if ( not(nmap.registry.cvs) or
not(nmap.registry.cvs[host.ip]) or
not(nmap.registry.cvs[host.ip].repos)
) then
return
end
return host.registry.cvs_repos
return nmap.registry.cvs[host.ip].repos
end
action = function(host, port)

View file

@ -80,22 +80,22 @@ action = function(host)
-- Get the list of NetBIOS names
status, names, statistics = netbios.do_nbstat(host)
status, names, statistics = netbios.do_nbstat(host)
status, names, statistics = netbios.do_nbstat(host)
status, names, statistics = netbios.do_nbstat(host)
status, names, statistics = netbios.do_nbstat(host.ip)
status, names, statistics = netbios.do_nbstat(host.ip)
status, names, statistics = netbios.do_nbstat(host.ip)
status, names, statistics = netbios.do_nbstat(host.ip)
if(status == false) then
return stdnse.format_output(false, names)
end
-- Get the server name
status, server_name = netbios.get_server_name(host, names)
status, server_name = netbios.get_server_name(host.ip, names)
if(status == false) then
return stdnse.format_output(false, server_name)
end
-- Get the logged in user
status, user_name = netbios.get_user_name(host, names)
status, user_name = netbios.get_user_name(host.ip, names)
if(status == false) then
return stdnse.format_output(false, user_name)
end

View file

@ -261,7 +261,10 @@ end
-- Sets necessary probe data in registry
local setreg = function(host, proto, port)
host.registry['pathmtuprobe'] = {
if not nmap.registry[host.ip] then
nmap.registry[host.ip] = {}
end
nmap.registry[host.ip]['pathmtuprobe'] = {
['proto'] = proto,
['port'] = port
}
@ -298,8 +301,8 @@ action = function(host)
local mtuset
local sock = nmap.new_dnet()
local pcap = nmap.new_socket()
local proto = host.registry['pathmtuprobe']['proto']
local port = host.registry['pathmtuprobe']['port']
local proto = nmap.registry[host.ip]['pathmtuprobe']['proto']
local port = nmap.registry[host.ip]['pathmtuprobe']['port']
local saddr = packet.toip(host.bin_ip_src)
local daddr = packet.toip(host.bin_ip)
local try = nmap.new_try()

View file

@ -45,7 +45,6 @@ dependencies = {"snmp-brute"}
-- Revised 04/11/2010 - v0.2 - moved snmp_walk to snmp library <patrik@cqure.net>
-- Revised 08/10/2010 - v0.3 - prerule; add interface addresses to Nmap's target list (Kris Katterjohn)
-- Revised 05/27/2011 - v0.4 - action; add MAC addresses to nmap.registry[host.ip]["mac-geolocation"] (Gorjan Petrovski)
-- Revised 07/31/2012 - v0.5 - action; remove mac-geolocation changes (script removed from trunk)
@ -420,6 +419,14 @@ action = function(host, port)
srvport = port.number
end
-- table for mac-geolocation.nse
if not nmap.registry[srvhost] then
nmap.registry[srvhost] = {}
nmap.registry[srvhost]["mac-geolocation"] = {}
elseif not nmap.registry[srvhost]["mac-geolocation"] then
nmap.registry[srvhost]["mac-geolocation"] = {}
end
socket:set_timeout(5000)
try(socket:connect(srvhost, srvport, "udp"))
@ -446,6 +453,14 @@ action = function(host, port)
end
local output = stdnse.format_output( true, build_results(interfaces) )
-- insert the MAC addresses into the mac-geolocation table
for _,item in ipairs(interfaces) do
if item.phys_addr then
table.insert(nmap.registry[srvhost]["mac-geolocation"], item.phys_addr:match("^(%x+:%x+:%x+:%x+:%x+:%x+)"))
end
end
-- wtf is this? table.insert(nmap.registry[srvhost]["mac-geolocation"], "00:23:69:2a:b1:27")
if SCRIPT_TYPE == "prerule" and target.ALLOW_NEW_TARGETS then
local sum = 0