WordPress Plugin check

Publicado por Perfil removido (última atualização em 14/10/2013)

[ Hits: 6.932 ]

Download wordpress.pl




Esse script gera a lista completa de plugins que existem no WordPress usando o repositório SVN do CMS, e também verifica quais plugins estão instalados em um site.

  



Esconder código-fonte

#!/usr/bin/perl
# By MMxM

use WWW::Mechanize;
use Getopt::Std;
use strict;
use threads;
use threads::shared;
use warnings;

our(%opts,@aa);
my($ini,$fin,@threads,$i,$arq,@a);

getopts('lf:p:t:s:o:', \%opts);

if($opts{'l'} && $opts{'f'}){
    print "\n\n[*] Making plugin list\n[+] Using wordpress svn repository\n\n";
    &list;
    exit(0);
}

if(!$opts{'s'} || !$opts{'o'} || !$opts{'t'} || !$opts{'p'}){
    &help;
}

open($arq,'<'.$opts{'p'}) || die($!);
@a = <$arq>;
close($arq);
@aa = grep { !/^$/ } @a;

my $stop :shared = 0;

$ini = 0;
$fin = $opts{'t'} - 1;
open(our $output,'>>'.$opts{'o'}) || die("failed to save plugins in file => ".$opts{'o'}."\n");
print "\n\n[*] Starting plugin check\n[*] Number of plugins to check => ".scalar(@aa)."\n\t[.K33p C4lm Br0.]\n\n";

while(1){
    @threads = ();

    for($i=$ini;$i<=$fin;$i++){
        push(@threads,$i);
    }

    foreach(@threads){
        $_ = threads->create(\&check);
    }

    foreach(@threads){
        $_->join();
    }

    print("\n\n [+] 100% complete\n[*] Plugins found are here => ".$opts{'o'}."\n") if $stop;
    close($output) if $stop;
    exit(0) if $stop;

    $ini = $fin + 1;
    $fin = $fin + $opts{'t'};
}

sub help {
    print '
    [*] WP Plugin Checker By MMxM

    [+] Options:

    -l => Generate plugin list
    -f => Output file to save plugin list
    -p => plugin list to test
    -t => threads number
    -s => Site
    -o => Output file to save found plugins

    [+] Examples of use:

    ./wp-check.pl -l -f /tmp/plugins.txt
    ./wp-check.pl -p /tmp/plugins.txt -s localhost/wp/ -o plugins-founds.txt -t 50

';
    exit(1);
}

sub check {
    my $id = threads->tid();
    $id--;
    if(defined($aa[$id])){
        chomp($aa[$id]);
        my $mech = WWW::Mechanize->new( autocheck => 0 );
        my $site;

        if($opts{'s'} !~ /^(http|https):\/\//){
            $site = 'http://'.$opts{'s'};
        } else {
            $site = $opts{'s'};
        }

        if($site !~ /\/$/){
            $site = $site.'/';
        }

        $mech->get($site.$aa[$id]);
        my $n = $id+1;
        print "\rNumber of plugins checked => ".$n;
        if($mech->status() =~ /40[0-9]/){
            return;
        } else {
            print $output $site.$aa[$id]."\n";
        }

    } else {
        $stop = 1;
        return;
    }
}

sub list {
    my $mech = WWW::Mechanize->new();
    $mech->get('http://plugins.svn.wordpress.org/');
    my @plugins;
    @plugins = $mech->links;
    my $del = scalar(@plugins);
    delete $plugins[$del-1];
    open(my $out,'>>'.$opts{'f'}) || die($!);
    print $out $_->text."\n" foreach(@plugins);
    close($out);
    $del--;
    print '[+] '.$del.' Saved plugins in '.$opts{'f'}."\n";
}

Scripts recomendados

Servidor BBS

HAT Googler

Gerir VirtualHosts do Apache

PDF completo com todas as páginas do Diário Oficial do Estado de Goiás

Capturar imagens de um site


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário