{"id":510,"date":"2019-07-12T13:33:00","date_gmt":"2019-07-12T17:33:00","guid":{"rendered":"https:\/\/blog.lamarranet.com\/?p=510"},"modified":"2019-08-16T13:16:52","modified_gmt":"2019-08-16T17:16:52","slug":"exploit-education-phoenix-net-one-solution","status":"publish","type":"post","link":"https:\/\/blog.lamarranet.com\/index.php\/exploit-education-phoenix-net-one-solution\/","title":{"rendered":"Exploit Education | Phoenix | Net One Solution"},"content":{"rendered":"<p>The description and source code can be found here:<br \/>\n<a href=\"http:\/\/exploit.education\/phoenix\/net-one\/\">http:\/\/exploit.education\/phoenix\/net-one\/<\/a><\/p>\n<p>This level is asking us to do the opposite of the previous level. Now we need to convert a bytes value from native endian format to an integer and send that back as an ASCII string. Again, I can use netcat to verify this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">user@phoenix-amd64:~$ nc 127.1 64001\r\nWelcome to phoenix\/net-one, brought to you by https:\/\/exploit.education\r\n_z\ufffd\ufffd1000\r\nClose, you sent &quot;1000&quot;, and we wanted &quot;2511501919&quot;<\/pre>\n<p>Yup. After receiving 4 bytes of random data, I sent &#8220;1000&#8221; (as an ASCII string) and the program verified that&#8217;s what I sent.<\/p>\n<p>I wrote another Python script to automate this:<\/p>\n<pre class=\"brush: python; light: false; title: net-one.py; notranslate\" title=\"net-one.py\">#!\/usr\/bin\/env python3\r\n\r\nimport socket\r\nimport time\r\n\r\nIP = &quot;127.0.0.1&quot;\r\nPORT = 64001\r\n\r\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\ns.connect((IP, PORT))\r\n\r\n# Get the first 2 lines\r\nprint(s.recv(132).decode())\r\ntime.sleep(0.1)\r\nmsg = s.recv(132)&#x5B;1:] # Cutting off the newline character\r\n\r\n# Display what was received &amp; display it as a hex value\r\nprint(&quot;Received: {}&quot;.format(msg))\r\nintval = int.from_bytes(msg, byteorder='little')\r\nprint(&quot;Hex value: {}&quot;.format(hex(intval)))\r\n\r\n# Send the data as bytes\r\nprint('Sending integer value: &quot;{}&quot;\\n'.format(intval))\r\ns.send(str(intval).encode() + b'\\n')\r\n\r\n# Print the last message\r\nprint(s.recv(132).decode())<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Can you convert the native endian representation of an integer to the ascii equivalent? &hellip; <a href=\"https:\/\/blog.lamarranet.com\/index.php\/exploit-education-phoenix-net-one-solution\/\" class=\"more-link\"><span class=\"readmore\">Continue reading<span class=\"screen-reader-text\">Exploit Education | Phoenix | Net One Solution<\/span><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-solutions"],"_links":{"self":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/comments?post=510"}],"version-history":[{"count":6,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/510\/revisions"}],"predecessor-version":[{"id":681,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/510\/revisions\/681"}],"wp:attachment":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/media?parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/categories?post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/tags?post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}