Simple script para buscar patrones en cualquier directorio.
Código (perl) [Seleccionar]
#!usr/bin/perl
#FinderText 0.2
#Coded by Doddy H
head();
print "[+] Directory : ";
chomp( my $dir = <stdin> );
print "\n[+] String : ";
chomp( my $string = <stdin> );
print "\n[+] Searching text\n\n";
goodbye( $dir, $string );
copyright();
sub verificar {
my ( $file, $text ) = @_;
my $numero_linea = 0;
open( FILE, $file );
my @words = <FILE>;
close FILE;
chomp @words;
for my $linea (@words) {
chomp $linea;
$numero_linea++;
if ( $linea =~ /$text/ ) {
print "[+] Text $text Found in file $file in line $numero_linea\n";
}
}
}
sub goodbye {
opendir DIR, $_[0];
my @archivos = readdir DIR;
close DIR;
for (@archivos) {
next if $_ eq "." or $_ eq "..";
my $fichero = $_[0] . "/" . $_;
if ( -f $fichero ) {
verificar( $fichero, $_[1] );
}
if ( -d $fichero ) {
&goodbye( $fichero, $_[1] );
}
}
}
sub head {
print qq(
@@@@@ @ @ @@@@@
@ @ @ @
@ @ @ @
@ @ @ @@ @@@@ @@@ @@ @ @@@ @ @ @@
@@@@ @ @@ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @ @ @@@@@ @ @ @@@@@ @@ @
@ @ @ @ @ @ @ @ @ @ @@ @
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @@@@ @@@ @ @ @@@ @ @ @
);
}
sub copyright {
print "\n\n-- == Doddy Hackman 2012 == --\n\n";
<stdin>;
exit(1);
}
# The End ?