Module: Msf::Payload::Php::SendUUID

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

Overview

Basic send_uuid stub for PHP payloads

Instance Method Summary collapse

Instance Method Details

#php_send_uuid(opts = {}) ⇒ Object

Generate PHP code that writes the UUID to the socket.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/msf/core/payload/php/send_uuid.rb', line 16

def php_send_uuid(opts={})
  sock_var = opts[:sock_var] || '$s'
  sock_type = opts[:sock_type] || '$s_type'

  uuid = opts[:uuid] || generate_payload_uuid
  uuid_raw = uuid.to_raw.chars.map { |c| '\x%.2x' % c.ord }.join('')

  php = %Q^$u="#{uuid_raw}";
switch (#{sock_type}) {
case 'stream': fwrite(#{sock_var}, $u); break;
case 'socket': socket_write(#{sock_var}, $u); break;
}
^
  php
end