Government Security
Network Security Resources

Jump to content


Help With Netcat In Windows

- - - - - windows
  • Please log in to reply
1 reply to this topic

#1 Crumbs



  • Members
  • 2 posts

Posted 12 September 2012 - 04:10 AM

Hi all,

I'm doing some research, and I was playing around with netcat but I can't seem to get something.

I tried this command on a WinXP (I'm using two VMs running XP, and playing around with the connection between them):

nc -l -p 80 -e "c:\notepad.exe"
(I copied notepad.exe to c:\ folder)

But what happens is simply that netcat closes and does nothing. It does connect, because if I leave the command without the "-e" parameter like this:

nc -l -p 80

It does show me an output. But when I add the "-e" and any program (I tried cmd, and others) - nothing will execute, and netcat simply shuts down.

Any ideas?

#2 dr0pped



  • Members
  • 1 posts

Posted 22 January 2013 - 01:02 AM

1. Some builds of netcat are compiled without the -e switch. Check to make sure you have one that does have it.

2. I might be wrong here, but I've never seen an example of using an absolute path in quotes as a netcat command line argument - I've only seen examples where the .exe to be spawned was in the same directory as netcat, so this would be more like it: nc -l -p 80 -e notepad.exe

3. The command line example you've shown is just the listener, ready to "spawn" notepad.exe when a connection is made. The only thing is - notepad will launch, but it will not be visible, except that it'll show as a running process in your process list. In short, unusable. Maybe there's some way to do it successfully but not that I know of.

4. And of course, to connect to anything like the above, you've got to have another shell going with something like: nc -n -v 80.

The above will spawn a command shell if you sub cmd.exe for notepad.exe

Also tagged with one or more of these keywords: windows