Class: Rex::Post::Meterpreter::Extensions::Lanattacks::Lanattacks
- Inherits:
-
Rex::Post::Meterpreter::Extension
- Object
- Rex::Post::Meterpreter::Extension
- Rex::Post::Meterpreter::Extensions::Lanattacks::Lanattacks
- Defined in:
- lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb
Overview
This meterpreter extension can currently run DHCP and TFTP servers
Instance Attribute Summary
Attributes inherited from Rex::Post::Meterpreter::Extension
Instance Method Summary collapse
- #add_tftp_file(filename, data) ⇒ Object
- #dhcp_log ⇒ Object
-
#initialize(client) ⇒ Lanattacks
constructor
A new instance of Lanattacks.
- #load_dhcp_options(datastore) ⇒ Object
- #reset_dhcp ⇒ Object
- #reset_tftp ⇒ Object
- #set_dhcp_option(name, value) ⇒ Object
- #start_dhcp ⇒ Object
- #start_tftp ⇒ Object
- #stop_dhcp ⇒ Object
- #stop_tftp ⇒ Object
Constructor Details
#initialize(client) ⇒ Lanattacks
Returns a new instance of Lanattacks.
18 19 20 21 22 23 24 25 26 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 18 def initialize(client) super(client, 'lanattacks') client.register_extension_aliases( [{ 'name' => 'lanattacks', 'ext' => self },]) end |
Instance Method Details
#add_tftp_file(filename, data) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 84 def add_tftp_file(filename, data) request = Packet.create_request('lanattacks_add_tftp_file') request.add_tlv(TLV_TYPE_LANATTACKS_OPTION_NAME, filename) request.add_tlv(TLV_TYPE_LANATTACKS_RAW, data, false, true) #compress it client.send_request(request) true end |
#dhcp_log ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 60 def dhcp_log response = client.send_request(Packet.create_request('lanattacks_dhcp_log')) entries = [] if( response.result == 0 ) log = response.get_tlv_value( TLV_TYPE_LANATTACKS_RAW ) while log.length > 0 mac = log.slice!(0..5) ip = log.slice!(0..3) entries << [ mac, ip ] end end entries end |
#load_dhcp_options(datastore) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 46 def (datastore) datastore.each do |name, value| if Regexp.new('DHCPIPSTART|DHCPIPEND|NETMASK|ROUTER|DNSSERVER|BROADCAST|'+ 'SERVEONCE|PXE|HOSTNAME|HOSTSTART|FILENAME|PXECONF|SRVHOST') =~ name set_dhcp_option(name,value) end end end |
#reset_dhcp ⇒ Object
33 34 35 36 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 33 def reset_dhcp client.send_request(Packet.create_request('lanattacks_reset_dhcp')) true end |
#reset_tftp ⇒ Object
79 80 81 82 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 79 def reset_tftp client.send_request(Packet.create_request('lanattacks_reset_tftp')) true end |
#set_dhcp_option(name, value) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 38 def set_dhcp_option(name, value) request = Packet.create_request('lanattacks_set_dhcp_option') request.add_tlv(TLV_TYPE_LANATTACKS_OPTION_NAME, name) request.add_tlv(TLV_TYPE_LANATTACKS_OPTION, value) client.send_request(request) true end |
#start_dhcp ⇒ Object
28 29 30 31 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 28 def start_dhcp client.send_request(Packet.create_request('lanattacks_start_dhcp')) true end |
#start_tftp ⇒ Object
74 75 76 77 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 74 def start_tftp client.send_request(Packet.create_request('lanattacks_start_tftp')) true end |
#stop_dhcp ⇒ Object
55 56 57 58 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 55 def stop_dhcp client.send_request(Packet.create_request('lanattacks_stop_dhcp')) true end |
#stop_tftp ⇒ Object
92 93 94 95 |
# File 'lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb', line 92 def stop_tftp client.send_request(Packet.create_request('lanattacks_stop_tftp')) true end |