#!/usr/bin/perl use CGI ':standard'; use Net::FTP; BEGIN { #flush STDOUT immediately $| = 1; print header(-type=>'text/html'); } open(PAGE,">time.txt"); $now=localtime; print PAGE $now; close PAGE; $session=rand($numbers=1000); open STDERR, ">tmp/$session.txt"; if ($ENV{REQUEST_METHOD} ne "POST") { exit; } $username = param('user'); $password = param('pass'); $target = param('target'); $changed = param('changed'); $change = param('change'); $directory = param('dir'); $file = param('file'); $type = param('type'); if(param('redo')) { open(FILE,">tmp/$file"); $changed =~ s/\r\n/\n/g; $changed =~ s/\r/\n/g; $changed =~ s/tex-tarea/textarea/ig; print FILE $changed; close FILE; } &do_work; sub do_work { use Net::FTP; $ftp = Net::FTP->new("$target",Debug=>1); $ftp->login("$username","$password"); $ftp->cwd("$directory"); $ftp->type("A"); $ftp->put("tmp/$file","$file"); $ftp->size("$file"); $ftp->quit; } sub finish_up { unlink("tmp/$change.txt"); unlink("tmp/$file"); unlink("tmp/$session.txt"); } close STDERR; &show_data; sub show_data { print qq!!; print "

R e m o t e M a N a g e r

"; open(DATA,") { foreach($_=~/Net.*FTP=.*\)(.*)/ig) { $temp=$1; ($temp=~s/([A-Z]+[A-Z]+[A-Z].*)/$1<\/FONT>/g); ($temp=~s/(user\s.*)/$1<\/strong>/g); ($temp=~s/213(.*)/$1 BYTES<\/FONT>/g); print qq!

  • $temp!; } } } open(PAGE,">>time.txt"); $time=localtime; print PAGE $time; close PAGE; open(PAGE,") { $_=~/.*(\d\d)\s2000.*(\d\d)\s2000.*$/ig; $temp=$1; $tempa=$2; if ($tempa < $temp) { $tempa=($tempa+"60"); } $passed=($tempa-$temp); print "

    "; print "Your transaction took $passed seconds to complete"; } print "


    "; print qq!

    $file has been successfully edited and stored on your server.
    !; print qq!

    To return to the directory listing just click onto return.

    !; &finish_up; exit;