Netcat problem - please help

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 ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-03-2004
Piotrek
 
Posts: n/a
Default 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


Reply With Quote
  #2 (permalink)  
Old 03-03-2004
William Park
 
Posts: n/a
Default Re: Netcat problem - please help

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.
Reply With Quote
  #3 (permalink)  
Old 03-03-2004
Piotrek
 
Posts: n/a
Default 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 :)


Reply With Quote
  #4 (permalink)  
Old 03-03-2004
Vilmos Soti
 
Posts: n/a
Default Re: Netcat problem - please help

"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
Reply With Quote
  #5 (permalink)  
Old 03-03-2004
Piotrek
 
Posts: n/a
Default 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 With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:17 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0