{"id":478,"date":"2024-03-29T00:50:57","date_gmt":"2024-03-29T04:50:57","guid":{"rendered":"https:\/\/offensivepython.com\/?p=478"},"modified":"2024-03-29T01:04:57","modified_gmt":"2024-03-29T05:04:57","slug":"a-python-netcat-listener","status":"publish","type":"post","link":"https:\/\/offensivepython.com\/index.php\/2024\/03\/29\/a-python-netcat-listener\/","title":{"rendered":"A Python Netcat Listener"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"478\" class=\"elementor elementor-478\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d55bc2a e-flex e-con-boxed e-con e-parent\" data-id=\"d55bc2a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d2a1503 elementor-widget elementor-widget-text-editor\" data-id=\"d2a1503\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u00a0 \u00a0 \u00a0During Red Team exercises, we may gain access to systems but in tightly controlled environments, it can be tough to move around, and netcat may not be readily available for a particular OS.\u00a0 Well, never fear, Python to the rescuse once again.\u00a0 I discovered a really useful module recently, appropriately named <a href=\"https:\/\/nclib.readthedocs.io\/en\/latest\/\">nclib<\/a>.\u00a0 Look how easy this makes coding sockets become!<\/p><p>#!\/usr\/bin\/python3<br \/><strong>from nclib import Netcat<\/strong><br \/><br \/><strong>nc = Netcat(listen=(&#8216;192.168.134.129&#8217;, 56838))<\/strong><br \/><strong>nc.interact()<\/strong><\/p><p>\u00a0The 3 lines of code above is doing what <strong>nc -l -p 56838 <\/strong>would do, and the module does a whole lot more.\u00a0 You can build tools using the module and then use Pyinstaller to &#8220;one folder&#8221; or &#8220;one file&#8221; them up for easy deployment to whatever system you need it on.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 \u00a0During Red Team exercises, we may gain access to systems but in tightly controlled environments, it can be tough to move around, and netcat may not be readily available for a particular OS.\u00a0 Well, never fear, Python to the rescuse once again.\u00a0 I discovered a really useful module recently, appropriately named nclib.\u00a0 Look [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","site-transparent-header":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[35],"tags":[],"class_list":["post-478","post","type-post","status-publish","format-standard","hentry","category-offensive-tool"],"_links":{"self":[{"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":4,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/posts\/478\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/offensivepython.com\/index.php\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}