{"id":2019,"date":"2019-01-27T21:45:24","date_gmt":"2019-01-27T20:45:24","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=2019"},"modified":"2019-02-18T17:53:52","modified_gmt":"2019-02-18T16:53:52","slug":"2019","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=2019","title":{"rendered":"TCPRedir"},"content":{"rendered":"<p>In a previous <a href=\"https:\/\/labalec.fr\/erwan\/?p=2013\" rel=\"noopener\" target=\"_blank\">article<\/a>, I did comment on a nice opensource library (<a href=\"https:\/\/reqrypt.org\/windivert.html\" rel=\"noopener\" target=\"_blank\">Windivert<\/a>) and shared a basic freepascal demo to use it.<\/p>\n<p>This time I used this library to redirect (or reuse) a local port used by another application or service to another local port.<\/p>\n<p>It could be handy to fool firewalls or to hijack traffic going to a service.<\/p>\n<p>One of the best example that come to my mind is to redirect local port 445 to a an application\/shell of your own listening on local port 1337.<br \/>\nSomething you could not achieve like <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/cc731068(v=ws.10)\" rel=\"noopener\" target=\"_blank\">netsh port redirect<\/a> as the port is already in use and\/or used by a kernel service (SMB in our case).<\/p>\n<p>The command line would then be <strong>tcpredir 445 1337<\/strong>.<\/p>\n<p>Source code and binaries on <a href=\"https:\/\/github.com\/erwan2212\/windivert-fpc\" rel=\"noopener\" target=\"_blank\">Github<\/a>.<\/p>\n<p>One possible application example:<\/p>\n<p>-divert local port 445 to port 1337<br \/>\n-set up a smb server on port 1337<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/kSCrC9M.png\" alt=\"https:\/\/i.imgur.com\/kSCrC9M.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous article, I did comment on a nice opensource library (Windivert) and shared a basic freepascal demo to use it. This time I used this library to redirect (or reuse) a local port used by another application or service to another local port. It could be handy to fool firewalls or to hijack <a href='https:\/\/labalec.fr\/erwan\/?p=2019' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[105],"class_list":["post-2019","post","type-post","status-publish","format-standard","hentry","category-network","tag-windivert","category-5-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2019"}],"version-history":[{"count":11,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2019\/revisions"}],"predecessor-version":[{"id":2069,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2019\/revisions\/2069"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}