This is a discussion on Netcat problem - please help within the Linux Networking forums, part of the Linux Forums category; Hello, I'm trying to write a simple ftp-talk script using netcat. Now what I want to do is ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
Piotrek <red.guy@gazeta.pl> 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, <opengeometry@yahoo.ca> Linux solution for data processing and document management. |
|
|||
|
"Piotrek" <red.guy@gazeta.pl> 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 |
|
|||
|
> 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 :( |