Anyone know of any good netcat tutorials?

Discussion in 'Linux & BSD' started by Son Goku, Jun 21, 2005.

  1. Son Goku

    Son Goku No lover of dogma

    Umm, OK, I'm a bit lost here. Today's assignment includes

    I'm currently trying to find a tutorial that describes the use of netcat, but don't seem to be finding something via google that's all too good in describing this for someone totally unfamiliar with the netcat command. Anyone know of any kind of tutorial or something, that can get me started in figuring out how to use this so I can then script it? There doesn't seem to be any man pages on it either...

    thx in advance...
     
  2. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    That's easy. Not much too it. Some simple shell scripting, and you are on your way. Since this is a homework assignment, i will complete the work required in exactly 1 week from now, or now at an onetime charge of $120.

    You don't need a tutorial at all for this.

    I'll give you a hint:

    man nc

    Incase you don't have the man page local, here it is on the web: http://www.freebsd.org/cgi/man.cgi?...ath=FreeBSD+5.3-RELEASE+and+Ports&format=html
     
  3. Son Goku

    Son Goku No lover of dogma

    OK, thx, I tried both man netcat and man nc and both came up document not found...
     
  4. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Like i had said, i'd give it to you in a week:

    Code:
    mkfifo in; nc -l 5000 < in | bash > in 2>&1
    The 2>&1 causes all errors that bash reports, to be put into the pipe in as well, so that if you type in a bad command it will tell you.

    Do note: no promt is available, as bash is not running on a TTY.

    Code:
    nc localhost 5000
    and talk shell. standard commands like ps auxww, and whatnot all work. Only thing to watch out for, when bash dies, nc does not know. So you'd need to script it to check wether bash is dead or not, also, only one client at a time, but you never specified you need multiple. Otherwise it's still an easy fix, just a bit more scripting needed.
     
    Son Goku likes this.
  5. Son Goku

    Son Goku No lover of dogma

    OK, thx

    Actually a chat client is what the whole class was getting first...as the students started messaging each other in class :D

    The teacher mentioned 2 lines...I'm gathering you incorporated both into a single command line...
     
  6. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    no, i just put a semicolon between the two commands, this way the shell will execute them one after the other.