{"id":260,"date":"2014-05-07T12:10:46","date_gmt":"2014-05-07T12:10:46","guid":{"rendered":"http:\/\/www.hackwhackandsmack.com\/?p=260"},"modified":"2014-05-07T12:10:46","modified_gmt":"2014-05-07T12:10:46","slug":"network-proxy-and-protocol-responder","status":"publish","type":"post","link":"https:\/\/www.hackwhackandsmack.com\/?p=260","title":{"rendered":"Network Proxy and Protocol Responder"},"content":{"rendered":"<p>I was on a pentest the other day and investigating a proprietary protocol to a management agent and wanted to replay this traffic from a script. I knew I could capture the traffic in wireshark but didnt really know how to replay this or even parts to send a command to the port. Well it took me a little while to get it all working as I wanted but to send a command and a few reply to various responses after an initial connect. To do this I used Zulu from Andy Davies (NCC) and created a python script with some useful hexdump commands.<\/p>\n<p>This blog will allow you to re-create or replay a management station type scenario with a client and opens a whole load of new attack scenarios. First you need to man-in-the-middle the traffic from the client to the management server within Zulu and\/or Wireshark.<\/p>\n<p>Installing Zulu can be found <a title=\"here\" href=\"http:\/\/www.hackwhackandsmack.com\/?p=255\">here<\/a>.<\/p>\n<p><strong>Start<\/strong><\/p>\n<p>Open Zulu and setup you network proxy to intercept the traffic like the following image:<\/p>\n<p><a href=\"http:\/\/www.hackwhackandsmack.com\/wp-content\/uploads\/2014\/05\/zulu.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-261\" title=\"zulu\" src=\"http:\/\/www.hackwhackandsmack.com\/wp-content\/uploads\/2014\/05\/zulu.png\" alt=\"\" width=\"1131\" height=\"708\" \/><\/a><\/p>\n<p>Once you have successfully captured all the requests and responses you can save out the requests to a file. Now you have all the valid requests that a client would send and all the valid responses that the manager would respond with. So now you want to create and edit your python handler to act as a server.<\/p>\n<p><strong>Here is the link to the &#8220;Protocol-Responder&#8221;\u00a0<a href=\"http:\/\/www.hackwhackandsmack.com\/protocol-responder.py\">script template.<br \/>\n<\/a><\/strong><strong>Here is the link to the &#8220;Protocol-Sender&#8221;\u00a0<a href=\"http:\/\/www.hackwhackandsmack.com\/protocol-sender.py\">script template.<\/a><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Read and edit the # commented sections to suit your needs and add and edit the hex content. To easily convert the hex content from a file that you may have piped from nc or downloaded from wireshark or zulu use the following hexdump &amp; sed command below.<\/p>\n<p>If you are using the Zulu files, remove the first two lines from each of the &#8220;In&#8221; files and then cat each specific file you would like to use the hex from to respond as:<\/p>\n<p><strong>cat hexfile.txt | hexdump -v -e &#8216;&#8221;0x&#8221; 1\/1 &#8220;%02X&#8221; &#8221; &#8220;&#8216;|sed -e &#8216;s\/ 0x\/\\\\x\/g&#8217;|sed -e &#8216;s\/0x\/\\\\x\/g&#8217;<\/strong><\/p>\n<pre>The output is like as follows:<\/pre>\n<pre><strong>\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xB6\\x00\\x00\\x00\\x45<\/strong><\/pre>\n<pre>Then you can add it to your python script:<\/pre>\n<p><strong>def run(self): <\/strong><br \/>\n<strong> print &#8220;Connection from : &#8220;+ip+&#8221;:&#8221;+str(port)<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0self.socket.send(&#8220;\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xB6\\x00\\x00\\x00\\x45&#8221;)<\/strong><\/p>\n<p>Anyway it took me a while to be able to create such a server or even an exploit sender with specific hex values and thought it may be useful to the community.<\/p>\n<p>Have fun \ud83d\ude42<\/p>\n<p>Any feedback or comments are highly appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was on a pentest the other day and investigating a proprietary protocol to a management agent and wanted to replay this traffic from a script. I knew I could capture the traffic in wireshark but didnt really know how to replay this or even parts to send a command to the port. Well it&hellip; <a class=\"more-link\" href=\"https:\/\/www.hackwhackandsmack.com\/?p=260\">Continue reading <span class=\"screen-reader-text\">Network Proxy and Protocol Responder<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/posts\/260"}],"collection":[{"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=260"}],"version-history":[{"count":4,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hackwhackandsmack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}