Files
metasploit-gs/modules/auxiliary/admin/juniper/juniper_config.rb
T

50 lines
1.5 KiB
Ruby
Raw Normal View History

2019-07-07 21:49:48 -04:00
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/auxiliary/juniper'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Juniper
def initialize(info={})
super( update_info( info,
'Name' => 'Juniper Configuration Importer',
'Description' => %q{
This module imports a Juniper ScreenOS or JunOS device configuration.
},
'License' => MSF_LICENSE,
'Author' => [ 'h00die'],
'Actions' =>
[
['JUNOS', {'Description' => 'Import JunOS Config File'}],
['SCREENOS', {'Description' => 'Import ScreenOS Config File'}],
],
'DefaultAction' => 'JUNOS',
))
register_options(
[
OptPath.new('CONFIG', [true, 'Path to configuration to import']),
Opt::RHOST(),
Opt::RPORT(22)
])
end
def run
unless ::File.exist?(datastore['CONFIG'])
fail_with Failure::BadConfig, "Juniper config file #{datastore['CONFIG']} does not exists!"
end
2019-09-30 15:03:38 -04:00
juniper_config = ::File.open(datastore['CONFIG'], "rb")
2019-07-07 21:49:48 -04:00
print_status('Importing config')
if action.name == 'JUNOS'
2019-09-30 15:03:38 -04:00
juniper_junos_config_eater(datastore['RHOSTS'],datastore['RPORT'],juniper_config.read)
2019-07-07 21:49:48 -04:00
elsif action.name == 'SCREENOS'
2019-09-30 15:03:38 -04:00
juniper_screenos_config_eater(datastore['RHOSTS'],datastore['RPORT'],juniper_config.read)
2019-07-07 21:49:48 -04:00
end
print_good('Config import successful')
end
end