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/linux/busybox/enum_hosts.rb
Views: 11704
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Linux::BusyBox89def initialize10super(11'Name' => 'BusyBox Enumerate Host Names',12'Description' => %q{13This module will be applied on a session connected to a BusyBox shell. It will enumerate14host names related to the device executing BusyBox.15},16'Author' => 'Javier Vicente Vallejo',17'License' => MSF_LICENSE,18'Platform' => ['linux'],19'SessionTypes' => ['shell']20)21end2223def run24print_status('Searching hosts files...')25if busy_box_file_exist?('/var/hosts')26hosts_file = '/var/hosts'27elsif busy_box_file_exist?('/var/udhcpd/udhcpd.leases')28hosts_file = '/var/udhcpd/udhcpd.leases'29else30print_error('Files not found')31return32end3334read_hosts_file(hosts_file)35end3637def read_hosts_file(file)38str_file = read_file(file)39print_good("Hosts file found: #{file}.")40vprint_line(str_file)41p = store_loot('busybox.enum.hosts', 'text/plain', session, str_file, file, 'BusyBox device host names')42print_good("Hosts saved to #{p}.")43rescue EOFError44print_error("Nothing read from file: #{file}, file may be empty.")45end46end474849