use typical command option and TLV scheme instead of dumb stuff for keyscan_start

bug/bundler_fix
William Webb 2017-06-23 13:11:12 -05:00
parent 2617ae7609
commit 9eeb3dc143
No known key found for this signature in database
GPG Key ID: 341763D0308DA650
3 changed files with 22 additions and 5 deletions

View File

@ -201,6 +201,7 @@ TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_LENGTH = TLV_META_TYPE_UINT | 3009
TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_BUFFER = TLV_META_TYPE_STRING | 3010 TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_BUFFER = TLV_META_TYPE_STRING | 3010
TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_LENGTH = TLV_META_TYPE_UINT | 3011 TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_LENGTH = TLV_META_TYPE_UINT | 3011
TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_BUFFER = TLV_META_TYPE_STRING | 3012 TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_BUFFER = TLV_META_TYPE_STRING | 3012
TLV_TYPE_KEYSCAN_TRACK_ACTIVE_WINDOW = TLV_META_TYPE_BOOL | 3013
## ##
# #

View File

@ -207,8 +207,9 @@ class UI < Rex::Post::UI
# #
# Start the keyboard sniffer # Start the keyboard sniffer
# #
def keyscan_start def keyscan_start(trackwindow=false)
request = Packet.create_request('stdapi_ui_start_keyscan') request = Packet.create_request('stdapi_ui_start_keyscan')
request.add_tlv( TLV_TYPE_KEYSCAN_TRACK_ACTIVE_WINDOW, trackwindow )
response = client.send_request(request) response = client.send_request(request)
return true return true
end end

View File

@ -281,8 +281,22 @@ class Console::CommandDispatcher::Stdapi::Ui
# Start the keyboard sniffer # Start the keyboard sniffer
# #
def cmd_keyscan_start(*args) def cmd_keyscan_start(*args)
print_line("Starting the keystroke sniffer...") trackwin = false
client.ui.keyscan_start
keyscan_opts = Rex::Parser::Arguments.new(
"-v" => [ false, "Verbose logging: tracks the current active window" ]
)
keyscan_opts.parse( args ) { | opt |
case opt
when "-v"
print_line("Verbose logging selected ...")
trackwin = true
end
}
print_line("Starting the keystroke sniffer ...")
client.ui.keyscan_start(trackwin)
return true return true
end end
@ -301,8 +315,9 @@ class Console::CommandDispatcher::Stdapi::Ui
def cmd_keyscan_dump(*args) def cmd_keyscan_dump(*args)
print_line("Dumping captured keystrokes...") print_line("Dumping captured keystrokes...")
data = client.ui.keyscan_dump data = client.ui.keyscan_dump
print_line(data) print_line(data + "\n") # the additional newline is to keep the resulting output
# from crowding the Meterpreter command prompt, which
# is visually frustrating without color
return true return true
end end