Re: PWDUMP Parser

From: Mr. Rufus Faloofus (foofus@foofus.net)
Date: Tue Jul 06 2004 - 19:28:09 EDT


On Tue, Jul 06, 2004 at 09:00:54AM -0700, Mike Anderson wrote:
> I have a rather large pwdump file (over 3000 accounts)
> that I am working with. I need to extract
> approximately 200 user names/hash pairs from it.
> Other than using notepad/word to do a find/search then
> copy and paste, does anyone know of a "pwdump parser"
> that is out there? I envision inputting a user name
> (or list of user names) and then having it return the
> user name and hash pair in a text file.

Perl is yer pal. Actually, so is grep, but whatever. Put
a list of names in one file, and your pwdump output in another:

open(INFILE,"namelist.txt");
@names=<INFILE>;
close(INFILE);
                                                                                                                                                                                                    
open(INFILE,"pwdumpfile.txt");
while(<INFILE>)
{
  $line=$_;
  chomp($line);
  @list=split(/:/,$line);
  foreach $name (@names)
  {
    chomp($name);
    if (@list[0] eq $name)
    {
      print "$line\n";
    }
  }
}
close(INFILE);

Hey! No laughing at my crappy perl!

--Foofus.



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:53:57 EDT