Since Ruby's default String encoding is UTF-8, the binary shellcode strings are encoded as UTF-8 by default, before they are converted to binary encoding using .b. However, when #{packed_ip} and #{packed_port} are embedded into them, this can cause an invalid UTF-8 byte-sequence exception.
Since Ruby's default String encoding is UTF-8, the binary shellcode strings are encoded as UTF-8 by default, before they are converted to binary encoding using
.b
. However, when#{packed_ip}
and#{packed_port}
are embedded into them, this can cause an invalid UTF-8 byte-sequence exception.