
![]() |
nop_90
small example how to upload with ftp with threads using
perl.domains.lst -> file containing sites ie spammy.somesite.com username in this case would be spammy. where script is are contained folders named like "spammy.somesite.com" that matches list in domains.lst #!/usr/bin/ perl-wuse strict; use warnings; use threads; use Thread::Queue; use Net::FTP;sub readlines { my($filename, @lines); ($filename) = @_; open FREEHOSTS, "<$filename"; while (my $line = <FREEHOSTS> ![]() chomp($line); push @lines,$line; } close FREEHOSTS; return @lines; } my $ftp_password : shared; $ftp_password = "secret"; my $DomainQueue = Thread::Queue->new; $DomainQueue->enqueue(readlines("domains.lst" ![]() print $DomainQueue->pending . " "; my @thrs; for(my $thr_id=0;$thr_id<6;$thr_id++) { my $thr = threads->new(sub { while (my $domain = $DomainQueue->dequeue_nb) { print "starting $domain "; my @parts = split("\.",$domain); my $ftp_user = shift @parts; next unless my $ftp = Net::FTP->new($domain, Debug => 0);next unless $ftp->login($ftp_user,$ftp_password); foreach my $filename (glob($domain . "/*.html" ![]() $ftp->put($filename); } $ftp->quit(); print "done $domain "; }}); push(@thrs,$thr); } foreach my $thr (@thrs) { $thr->join; } |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads