Allow cmd_arp to use -S flag
Allow searching for regex' through ARP output using Table's new 'SearchTerm' parameter. Example: ``` meterpreter > arp -S 10.2.1.1 ARP cache ========= IP address MAC address Interface ---------- ----------- --------- 10.2.1.1 00:01:02:03:04:05 15 ```unstable
parent
b20c1c51b5
commit
e9be0d3f7a
|
@ -58,6 +58,13 @@ class Console::CommandDispatcher::Stdapi::Net
|
||||||
"-h" => [ false, "Help banner." ],
|
"-h" => [ false, "Help banner." ],
|
||||||
"-S" => [ true, "Search string." ])
|
"-S" => [ true, "Search string." ])
|
||||||
|
|
||||||
|
#
|
||||||
|
# Options for ARP command.
|
||||||
|
#
|
||||||
|
@@arp_opts = Rex::Parser::Arguments.new(
|
||||||
|
"-h" => [ false, "Help banner." ],
|
||||||
|
"-S" => [ true, "Search string." ])
|
||||||
|
|
||||||
#
|
#
|
||||||
# List of supported commands.
|
# List of supported commands.
|
||||||
#
|
#
|
||||||
|
@ -126,7 +133,7 @@ class Console::CommandDispatcher::Stdapi::Net
|
||||||
search_term = /#{search_term}/nmi
|
search_term = /#{search_term}/nmi
|
||||||
end
|
end
|
||||||
when "-h"
|
when "-h"
|
||||||
cmd_netstat_help
|
@@netstat_opts.usage
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -163,6 +170,23 @@ class Console::CommandDispatcher::Stdapi::Net
|
||||||
#
|
#
|
||||||
def cmd_arp(*args)
|
def cmd_arp(*args)
|
||||||
arp_table = client.net.config.arp_table
|
arp_table = client.net.config.arp_table
|
||||||
|
search_term = nil
|
||||||
|
@@arp_opts.parse(args) { |opt, idx, val|
|
||||||
|
case opt
|
||||||
|
when '-S'
|
||||||
|
search_term = val
|
||||||
|
if search_term.nil?
|
||||||
|
print_error("Enter a search term")
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
search_term = /#{search_term}/nmi
|
||||||
|
end
|
||||||
|
when "-h"
|
||||||
|
@@arp_opts.usage
|
||||||
|
return 0
|
||||||
|
|
||||||
|
end
|
||||||
|
}
|
||||||
tbl = Rex::Ui::Text::Table.new(
|
tbl = Rex::Ui::Text::Table.new(
|
||||||
'Header' => "ARP cache",
|
'Header' => "ARP cache",
|
||||||
'Indent' => 4,
|
'Indent' => 4,
|
||||||
|
@ -171,7 +195,8 @@ class Console::CommandDispatcher::Stdapi::Net
|
||||||
"IP address",
|
"IP address",
|
||||||
"MAC address",
|
"MAC address",
|
||||||
"Interface"
|
"Interface"
|
||||||
])
|
],
|
||||||
|
'SearchTerm' => search_term)
|
||||||
|
|
||||||
arp_table.each { |arp|
|
arp_table.each { |arp|
|
||||||
tbl << [ arp.ip_addr, arp.mac_addr, arp.interface ]
|
tbl << [ arp.ip_addr, arp.mac_addr, arp.interface ]
|
||||||
|
|
Loading…
Reference in New Issue