Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/networking/juniper_config.rb
Views: 11655
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Juniper7include Msf::Exploit::Deprecated8moved_from 'auxiliary/admin/juniper/juniper_config'910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Juniper Configuration Importer',15'Description' => %q{16This module imports a Juniper ScreenOS or JunOS device configuration.17},18'License' => MSF_LICENSE,19'Author' => ['h00die'],20'Actions' => [21['JUNOS', { 'Description' => 'Import JunOS Config File' }],22['SCREENOS', { 'Description' => 'Import ScreenOS Config File' }],23],24'DefaultAction' => 'JUNOS',25'Notes' => {26'Stability' => [],27'SideEffects' => [],28'Reliability' => []29}30)31)3233register_options(34[35OptPath.new('CONFIG', [true, 'Path to configuration to import']),36Opt::RHOST(),37Opt::RPORT(22)38]39)40end4142def run43unless ::File.exist?(datastore['CONFIG'])44fail_with Failure::BadConfig, "Juniper config file #{datastore['CONFIG']} does not exist!"45end46juniper_config = ::File.open(datastore['CONFIG'], 'rb')47print_status('Importing config')48if action.name == 'JUNOS'49juniper_junos_config_eater(datastore['RHOSTS'], datastore['RPORT'], juniper_config.read)50elsif action.name == 'SCREENOS'51juniper_screenos_config_eater(datastore['RHOSTS'], datastore['RPORT'], juniper_config.read)52end53print_good('Config import successful')54end55end565758