Netcat problem - please help - Questions

This is a discussion on Netcat problem - please help - Questions ; Hello, I'm trying to write a simple ftp-talk script using netcat. Now what I want to do is to make netcat wait for '220 FTP Server ready.' and send USER (whatever) than wait for '331 Pass req...' send PASS (whatever) ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Netcat problem - please help

  1. Netcat problem - please help

    Hello,

    I'm trying to write a simple ftp-talk script using netcat.
    Now what I want to do is to make netcat wait for '220 FTP Server ready.' and
    send USER (whatever) than wait for '331 Pass req...' send PASS (whatever)
    and so on.... Can somebody tell me how such a script suppose to look and how
    to pipe it thru netcat? I've tried to do that for 5 hours but I'm running
    out of ideas

    The best way is to make such a script that recognizes only the code of
    server message (for '220 FTP Server ready' it wopuld recognize only first
    three digits -> 220 ) Because the greetings and server messages are
    different for every server.

    TiA

    Best regards,
    Peter



  2. Re: Netcat problem - please help

    Piotrek wrote:
    > Hello,
    >
    > I'm trying to write a simple ftp-talk script using netcat.
    > Now what I want to do is to make netcat wait for '220 FTP Server ready.' and
    > send USER (whatever) than wait for '331 Pass req...' send PASS (whatever)
    > and so on.... Can somebody tell me how such a script suppose to look and how
    > to pipe it thru netcat? I've tried to do that for 5 hours but I'm running
    > out of ideas
    >
    > The best way is to make such a script that recognizes only the code of
    > server message (for '220 FTP Server ready' it wopuld recognize only first
    > three digits -> 220 ) Because the greetings and server messages are
    > different for every server.


    Try Bash shell's TCP support, ie. /dev/tcp/ftpserver/21. You'll be
    playing with file descriptors anyways, whether you use shell or netcat.

    --
    William Park, Open Geometry Consulting,
    Linux solution for data processing and document management.

  3. Re: Netcat problem - please help

    > Try Bash shell's TCP support, ie. /dev/tcp/ftpserver/21. You'll be
    > playing with file descriptors anyways, whether you use shell or netcat.


    Thanks but I must really do it with netcat. It's my homework



  4. Re: Netcat problem - please help

    "Piotrek" writes:

    > I'm trying to write a simple ftp-talk script using netcat.
    > Now what I want to do is to make netcat wait for '220 FTP Server ready.' and
    > send USER (whatever) than wait for '331 Pass req...' send PASS (whatever)
    > and so on.... Can somebody tell me how such a script suppose to look and how
    > to pipe it thru netcat? I've tried to do that for 5 hours but I'm running
    > out of ideas


    The good thing is that you are patient. :-)

    Anyways, did you check out nc(1) and look for the -e switch? Is
    it available for you?

    Vilmos

  5. Re: Netcat problem - please help


    > The good thing is that you are patient. :-)
    >
    > Anyways, did you check out nc(1) and look for the -e switch? Is
    > it available for you?


    No, it's not
    The only thing that I can do is

    (sleep 10
    echo USER blah
    sleep 5
    echo PASS blahblah) | nc -vv somehost 21

    But it's kind of dumb



+ Reply to Thread