Module: Msf::Payload::Python::SendUUID

Included in:
BindTcp, ReverseTcp
Defined in:
lib/msf/core/payload/python/send_uuid.rb

Overview

Basic send_uuid stub for Python payloads

Instance Method Summary collapse

Instance Method Details

#py_send_uuid(opts = {}) ⇒ Object

Generate python code that writes the UUID to the socket.



16
17
18
19
20
21
22
23
24
25
# File 'lib/msf/core/payload/python/send_uuid.rb', line 16

def py_send_uuid(opts={})
  sock_var = opts[:sock_var] || 's'

  uuid = opts[:uuid] || generate_payload_uuid(arch: ARCH_PYTHON, platform: 'python')
  uuid_hex = Rex::Text.to_hex(uuid.to_raw, prefix = '')

  uuid_stub = "import binascii\n"
  uuid_stub << "#{sock_var}.send(binascii.a2b_hex('#{uuid_hex}'))\n"
  uuid_stub
end