• XSS.stack #1 – первый литературный журнал от юзеров форума

Скрипт скачиания на фтп

Elektrik

(L3) cache
Пользователь
Регистрация
03.05.2005
Сообщения
212
Реакции
0
Помгите плз найти скрипт который скачивал-бы файла на фтп. Просто у нас у провайдера трафик на ip принадлежащие ему бесплатен, а также имеются несколько крупных фтп, поэтому я подумал что если такой скрипт повесить на какой-нить отдельный сервак то можно качать всё нахаляву. Только скрипт нуже н с авторизацией на фтп. Заранее благодарен.
 
Код:
#perl -w

use strict;
use Net::FTP;

my $ftp=Net::FTP->new(Host=>"ftp.site.com",Timeout=>7)||die;
$ftp->login("anonymous","anon@")||die;
foreach($ftp->ls)
{
  if($ftp->get($_)) { print $_."downloaded\n" }
  else { print $_." download failed\n" }
}
$ftp->quit;
Вот, накидал побырику.
 
перебрасывает файлы с локальног окомпа на фтп
Код:
#!/usr/bin/perl

use Net::FTP;

# Config
$infoFile="login.txt";
$logFile="log.txt";
$currFile="current.txt";
$errorFile="errors.txt";
$path="upload";
$ftpServer="";
$ftpLogin="";
$ftpPass="";
$ftpTimeout=5;
$ftpTries=2;
$i=0;
# End of config

# Modes
$oneFileMode="";
$fullDelMode="";
$ftpMode="";
# End of modes

&initialize;
print "\n[+] $i files uploaded to $ftpServer\n";

sub initialize
{
unlink $errorFile if(-e $errorFile);
&readInfo();
print "\n[i] Connecting to FTP... ";
$ftp=Net::FTP->new(Host=>"$ftpServer",Timeout=>$ftpTimeout) or error("$ftpServer: $@\n")&&exit print "FAILED\n";
$ftp->login("$ftpLogin","$ftpPass") or error("$ftpServer: ".$ftp->message."\n")&&exit print "FAILED\n";
$ftp->pasv if($ftpMode eq "pasv");
$ftp->cwd("/Upload");
print "OK\n";
print "\n[i] Initializing... ";
if($oneFileMode ne "")
{
 print "\n[i] OneFileMode enabled!\n";
 &oneFileMode($oneFileMode);
}
if($fullDelMode ne "")
{
 print "\n[i] FullDelMode enabled!\n";
 &fullDelMode();
}
print "OK\n";
opendir(LOCAL,"$path") or exit print "\nCannot open source dir: $!\n";
my @files=readdir LOCAL;
close LOCAL;
foreach $file(@files)
{
 if(-d "$file" and $file ne "." and $file ne "..")
 {
  opendir(SUBDIR,"$file") or exit print "\nCannot open source's subdir: $!\n";
  my @subFiles=readdir SUBDIR;
  close SUBDIR;
  foreach $subFile(@subFiles)
  {
   next if($file eq "." or $file eq "..");
   upload($subFile);
  }
 }
 next if($file eq "." or $file eq "..");
 upload($file);
}
unlink $logFile;
}

sub readInfo
{
open(INFO,"$infoFile") or exit print "\nCannot open server info file: $!\n";
my @info=<INFO>;
close INFO;
foreach $string(@info)
{
 chomp($string);
 ($ftpServer,$ftpLogin,$ftpPass)=split(/\|/,$string);
 exit print "\n[-] Error retrieving info from $infoFile\n" if($ftpServer eq "" or $ftpLogin eq "" or $ftpPass eq "");
}
}

sub log
{
my $action=shift;
open(LOG,">>$logFile") or exit print "\nCannot open log file: $!\n";
print LOG "$action\n";
close LOG;
}

sub error
{
my $error=shift;
open(ERROR,">>$errorFile") or exit print "\nCannot open errors log file: $!\n";
print ERROR "$error\n";
close ERROR;
}

sub upload
{
my $file=shift;
$ftp->put("$path/$file") or exit print "\n[-] Upload failed!\n"&&error("$ftpServer: ".$ftp->message."\n");
log("$ftpServer: $file: uploaded\n");
$i++;
}

sub oneFileMode
{
my $oneFile=shift;
$ftp->put("$path/$oneFile") or exit print "\n[-] Upload failed in oneFileMode!\n"&&error("$ftpServer: ".$ftp->message."\n");
log("$ftpServer: $oneFile: uploaded in oneFileMode\n");
$i++;
}

sub fullDelMode
{
my @remoteFiles=$ftp->ls;
foreach $remoteFile(@remoteFiles)
{
 if($ftp->delete($remoteFile))
 {
  log("$ftpServer: $remoteFile: deleted in fullDelMode\n");
 }
 else
 {
  error("$ftpServer: $remoteFile: ".$ftp->message."\n");
 }
}
}

# ftp_uploader.pl
# (C)oded by .:[KSURi]:.
 
Пожалуйста, обратите внимание, что пользователь заблокирован
чё-то топик-стартер умер... тебе примеры подошли или что-то другое надо?
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх