/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
modules/post/linux/busybox/enum_hosts.rb
47 строк
1 KB
adfoster-r7
Run rubocop on post modules
08 фев 2023, 16:47
Не верифицирован
08 фев 2023, 16:47
a81a71c
Код
Авторство
О чём код?
## # 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