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.


20
21
22
23
24
25
26
27
28
29
# File 'lib/msf/core/payload/python/send_uuid.rb', line 20

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

  uuid = opts[:uuid] || generate_payload_uuid
  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