1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-06 13:36:36 +00:00

NSE snmp manually rebase #122 provided patch

This commit is contained in:
gio
2015-06-13 17:58:49 +00:00
parent bf22689ef7
commit 308c213099
12 changed files with 214 additions and 226 deletions

View File

@@ -136,6 +136,24 @@ function decode(encStr, pos)
return decoder:decode( encStr, pos )
end
---
-- Get the best community string for a host
-- Tries the following in order:
-- * host.registry.snmpcommunity
-- * snmpcommunity script-arg
-- * The fallback parameter
-- * "public"
-- @param host The host table to check.
-- @param fallback An alternate default to use instead of "public"
-- @return The best-guess SNMP community string to use
function best_community(host, fallback)
if host and host.registry and host.registry.snmpcommunity then
return host.registry.snmpcommunity
else
return nmap.registry.args.snmpcommunity or fallback or "public"
end
end
---
-- Create an SNMP packet.
-- @param PDU SNMP Protocol Data Unit to be encapsulated in the packet.
@@ -143,10 +161,7 @@ end
-- @param commStr community string, if not already supplied in registry or as
-- the <code>snmpcommunity</code> script argument.
function buildPacket(PDU, version, commStr)
local comm = nmap.registry.args.snmpcommunity
if (not comm) then comm = nmap.registry.snmpcommunity end
if (not comm) then comm = commStr end
if (not comm) then comm = "public" end
local comm = commStr or best_community()
if (not version) then version = 0 end
local packet = {}
@@ -156,13 +171,17 @@ function buildPacket(PDU, version, commStr)
return packet
end
--- SNMP options table
-- @class table
-- @name snmp.options
-- @field reqId Request ID.
-- @field err Error.
-- @field errIdx Error index.
---
-- Create an SNMP Get Request PDU.
-- @param options A table containing the following fields:
-- * <code>"reqId"</code>: Request ID.
-- * <code>"err"</code>: Error.
-- * <code>"errIdx"</code>: Error index.
-- @param options SNMP options table
-- @see snmp.options
-- @param ... Object identifiers to be queried.
-- @return Table representing PDU.
function buildGetRequest(options, ...)
@@ -194,10 +213,8 @@ end
---
-- Create an SNMP Get Next Request PDU.
-- @param options A table containing the following fields:
-- * <code>"reqId"</code>: Request ID.
-- * <code>"err"</code>: Error.
-- * <code>"errIdx"</code>: Error index.
-- @param options SNMP options table
-- @see snmp.options
-- @param ... Object identifiers to be queried.
-- @return Table representing PDU.
function buildGetNextRequest(options, ...)
@@ -230,10 +247,8 @@ end
-- Create an SNMP Set Request PDU.
--
-- Takes one OID/value pair or an already prepared table.
-- @param options A table containing the following keys and values:
-- * <code>"reqId"</code>: Request ID.
-- * <code>"err"</code>: Error.
-- * <code>"errIdx"</code>: Error index.
-- @param options SNMP options table
-- @see snmp.options
-- @param oid Object identifiers of object to be set.
-- @param value To which value object should be set. If given a table, use the
-- table instead of OID/value pair.
@@ -299,10 +314,8 @@ end
-- Create an SNMP Get Response PDU.
--
-- Takes one OID/value pair or an already prepared table.
-- @param options A table containing the following keys and values:
-- * <code>"reqId"</code>: Request ID.
-- * <code>"err"</code>: Error.
-- * <code>"errIdx"</code>: Error index.
-- @param options SNMP options table
-- @see snmp.options
-- @param oid Object identifiers of object to be sent back.
-- @param value If given a table, use the table instead of OID/value pair.
-- @return Table representing PDU.
@@ -445,59 +458,143 @@ function fetchFirst(response)
end
--- Walks the MIB Tree
--- SNMP Helper class
--
-- @param socket socket already connected to the server
-- @param base_oid string containing the base object ID to walk
-- @return status true on success, false on failure
-- @return table containing <code>oid</code> and <code>value</code>
function snmpWalk( socket, base_oid )
-- Handles socket communication, parsing, and setting of community strings
Helper = {
local snmp_table = {}
local oid = base_oid
local status, err, payload
--- Creates a new Helper instance
--
-- @param host string containing the host name or ip
-- @param port number containing the port to connect to
-- @param options A table with appropriate options:
-- * timeout - the timeout in milliseconds (Default: 5000)
-- * version - the SNMP version code (Default: 0 (SNMP V1))
-- @return o a new instance of Helper
new = function( self, host, port, options )
local o = {}
setmetatable(o, self)
self.__index = self
o.host = host
o.port = port
o.options = options or {
timeout = 5000,
version = 0
}
return o
end,
while ( true ) do
--- Connect to the server
-- For UDP ports, this doesn't send any packets, but it creates the
-- socket and locks in the timeout.
-- @return status true on success, false on failure
connect = function( self )
self.socket = nmap.new_socket()
self.socket:set_timeout(self.timeout)
local status, err = self.socket:connect(self.host, self.port)
if ( not(status) ) then return false, err end
local value, response, snmpdata, options, item = nil, nil, nil, {}, {}
payload = encode( buildPacket( buildGetNextRequest(options, oid) ) )
return true
end,
status, err = socket:send(payload)
if ( not( status ) ) then
stdnse.debug1("snmp.snmpWalk: Send failed")
return false, err
end
--- Communications helper
-- Sends an SNMP message and receives a response.
-- @param message the result of one of the build*Request functions
-- @return status False if there was an error, true otherwise.
-- @return response The raw response read from the socket.
request = function (self, message)
local payload = encode( buildPacket(
message,
self.version,
self.community or self.host.registry.snmpcommunity
) )
status, response = socket:receive_bytes(1)
if ( not( status ) ) then
-- Unless we have a useful error message, don't report it
if ( response ~= "ERROR" ) then
stdnse.debug1("snmp.snmpWalk: Received no answer (%s)", response)
return false, response
local status, err = self.socket:send(payload)
if not status then
stdnse.debug2("snmp.Helper.request: Send to %s failed: %s", self.host.ip, err)
return false, err
end
return false, nil
local response
status, response = self.socket:receive_bytes(1)
end,
--- Sends an SNMP Get Next request
-- @param options SNMP options table
-- @see snmp.options
-- @param ... Object identifiers to be queried.
-- @return status False if error, true otherwise
-- @return Table with all decoded responses and their OIDs.
getnext = function (self, options, ...)
local status, response = self:request(buildGetNextRequest(options or {}, ...))
if not status then
return status, response
end
return status, fetchResponseValues(response)
end,
--- Sends an SNMP Get request
-- @param options SNMP options table
-- @see snmp.options
-- @param ... Object identifiers to be queried.
-- @return status False if error, true otherwise
-- @return Table with all decoded responses and their OIDs.
get = function (self, options, ...)
local status, response = self:request(buildGetRequest(options or {}, ...))
if not status then
return status, response
end
return status, fetchResponseValues(response)
end,
--- Sends an SNMP Set request
-- @param options SNMP options table
-- @see snmp.options
-- @param oid Object identifiers of object to be set.
-- @param value To which value object should be set. If given a table,
-- use the table instead of OID/value pair.
-- @return status False if error, true otherwise
-- @return Table with all decoded responses and their OIDs.
set = function (self, options, oid, setparam)
local status, response = self:request(buildSetRequest(options or {}, oid, setparam))
if not status then
return status, response
end
return status, fetchResponseValues(response)
end,
--- Walks the MIB Tree
--
-- @param base_oid string containing the base object ID to walk
-- @return status true on success, false on failure
-- @return table containing <code>oid</code> and <code>value</code>
walk = function (self, base_oid)
local snmp_table = {}
local oid = base_oid
local options = {}
while ( true ) do
local status, response = self:getnext(options, oid)
local snmpdata = fetchResponseValues( response )
local value = snmpdata[1][1]
oid = snmpdata[1][2]
if not oid:match( base_oid ) or base_oid == oid then
break
end
table.insert(snmp_table, { oid = oid, value = value })
end
snmpdata = fetchResponseValues( response )
snmp_table.baseoid = base_oid
value = snmpdata[1][1]
oid = snmpdata[1][2]
if not oid:match( base_oid ) or base_oid == oid then
break
end
item.oid = oid
item.value = value
table.insert( snmp_table, item )
return true, snmp_table
end
snmp_table.baseoid = base_oid
return true, snmp_table
end
}
return _ENV;

