Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Netcat ?'s

  1. #1
    Senior Member
    Join Date
    Dec 2003
    Posts
    317

    Netcat ?'s

    I was exploring about with netcat yesterday on windows and i was having some problems doing some of the stuff that i thought it should be able to do. for example, i set it up on 2 of my comps to give me cmd.exe when i connect to them. when i connect to them, i cant execute programs, if i run ie, it will start in the background but wont actually do anything. this makes it hard for me to use programs like shutdown or telnet(shouldnt i be able to telnet to my downstairs comp and from that be able to telnet to my other comp?). also, i tried putting nc in the windows directory and making a batch file like this(and put it in the startup folder so it runs everytime the comp is started):

    @echo off
    @nc -v -L -d -p 1 -e cmd.exe
    and it just hangs and never really starts netcat, i had to make a shortcut with a target of "C:\WINDOWS\nc.exe -v -L -d -p 1 -e cmd.exe". it does the same thing, but id really like to figure out why the batch file didnt work(im wierd like that)

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Posts
    147
    For chaining telnet sessions like your trying, you'll have to find a commandline telnet client, so you can use it on the command line. Windows 2k and XP come with this standard.

    Not sure why it won't start right. It's a bad idea however you manage to do it. There's no security whatsoever. You should look into openssh and such. I don't know if they have a server for windows. Maybe you could work something out with cygwin.

  3. #3
    Senior Member
    Join Date
    Dec 2003
    Posts
    317
    im on a private network, behind a fw so its pretty secure. the telnet client ur talking about, is that the one in dos? i've been using that, it still doesnt work... for example:
    i open the dos prompt, type "telnet downstairscomp 1", then im at the prompt for my downstairs comp, then i try to telnet to my 3rd comp, "telnet 3rdcomp 1", and nothing actually happens, it accepts the command but its not like i get connected to the next computer in a chain like i wanted. i think whats happening is the downstairs computer runs telnet downstairs, but as a background process. i want to be able to access it from my upstairs computer though. why do all the programs i try to run remotely with netcat open as background processes?

  4. #4
    make sure that their not both bound to the same port you cant lnk from one too another if its bound to the same port

    as for your batch file makesure that dos can see netcat without being directed to it and you dont need that @ before nc when echo is off

  5. #5
    Senior Member
    Join Date
    Dec 2003
    Posts
    317
    getting rid of the @ fixed it, but the prompt window that opens from it never closes for some reason... so netcat runs but i have to physically close the cmd window thats opened up from the .bat file even if i use a -d in order to make nc run in the background and put an "exit" at the end of the batch file.

    they arent bound to the same port, i have nc running on 3 comps, what i want to do is telnet from comp A to comp B, get a command prompt at comp B and then run telnet again to comp C.

    like this:
    comp A(where i am)---> comp B ---> comp C

    the problem is that i go to comp b(via telnet) then try to telnet to comp C and it echoes my command and telnet starts running on computer B(as a background process), but i cant give commands to it from comp A, its kind of hard for me to explain

  6. #6
    for the batch file if you write start /B nc -d -e cmd.exe -p 23 -L that should take care of it

  7. #7
    Junior Member
    Join Date
    Dec 2003
    Posts
    8
    1) no win95 with nc
    2) get it working without batch files first
    3) don't run any gui progs
    4) two methods to make a nc relays are:
    A) nc -l -p 11111 | nc next_hop 54321 | nc previous_hop 22222
    b)nc -l -p 11111 0<backpipe | nc next_hop 54321 1>backpipe
    [glowpurple]Which is more powerfull, knowledge or imagination?[/glowpurple]

  8. #8
    Senior Member
    Join Date
    Dec 2003
    Posts
    317
    im running xp, it works without batch files, i just use them to make things easier. what do you mean by gui progs?(like web browsers and stuff?) dont run them with netcat?
    can u explain those nc commands a little bit? i've just been using nc to run cmd on port 1, then connecting to it with telnet, should i be using nc instead of telnet?

  9. #9
    Junior Member
    Join Date
    Dec 2003
    Posts
    8
    - Netcat can't provide an interface for graphical user interface tools (GUI).
    - The following commands will let you connect from computer "A" (source;IP=10.10.10.1), bounce off of one (or more) "relay" computers "B" (relay;IP=10.10.10.2), and then shovel a command shell back from computer "C" (target;IP=10.10.10.3).

    STEP 1) open a cmd window on computer "A"(source) and type:
    nc -L -p 9998
    STEP 2) open a cmd window on computer "C"(target) and type:
    nc -L -p 9999 -e cmd.exe
    STEP 3) open a cmd window on computer "B"(relay) and type:
    nc -L -p 9997 | nc 10.10.10.3 9999 | nc 10.10.10.1 9998
    STEP 4) open a second command window on computer "A" and type:
    nc 10.10.10.2 9997

    - On computer "A" (source) you will be entering commands in one window and the results will be visible in the other window.
    (NOTE: "STEP 2" uses pipe characters "|" between the nc commands)
    [glowpurple]Which is more powerfull, knowledge or imagination?[/glowpurple]

  10. #10
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    The problem may be with the telnet program. It is a graphical program instead
    of a command line program, and may not run properly under a netcat session.
    You could get a "console" telnet program or emulate telnet with netcat.
    I came in to the world with nothing. I still have most of it.

Posting Permissions

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