- Details
- Kategorie: Perl
#!/usr/bin/perl
$DIR_IN=$ARGV[0];
$DIR_OUT=$ARGV[1];
if ($DIR_IN and $DIR_OUT){
opendir(DIR, $DIR_IN) or die "Das Verzeichnis $DIR_IN kann nicht gefunden werden: $!\n";
@files= grep { !/^\./ and /\.txt$/ } readdir(DIR);
closedir(DIR);
foreach $Datei (@files){
$Datei_neu=$Datei;
$Datei_neu=~ s/ /_/g;
$Datei=~ s/ /\\ /g;
print "cp $DIR_IN$Datei nach $DIR_OUT$Datei_neu kopiert\n";
`cp $DIR_IN$Datei $DIR_OUT$Datei_neu`;
}
}else{
print "Quell und Ziel-Verzeichnisse sind erforderlich!\n";
}
- Details
- Kategorie: Perl
Ein Skript, das tcpdump verwendet:
#!/usr/bin/perl
$LIMIT= shift || 50;
$|=1;
open(STDIN,"/usr/sbin/tcpdump -lnx -s 1024 dst port 80 |");
while (<>){
if(/^\S/){
last unless $LIMIT--;
while($packet=~/(GET|POST|WWW-Authenticate|Authorization).+/gx){
print "$client -> $host\t$&\n";
}
undef $client;
undef $host;
undef $packet;
($client,$host)=/(\d+\.\d+\.\d+\.\d+).+ > (\d+\.\d+\.\d+\.\d+)/x if /P \d+:\d+\((\d+)\)/ && $1 > 0;
}
next unless $client && $host;
s/\s+//;
s/([0-9a-f]{2})\s?/chr(hex($1))/eg;
tr/\x1F-\x7E\r\n//cd;
$packet .=$_;
}
Seite 3 von 4