View File

@@ -34,6 +34,8 @@ No output is reported if no valid account is found.
-- 2011-12-29 Patrik Karlsson - Added lport to sniff_snmp_responses to fix
-- bug preventing multiple scripts from working
-- properly.
-- 2015-05-31 Gioacchino Mazzurco - Add IPv6 support by making the script IP
-- version agnostic
---
-- @usage
@@ -273,9 +275,9 @@ action = function(host, port)
local account = creds_iter()
if account then
if account.pass == "<empty>" then
nmap.registry.snmpcommunity = ""
host.registry.snmpcommunity = ""
else
nmap.registry.snmpcommunity = account.pass
host.registry.snmpcommunity = account.pass
end
end
end

View File

@@ -122,27 +122,18 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local data, oldsnmpoid = nil, "1.3.6.1.4.1.2011.10.2.12.1.1.1"
local data, newsnmpoid = nil, "1.3.6.1.4.1.25506.2.12.1.1.1"
local users = {}
local status
local oldsnmpoid = "1.3.6.1.4.1.2011.10.2.12.1.1.1"
local newsnmpoid = "1.3.6.1.4.1.25506.2.12.1.1.1"
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, users = snmp.snmpWalk( socket, oldsnmpoid )
socket:close()
local status, users = snmpHelper:walk( oldsnmpoid )
if (not(status)) or ( users == nil ) or ( #users == 0 ) then
-- no status? try new snmp oid
socket:set_timeout(5000)
try(socket:connect(host, port))
status, users = snmp.snmpWalk( socket, newsnmpoid )
socket:close()
status, users = snmpHelper:walk( newsnmpoid )
if (not(status)) or ( users == nil ) or ( #users == 0 ) then
return users

View File

@@ -390,9 +390,6 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
-- IF-MIB - used to look up network interfaces
local if_oid = "1.3.6.1.2.1.2.2.1"
-- IP-MIB - used to determine IP address information
@@ -411,21 +408,20 @@ action = function(host, port)
srvport = stdnse.get_script_args({"snmp-interfaces.port", "port"})
if srvport then
srvport = tonumber(srvport)
srvport = { number=tonumber(srvport), protocol="udp" }
else
srvport = 161
srvport = { number=tonumber(srvport), protocol="udp" }
end
else
srvhost = host.ip
srvport = port.number
end
socket:set_timeout(5000)
try(socket:connect(srvhost, srvport, "udp"))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
-- retrieve network interface information from IF-MIB
status, interfaces = snmp.snmpWalk( socket, if_oid )
socket:close()
status, interfaces = snmpHelper:walk(if_oid)
if (not(status)) or ( interfaces == nil ) or ( #interfaces == 0 ) then
return
@@ -437,8 +433,7 @@ action = function(host, port)
interfaces = process_interfaces( interfaces )
-- retrieve IP address information from IP-MIB
try(socket:connect(srvhost, srvport, "udp"))
status, ips = snmp.snmpWalk( socket, ip_oid )
status, ips = snmpHelper:walk( ip_oid )
-- associate that IP address information with the correct interface
if (not(status)) or ( ips ~= nil ) and ( #ips ~= 0 ) then

View File

@@ -46,24 +46,6 @@ dependencies = {"snmp-brute"}
portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
local try
local function sendrequest(socket, oid, setparam)
local payload
local options = {}
options.reqId = 28428 -- unnecessary?
payload = snmp.encode(snmp.buildPacket(snmp.buildSetRequest(options, oid,setparam)))
try(socket:send(payload))
-- read in any response we might get
local status, response = socket:receive()
if ( not(status) ) then return status, response end
local result = snmp.fetchFirst(response)
return true
end
---
-- Sends SNMP packets to host and reads responses
action = function(host, port)
@@ -74,20 +56,10 @@ action = function(host, port)
return "ERROR: tftproot needs to end with slash"
end
-- create the socket used for our connection
local socket = nmap.new_socket()
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
-- set a reasonable timeout value
socket:set_timeout(5000)
-- do some exception handling / cleanup
local catch = function() socket:close() end
try = nmap.new_try(catch)
-- connect to the potential SNMP system
try(socket:connect(host, port))
local status, tftpserver, _, _, _ = socket:get_info()
local status, tftpserver, _, _, _ = snmpHelper.socket:get_info()
if( not(status) ) then
return "ERROR: Failed to determine local ip"
end
@@ -95,7 +67,7 @@ action = function(host, port)
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.2.9999 (ConfigCopyProtocol is set to TFTP [1] )
local request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.2.9999",1)
local request = snmpHelper:set({reqiId=28428},".1.3.6.1.4.1.9.9.96.1.1.1.1.2.9999",1)
-- Fail silently if the first request doesn't get a proper response
if ( not(request) ) then return end
@@ -107,13 +79,13 @@ action = function(host, port)
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.3 (SourceFileType is set to running-config [4] )
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.3.9999",4)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.3.9999",4)
-------------------------------------------------
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.4 (DestinationFileType is set to networkfile [1] )
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.4.9999",1)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.4.9999",1)
-------------------------------------------------
-- build a SNMP v1 packet
@@ -125,7 +97,7 @@ action = function(host, port)
table.insert(tbl, octet)
end
request = sendrequest(socket, nil, { { snmp.str2oid(".1.3.6.1.4.1.9.9.96.1.1.1.1.5.9999"), tbl } } )
request = snmpHelper:set({reqId=28428}, nil, { { snmp.str2oid(".1.3.6.1.4.1.9.9.96.1.1.1.1.5.9999"), tbl } } )
-- request = sendrequest(".1.3.6.1.4.1.9.9.96.1.1.1.1.5.9999",tftpserver)
@@ -134,26 +106,26 @@ action = function(host, port)
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.15 (ServerAddressType is set 1 for ipv4 )
-- more options - 1:ipv4, 2:ipv6, 3:ipv4z, 4:ipv6z, 16:dns
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.15.9999",1)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.15.9999",1)
-------------------------------------------------
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.16 (ServerAddress is set to the IP address of the TFTP server )
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.16.9999",tftpserver)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.16.9999",tftpserver)
-------------------------------------------------
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.6 (CopyFilename is set to IP-config)
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.6.9999",host.ip .. "-config")
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.6.9999",host.ip .. "-config")
-------------------------------------------------
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.14 (Start copying by setting CopyStatus to active [1])
-- more options: 1:active, 2:notInService, 3:notReady, 4:createAndGo, 5:createAndWait, 6:destroy
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.9999",1)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.9999",1)
-- wait for sometime and print the status of filetransfer
tftp.start()
@@ -162,16 +134,8 @@ action = function(host, port)
-- build a SNMP v1 packet
-- get value: .1.3.6.1.4.1.9.9.96.1.1.1.1.10 (Check the status of filetransfer) 1:waiting, 2:running, 3:successful, 4:failed
local options = {}
options.reqId = 28428
local payload = snmp.encode(snmp.buildPacket(snmp.buildGetRequest(options, ".1.3.6.1.4.1.9.9.96.1.1.1.1.10.9999")))
try(socket:send(payload))
local status
local response
-- read in any response we might get
status, response = socket:receive()
status, response = snmpHelper:get({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.10.9999")
if (not status) or (response == "TIMEOUT") then
return "\n ERROR: Failed to receive cisco configuration file"
@@ -205,9 +169,8 @@ action = function(host, port)
-- build a SNMP v1 packet
-- set value: .1.3.6.1.4.1.9.9.96.1.1.1.1.14 (Destroy settings by setting CopyStatus to destroy [6])
request = sendrequest(socket, ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.9999",6)
request = snmpHelper:set({reqId=28428}, ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.9999",6)
try(socket:close())
return result
end

View File

@@ -103,23 +103,19 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local tcp_oid = "1.3.6.1.2.1.6.13.1.1"
local udp_oid = "1.3.6.1.2.1.7.5.1.1"
local netstat = {}
local status, tcp, udp
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, tcp = snmp.snmpWalk( socket, tcp_oid )
status, tcp = snmpHelper:walk( tcp_oid )
if ( not(status) ) then return end
status, udp = snmp.snmpWalk( socket, udp_oid )
status, udp = snmpHelper:walk( udp_oid )
if ( not(status) ) then return end
socket:close()
if ( tcp == nil ) or ( #tcp == 0 ) or ( udp==nil ) or ( #udp == 0 ) then
return
@@ -136,7 +132,6 @@ action = function(host, port)
netstat = table_merge( tcp, udp )
nmap.set_port_state(host, port, "open")
socket:close()
return stdnse.format_output( true, netstat )
end

View File

@@ -140,18 +140,14 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local data, snmpoid = nil, "1.3.6.1.2.1.25.4.2"
local shares = {}
local status
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, shares = snmp.snmpWalk( socket, snmpoid )
socket:close()
status, shares = snmpHelper:walk( snmpoid )
if (not(status)) or ( shares == nil ) or ( #shares == 0 ) then
return

View File

@@ -31,67 +31,32 @@ portrule = shortport.portnumber(161, "udp", {"open", "open|filtered"})
-- Sends SNMP packets to host and reads responses
action = function(host, port)
-- create the socket used for our connection
local socket = nmap.new_socket()
-- set a reasonable timeout value
socket:set_timeout(5000)
-- do some exception handling / cleanup
local catch = function()
socket:close()
end
local try = nmap.new_try(catch)
-- connect to the potential SNMP system
try(socket:connect(host, port))
local payload
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
-- build a SNMP v1 packet
-- copied from packet capture of snmpget exchange
-- get value: 1.3.6.1.2.1.1.1.0 (SNMPv2-MIB::sysDescr.0)
local options = {}
options.reqId = 28428 -- unnecessary?
payload = snmp.encode(snmp.buildPacket(snmp.buildGetRequest(options, "1.3.6.1.2.1.1.1.0")))
local status, response = snmpHelper:get({reqId=28428}, "1.3.6.1.2.1.1.1.0")
try(socket:send(payload))
local status
local response
-- read in any response we might get
status, response = socket:receive_bytes(1)
if (not status) or (response == "TIMEOUT") then
if not status then
return
end
-- since we got something back, the port is definitely open
nmap.set_port_state(host, port, "open")
local result
result = snmp.fetchFirst(response)
local result = snmp.fetchFirst(response)
-- build a SNMP v1 packet
-- copied from packet capture of snmpget exchange
-- get value: 1.3.6.1.2.1.1.3.0 (SNMPv2-MIB::sysUpTime.0)
local options = {}
options.reqId = 28428
payload = snmp.encode(snmp.buildPacket(snmp.buildGetRequest(options, "1.3.6.1.2.1.1.3.0")))
status, response = snmpHelper:get({reqId=28428}, "1.3.6.1.2.1.1.3.0")
try(socket:send(payload))
-- read in any response we might get
status, response = socket:receive_bytes(1)
if (not status) or (response == "TIMEOUT") then
if not status then
return result
end
try(socket:close())
local uptime = snmp.fetchFirst(response)
if not uptime then
return

View File

@@ -74,18 +74,14 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local snmpoid = "1.3.6.1.4.1.77.1.2.3.1.1"
local services = {}
local status
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, services = snmp.snmpWalk( socket, snmpoid )
socket:close()
status, services = snmpHelper:walk( snmpoid )
if ( not(status) ) or ( services == nil ) or ( #services == 0 ) then
return

View File

@@ -78,18 +78,14 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local data, snmpoid = nil, "1.3.6.1.4.1.77.1.2.27"
local shares = {}
local status
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, shares = snmp.snmpWalk( socket, snmpoid )
socket:close()
status, shares = snmpHelper:walk( snmpoid )
if (not(status)) or ( shares == nil ) or ( #shares == 0 ) then
return

View File

@@ -140,18 +140,14 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local data, snmpoid = nil, "1.3.6.1.2.1.25.6.3.1"
local sw = {}
local status
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, sw = snmp.snmpWalk( socket, snmpoid )
socket:close()
status, sw = snmpHelper:walk( snmpoid )
if ( not(status) ) or ( sw == nil ) or ( #sw == 0 ) then
return

View File

@@ -66,18 +66,14 @@ end
action = function(host, port)
local socket = nmap.new_socket()
local catch = function() socket:close() end
local try = nmap.new_try(catch)
local snmpoid = "1.3.6.1.4.1.77.1.2.25"
local users = {}
local status
socket:set_timeout(5000)
try(socket:connect(host, port))
local snmpHelper = snmp.Helper:new(host, port)
snmpHelper:connect()
status, users = snmp.snmpWalk( socket, snmpoid )
socket:close()
status, users = snmpHelper:walk( snmpoid )
if( not(status) ) then
return