#!/usr/bin/perl use CGI ':standard'; use Net::FTP; BEGIN { #flush STDOUT immediately $| = 1; print header(-type=>'text/html'); } $session=rand($numbers=1000); open STDERR, ">tmp/$session.txt"; if ($ENV{REQUEST_METHOD} ne "POST") { exit; } $username = param('username'); $password = param('password'); $target = param('target'); $url = param('lastvisit'); $this = param('this_'); $directory = param('dir'); use LWP::Simple; getstore("$url","tmp/$this"); &do_work; sub do_work { use Net::FTP; $ftp = Net::FTP->new("$target",Debug=>1); $ftp->login("$username","$password"); $ftp->cwd("$directory"); if (param('type') eq "binary") { $ftp->type("I"); } elsif (param('type') eq "ascii") { $ftp->type("A"); } $ftp->put("tmp/$this","$this"); if($this=~/.+\.pl|.+\.cgi/ig) { $ftp->site(CHMOD,755,"$this"); } $ftp->size("$this"); $ftp->quit; } sub finish_up { unlink("tmp/$this"); unlink("tmp/$session.txt"); } close STDERR; &show_data; sub show_data { print qq!
!;
open(DATA," Your transaction is complete.. ";
&finish_up;
exit;