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_connections.rb
Views: 11703
##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::BusyBox89FILES = [10'/proc/net/nf_conntrack',11'/proc/net/ip_conntrack',12'/proc/net/tcp',13'/proc/net/udp',14'/proc/net/arp',15'/proc/fcache/*'16]1718def initialize19super(20'Name' => 'BusyBox Enumerate Connections',21'Description' => %q{22This module will be applied on a session connected to a BusyBox shell. It will23enumerate the connections established with the router or device executing BusyBox.24},25'Author' => 'Javier Vicente Vallejo',26'License' => MSF_LICENSE,27'Platform' => ['linux'],28'SessionTypes' => ['shell']29)30end3132def run33found = false34print_status('Searching for files that store information about network connections')35FILES.each do |f|36next unless busy_box_file_exist?(f)3738found = true39print_good("Connections file found: #{f}.")40read_connection_file(f)41end4243print_error('Any file with connections found') unless found44end4546def read_connection_file(file)47str_file = read_file(file)48vprint_line(str_file)49p = store_loot('busybox.enum.connections', 'text/plain', session, str_file, file, 'BusyBox Device Network Established Connections')50print_good("Connections saved to #{p}")51rescue EOFError52print_error("Nothing read from file #{file}, file may be empty")53end54end555657