Module: Msf::Payload::Linux::SendUUID

Included in:
BindTcp, ReverseTcp_x86
Defined in:
lib/msf/core/payload/linux/send_uuid.rb

Overview

Basic send_uuid stub for Linux 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 communications socket handle is in edi.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/msf/core/payload/linux/send_uuid.rb', line 18

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

  asm =%Q^
    send_uuid:
      push ebx                      ; store ebx for later
      push ecx                      ; store ecx for later
      push 0                        ; terminate the args array
      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 itself
    get_uuid_address:
      push edi                      ; socket handle
      mov ecx, esp                  ; store the pointer to the argument arra
      push 0x9                      ; SYS_SEND
      pop ebx
      push 0x66                     ; sys_socketcall
      pop eax
      int 0x80
      add esp, 16                   ; put the stack back how it was
      pop ecx                       ; restore ecx
      pop ebx                       ; restore ebx
  ^

  asm
end