Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Automated FTP script and proxy server question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
hellranger
n00b
n00b


Joined: 10 Oct 2002
Posts: 17

PostPosted: Fri Mar 21, 2003 7:41 pm    Post subject: Automated FTP script and proxy server question Reply with quote

Hello ppl,

I ran into a problem I have never encountered before and here it comes.

I need to create a script tha goes thru a proxy server to fetch a file over a VPN tunnel.

I have to connect to a boxen called DUMMY:
Code:
ftp DUMMY



Then DUMMY is requesting a destination:
What destination you wish to conect to?:
Code:
username@password@ftpserver@172.168.1.4



The first param is the username, second is the password, third comes the ftpserver is have to connect to and last is the IP remote gateway. 8O

How can I pass the above string mentionned in the code section?

I am then prompted for a username and password for the remote host.
This part is easy once I can get passed the first request...


I would really appreciate the help...

Cheers,
Steven
Back to top
View user's profile Send private message
Jimbow
Guru
Guru


Joined: 18 Feb 2003
Posts: 597
Location: Silver City, NM

PostPosted: Fri Mar 21, 2003 7:58 pm    Post subject: Reply with quote

There is a scripting language called "expect" that is designed to deal with this sort of thing easily.
_________________
After Perl everything else is just assembly language.
Back to top
View user's profile Send private message
gfdsa
n00b
n00b


Joined: 01 Jul 2002
Posts: 74

PostPosted: Sat Mar 22, 2003 12:34 pm    Post subject: Reply with quote

here is a draft perl script to read/write from/to sockets.
the only thing i didnt use is getting it work with dataconnection, but i think you can try
anyway, if you wil need any help, ill be glad to experiment with it
Code:

#!/usr/bin/perl -w
use IO::Socket;
$sock = new IO::Socket::INET (PeerAddr => 'ip',
                              PeerPort => port,
                              Proto    => 'protocol');
die "$!" unless $sock;
#at this point you can do whatever you want with the socket
print $sock "";
while (defined($answer = <$sock>)){
        print $answer;
}

close($sock);
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum