Add machine ID support to the command list

bug/bundler_fix
OJ 2015-04-01 14:29:04 +10:00
parent c0f496197c
commit 79ec2e0586
3 changed files with 18 additions and 0 deletions

View File

@ -230,6 +230,16 @@ class ClientCore < Extension
return true return true
end end
def machine_id
request = Packet.create_request('core_machine_id')
response = client.send_request(request)
id = response.get_tlv_value(TLV_TYPE_MACHINE_ID)
# TODO: Determine if we're going to MD5/SHA1 this
return Rex::Text.md5(id)
end
def change_transport(opts={}) def change_transport(opts={})
request = Packet.create_request('core_change_transport') request = Packet.create_request('core_change_transport')

View File

@ -91,6 +91,8 @@ TLV_TYPE_MIGRATE_SOCKET_PATH = TLV_META_TYPE_STRING | 409
TLV_TYPE_TRANSPORT_TYPE = TLV_META_TYPE_UINT | 430 TLV_TYPE_TRANSPORT_TYPE = TLV_META_TYPE_UINT | 430
TLV_TYPE_TRANSPORT_URL = TLV_META_TYPE_STRING | 431 TLV_TYPE_TRANSPORT_URL = TLV_META_TYPE_STRING | 431
TLV_TYPE_MACHINE_ID = TLV_META_TYPE_STRING | 460
TLV_TYPE_CIPHER_NAME = TLV_META_TYPE_STRING | 500 TLV_TYPE_CIPHER_NAME = TLV_META_TYPE_STRING | 500
TLV_TYPE_CIPHER_PARAMETERS = TLV_META_TYPE_GROUP | 501 TLV_TYPE_CIPHER_PARAMETERS = TLV_META_TYPE_GROUP | 501
@ -185,6 +187,7 @@ class Tlv
when TLV_TYPE_MIGRATE_ARCH; "MIGRATE-ARCH" when TLV_TYPE_MIGRATE_ARCH; "MIGRATE-ARCH"
when TLV_TYPE_TRANSPORT_TYPE; "TRANSPORT-TYPE" when TLV_TYPE_TRANSPORT_TYPE; "TRANSPORT-TYPE"
when TLV_TYPE_TRANSPORT_URL; "TRANSPORT-URL" when TLV_TYPE_TRANSPORT_URL; "TRANSPORT-URL"
when TLV_TYPE_MACHINE_ID; "MACHINE-ID"
#when Extensions::Stdapi::TLV_TYPE_NETWORK_INTERFACE; 'network-interface' #when Extensions::Stdapi::TLV_TYPE_NETWORK_INTERFACE; 'network-interface'
#when Extensions::Stdapi::TLV_TYPE_IP; 'ip-address' #when Extensions::Stdapi::TLV_TYPE_IP; 'ip-address'

View File

@ -63,6 +63,7 @@ class Console::CommandDispatcher::Core
"use" => "Deprecated alias for 'load'", "use" => "Deprecated alias for 'load'",
"load" => "Load one or more meterpreter extensions", "load" => "Load one or more meterpreter extensions",
"transport" => "Change the current transport mechanism", "transport" => "Change the current transport mechanism",
"machine_id" => "Get the MSF ID of the machine attached to the session",
"quit" => "Terminate the meterpreter session", "quit" => "Terminate the meterpreter session",
"resource" => "Run the commands stored in a file", "resource" => "Run the commands stored in a file",
"read" => "Reads data from a channel", "read" => "Reads data from a channel",
@ -333,6 +334,10 @@ class Console::CommandDispatcher::Core
Rex::Ui::Text::IrbShell.new(binding).run Rex::Ui::Text::IrbShell.new(binding).run
end end
def cmd_machine_id(*args)
print_good("Machine ID: #{client.core.machine_id}")
end
def cmd_transport(*args) def cmd_transport(*args)
if ( args.length == 0 or args.include?("-h") ) if ( args.length == 0 or args.include?("-h") )
#cmd_transport_help #cmd_transport_help