metasploit-framework/modules/auxiliary/scanner/scada/digi_addp_version.rb

68 lines
1.8 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex/proto/addp'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
2013-08-30 21:28:54 +00:00
include Msf::Auxiliary::Report
include Msf::Auxiliary::UDPScanner
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
)
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
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
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
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 )
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
2013-08-30 21:28:54 +00:00
@results[shost] = res
end
end