Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 10 lines (10 sloc) 608 Bytes
#!/usr/bin/perl
use Socket;use FileHandle;sub usage{print"$0 -(p|g) addr[:p] f1 [f2]\n";exit;}
$|=1;*A=\@ARGV;(@A<3||$A[0]!~/-([pg])/)&&usage;$a=$1;$s=$A[1];$p=5051;if($A[1]=~
/([^:]+):(\d+)/){$s=$1;$p=$2;}socket S,AF_INET,SOCK_STREAM,0;$d=inet_aton($s)||
die"$s?!\n";connect(S,sockaddr_in $p,$d)||die"$!\n";S->autoflush;if($a eq'p'){$e
=$A[2];$v=$A[3]||($v=$e);open(F,"<$e")||die"$e:$!\n";$r=F;$w=S;print S"$a\n$v\n"
;$v=<S>;chomp $v;}if($a eq'g'){($v=$A[2])=~/\/?([^\/]+)$/;$e=$A[3]||($e=$1);open
(F,">$e")||die"$e:$!\n";$r=S;$w=F;print S"$a\n$v\n";}print"ftp [r:$v l:$e]\n";
while(<$r>){print $w $_;}
You can’t perform that action at this time.