in reply to Getting To Grips With Taint - And Picking Up Files
#! /usr/bin/perl -wT use strict; use warnings; my $dir = 'var/log/accounts'; opendir DIR, $dir or die "Cannot opendir $dir:$!\n"; my @files = grep !/^\.{1,2}$/,readdir DIR; closedir DIR; for (@files) { my $file = "$dir/$_"; open IN,$file or die "Cannot open $file:$!\n"; while (<IN>) { next if not /,/; my ($fullname,$username,$password,$domain,$service,$email,$upd +ates,$ip_addr) = split(/,/, $_); next if not $ip_addr; print "$fullname\t$username\t$password\t$domain\t$service\t$em +ail\t$updates\t$ip_addr\n"; } close IN; }
--
Regards,
Helgi Briem
helgi AT decode DOT is
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Getting To Grips With Taint - And Picking Up Files
by Anonymous Monk on Sep 30, 2002 at 17:06 UTC |