Bienvenido a Tecnohackers

Tecnohackers » General del foro » Area de Programacion » Scripting. VBS, Batch, Bash, JavaSript. (Moderador: Doddy)
 » 

[Perl] FinderText 0.1



Autor Tema: [Perl] FinderText 0.1  (Leído 14 veces)

Desconectado Doddy

  • Moderator
  • Veterano
  • *****
  • Mensajes: 267
  • Slow Mind
[Perl] FinderText 0.1
« en: Diciembre 01, 2011, 06:52:27 pm »
Un simple programa para buscar cierto texto en un archivo o directorio.

Código: No puedes ver links Registrate o Login
#!usr/bin/perl
#FinderText 0.1
#Written by Doddy H

print "\n-- == FinderText 0.1 == --\n\n";
unless($ARGV[0]) {
print "\n[+] sintax : $0 <file/dir> <text>\n";
} else {
print "\n[+] Searching text\n\n";
if (-f $ARGV[0]) {
verificar($ARGV[0],$ARGV[1]);
}
if (-d $ARGV[0]) {
goodbye($ARGV[0],$ARGV[1]);
}
print "\n[+] Finished\n";
}
print "\n\n[+] Written By Doddy H\n\n";

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/ig) {
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);
}}}

# The End ?
No puedes ver links Registrate o Login

Tags:

 

Related Topics

  Asunto / Iniciado por Respuestas Último mensaje
0 Respuestas
476 Vistas
Último mensaje Enero 24, 2010, 12:26:44 am
por Necrófero
2 Respuestas
442 Vistas
Último mensaje Mayo 09, 2011, 10:18:35 am
por scout
0 Respuestas
219 Vistas
Último mensaje Noviembre 03, 2010, 04:15:45 am
por zolo
0 Respuestas
13 Vistas
Último mensaje Febrero 11, 2012, 08:01:32 pm
por Doddy


SMF 2.0.2 | SMF © 2011, Simple Machines
Paginas Afiliadas
InfraBios - i-hacker - Twitter - FaceBook - Troyanosyvirus - LaWebDeGoku - daraxblog
Designed by Smf Personal