2012-10-29 04:04:18 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2012-10-29 04:04:18 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex/proto/addp'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Digi ADDP Information Discovery',
|
|
|
|
'Description' => 'Discover host information through the Digi International ADDP service',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['URL', 'http://qbeukes.blogspot.com/2009/11/advanced-digi-discovery-protocol_21.html'],
|
|
|
|
['URL', 'http://www.digi.com/wiki/developer/index.php/Advanced_Device_Discovery_Protocol_%28ADDP%29'],
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(2362),
|
|
|
|
OptString.new('ADDP_PASSWORD', [true, 'The ADDP protocol password for each target', 'dbps'])
|
|
|
|
], self.class)
|
|
|
|
end
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def scanner_prescan(batch)
|
|
|
|
print_status("Finding ADDP nodes within #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)")
|
|
|
|
@results = {}
|
|
|
|
end
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def scan_host(ip)
|
|
|
|
Rex::Proto::ADDP.request_config_all.each do |pkt|
|
|
|
|
scanner_send(pkt, ip, datastore['RPORT'])
|
|
|
|
end
|
|
|
|
end
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def scanner_process(data, shost, sport)
|
|
|
|
res = Rex::Proto::ADDP.decode_reply(data)
|
|
|
|
return unless res[:magic] and res[:mac]
|
|
|
|
res[:banner] = Rex::Proto::ADDP.reply_to_string( res )
|
2012-10-29 04:04:18 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
unless @results[shost]
|
|
|
|
print_status("#{shost}:#{datastore['RPORT']} ADDP #{res[:banner]}")
|
|
|
|
report_service(
|
|
|
|
:host => shost,
|
|
|
|
:mac => res[:mac],
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'udp',
|
|
|
|
:name => 'addp',
|
|
|
|
:info => res[:banner]
|
|
|
|
)
|
|
|
|
end
|
2012-11-08 12:40:32 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
@results[shost] = res
|
|
|
|
end
|
2012-10-29 04:04:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
end
|