mirror of
https://github.com/nmap/nmap.git
synced 2025-12-14 19:59:02 +00:00
commit d41a28813e4e4d26aeaab300ad30ad7c4116e37d Merge: a45e4e2 23fc8f1 Author: Patrik Karlsson <patrik@cqure.net> Date: Sun Aug 5 20:53:04 2012 +0200 Merge branch 'master' into bjnp Conflicts: CHANGELOG commit a45e4e2fd0c2579afc8d5b162bb5484327494b72 Author: Patrik Karlsson <patrik@cqure.net> Date: Sun Aug 5 20:44:19 2012 +0200 add bjnp library and the scripts bjnp-discover and broadcast-bjnp-discover
49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
description = [[
|
|
Retrievs printer or scanner information from a remote device supporting the
|
|
BJNP protocol. The protocol is known to be supported by network based Canon
|
|
devices.
|
|
]]
|
|
|
|
---
|
|
-- @usage
|
|
-- sudo nmap -sU -p 8611,8612 --script bjnp-discover <ip>
|
|
--
|
|
-- @output
|
|
-- PORT STATE SERVICE
|
|
-- 8611/udp open canon-bjnp1
|
|
-- | bjnp-discover:
|
|
-- | Manufacturer: Canon
|
|
-- | Model: MG5200 series
|
|
-- | Description: Canon MG5200 series
|
|
-- | Firmware version: 1.050
|
|
-- |_ Command: BJL,BJRaster3,BSCCe,NCCe,IVEC,IVECPLI
|
|
-- 8612/udp open canon-bjnp2
|
|
-- | bjnp-discover:
|
|
-- | Manufacturer: Canon
|
|
-- | Model: MG5200 series
|
|
-- | Description: Canon MG5200 series
|
|
-- |_ Command: MultiPass 2.1,IVEC
|
|
--
|
|
|
|
categories = {"safe", "discovery"}
|
|
|
|
local bjnp = require("bjnp")
|
|
local shortport = require("shortport")
|
|
local stdnse = require("stdnse")
|
|
|
|
portrule = shortport.portnumber({8611, 8612}, "udp")
|
|
|
|
action = function(host, port)
|
|
local helper = bjnp.Helper:new(host, port)
|
|
if ( not(helper:connect()) ) then
|
|
return "\n ERROR: Failed to connect to server"
|
|
end
|
|
local status, attrs
|
|
if ( port.number == 8611 ) then
|
|
status, attrs = helper:getPrinterIdentity()
|
|
else
|
|
status, attrs = helper:getScannerIdentity()
|
|
end
|
|
helper:close()
|
|
return stdnse.format_output(true, attrs)
|
|
end |