1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00

bring ukl branch up to date with upstream

This commit is contained in:
William Webb 2017-04-12 21:59:13 -05:00
parent ced1412ee0
commit 303a767ccc
No known key found for this signature in database
GPG Key ID: 341763D0308DA650
2 changed files with 2 additions and 34 deletions

View File

@ -226,43 +226,11 @@ class UI < Rex::Post::UI
# Dump the keystroke buffer
#
def keyscan_dump
request = Packet.create_request('stdapi_ui_get_keys')
request = Packet.create_request('stdapi_ui_get_keys_utf8')
response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_KEYS_DUMP);
end
#
# Extract the keystroke from the buffer data
#
def keyscan_extract(buffer_data)
outp = ""
buffer_data.unpack("n*").each do |inp|
fl = (inp & 0xff00) >> 8
vk = (inp & 0xff)
kc = VirtualKeyCodes[vk]
f_shift = fl & (1<<1)
f_ctrl = fl & (1<<2)
f_alt = fl & (1<<3)
if(kc)
name = ((f_shift != 0 and kc.length > 1) ? kc[1] : kc[0])
case name
when /^.$/
outp << name
when /shift|click/i
when 'Space'
outp << " "
else
outp << " <#{name}> "
end
else
outp << " <0x%.2x> " % vk
end
end
return outp
end
protected
attr_accessor :client # :nodoc:

View File

@ -39,7 +39,7 @@ class Console::CommandDispatcher::Stdapi::Ui
"enumdesktops" => [ "stdapi_ui_desktop_enum" ],
"getdesktop" => [ "stdapi_ui_desktop_get" ],
"idletime" => [ "stdapi_ui_get_idle_time" ],
"keyscan_dump" => [ "stdapi_ui_get_keys" ],
"keyscan_dump" => [ "stdapi_ui_get_keys_utf8" ],
"keyscan_start" => [ "stdapi_ui_start_keyscan" ],
"keyscan_stop" => [ "stdapi_ui_stop_keyscan" ],
"screenshot" => [ "stdapi_ui_desktop_screenshot" ],