Networking Forums

Networking Forums > Computer Networking > Linux Networking > Netcat problem - please help

Reply
Thread Tools Display Modes

Netcat problem - please help

 
 
Piotrek
Guest
Posts: n/a

 
      03-03-2004, 04:39 PM
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
 
 
 
 
William Park
Guest
Posts: n/a

 
      03-03-2004, 04:44 PM
Piotrek <(E-Mail Removed)> 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, <(E-Mail Removed)>
Linux solution for data processing and document management.
 
Reply With Quote
 
Piotrek
Guest
Posts: n/a

 
      03-03-2004, 04:50 PM
> 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
 
Vilmos Soti
Guest
Posts: n/a

 
      03-03-2004, 05:33 PM
"Piotrek" <(E-Mail Removed)> 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
 
Piotrek
Guest
Posts: n/a

 
      03-03-2004, 06:37 PM

> 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
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use netcat??? Kolyn_Kryw Windows Networking 1 04-11-2008 04:14 PM
Problem when using netcat( nc ) to debug network program Steven Woody Linux Networking 0 07-18-2007 10:52 AM
Problem opening a listening port using netcat ( or other server ) bradphelan Linux Networking 3 10-06-2006 08:04 PM
netcat for win2k Mike - EMAIL IGNORED Linux Networking 3 03-09-2006 10:57 PM
netcat problem Oliver Cole Linux Networking 2 09-15-2003 11:04 PM



1 2 3 4 5 6 7 8 9 10 11