Posted on 2006-09-15 00:08:33-07 by o10222
SOCKS connections using another module
#!/usr/bin/perl -w use Net::SFTP; use Net::SOCKS; my $port = '22' ; my %args = ( user => 'ID', password => 'passwd' , debug => 'true' ); my $ip = '192.168.197.134' ; my $sock = new Net::SOCKS(socks_addr => '192.168.158.50', socks_port => 1090, user_id => 'ID', user_password => 'passwd' , protocol_version => 5 ); my $bind = $sock->bind(peer_addr =>'192.168.197.134',peer_port =>'$port'); print "bind status: ", Net::SOCKS::status_message($sock->param('status_num')), "\n"; my $sftp = Net::SFTP->new($ip,%args); $sftp->get("/inbox/education/DropQuickReference.pdf", "/usr/local/download/DropQuickReference.pd +f"); $sock ->close(); exit ; I have the PERL SOCKS module connecting to the remote site via out SOCKS GATEWAY/PROXY Now I need to use NET::SFTP to retreive files. But when I try and call Net::SFTP I get errors: In debug mode here is the out put: my $bind = $sock->bind(peer_addr =>'192.168.197.134',peer_port =>'$port'); bind status: okay main::(ibm-via-socks.pl:26): my $sftp = Net::SFTP->new($ip,%args); DB<1> n test1: Reading configuration data /root/.ssh/config test1: Reading configuration data /etc/ssh_config test1: Allocated local port 1023. test1: Connecting to 192.168.197.134, port 22. Net::SSH::Perl::_connect(/usr/lib/perl5/5.8.8/perl5db.pl:7681): This looks like it try to use the loca machine test1 local port. I want to use the SOCKS tunnel created in bind step. I know I am doing it wrong but cannot find any doco on using another Perl Module in side of another +. By the way if I move system to raw internet connection the NET::SFTP perl portion will work fine. Thanks for your time and ideas. bryan
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.