Module: Msf::Payload::Windows::SendUUID

Included in:
BindNamedPipe, BindTcp, ReverseNamedPipe, ReverseTcp
Defined in:
lib/msf/core/payload/windows/send_uuid.rb

Overview

Basic send_uuid stub for Windows ARCH_X86 payloads

Instance Method Summary collapse

Instance Method Details

#asm_send_uuid(uuid = nil) ⇒ Object

Generate assembly code that writes the UUID to the socket.

This code assumes that the block API pointer is in ebp, and the communications socket handle is in edi.


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/msf/core/payload/windows/send_uuid.rb', line 22

def asm_send_uuid(uuid=nil)
  uuid ||= generate_payload_uuid
  uuid_raw = uuid.to_raw

  asm =%Q^
    send_uuid:
      push 0                 ; flags
      push #{uuid_raw.length} ; length of the UUID
      call get_uuid_address  ; put uuid buffer on the stack
      db #{raw_to_db(uuid_raw)}  ; UUID
    get_uuid_address:
      push edi               ; saved socket
      push #{Rex::Text.block_api_hash('ws2_32.dll', 'send')}
      call ebp               ; call send
  ^

  asm
end

#uuid_required_sizeObject


41
42
43
44
45
46
47
48
49
# File 'lib/msf/core/payload/windows/send_uuid.rb', line 41

def uuid_required_size
  # Start with the number of bytes required for the instructions
  space = 17

  # a UUID is 16 bytes
  space += 16

  space
end