Re: PWDUMP Parser

From: H Carvey (keydet89_at_yahoo.com)
Date: 07/07/04

  • Next message: Michael Richardson: "Re: Raptor firewall 6.1 port 80"
    Date: 7 Jul 2004 10:48:07 -0000
    To: pen-test@securityfocus.com
    
    
    ('binary' encoding is not supported, stored as-is) In-Reply-To: <20040706160054.38308.qmail@web40907.mail.yahoo.com>

    >Already did some googling on this subject to no avail,
    >so I thought I would start here for an answer.
    >
    >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.

    A quick Perl script would do it for you...the below script takes a username as an arguement and dumps the username/hash pair to a file.

    #! c:\perl\bin\perl.exe
    use strict;
    my $userfile = shift || die "You must enter a filename.\n";
    my @users;
    if (-e $userfile) {
      open(FH,$userfile) || die "Could not open $userfile: $!\n";
      while(<FH>) {
        chomp;
        push(@users,$_);
      }
      close(FH);
    }
    else {
      die "Could not find $userfile.\n";
    }

    # Now we have a list populated by usernames.

    my $pwdumpfile = "path_to_pwdump_file";
    my $outfile = "path_to_textfile";
    my @hashlist;
    open(FH,$pwdumpfile) || die "Could not open $pwdumpfile: $!\n";
    foreach my $line (<FH>) {
      chomp $line;
      foreach my $user (@userlist) {
        push(@hashlist,$line) if ($line =~ m/^$user/i);
      }
    }
    close(FH);

    # now, dump list of usernames/hashes to a file
    open(FH,">>$outfile") || die "Could not open $outfile for writing: $!\n";
    foreach (@hashlist) {
      print FH $_."\n";
    }
    close(FH);

    HTH


  • Next message: Michael Richardson: "Re: Raptor firewall 6.1 port 80"

    Relevant Pages

    • Re: .htaccess from perl script?
      ... > I am trying to send a username and password from a perl script in ... > username and password entered correctly but the user has to click ok ... > password window showing. ... Note that passwords usually secure the whole site, so you may need to pass userid/password everytime you use get. ...
      (comp.lang.perl.misc)
    • .htaccess from perl script?
      ... I am trying to send a username and password from a perl script in ... order to access documents in a directory secured by a .htaccess file. ... username and password entered correctly but the user has to click ok ... password window showing. ...
      (comp.lang.perl.misc)
    • Re: Setting up mod_perl
      ... these are permissions of the directory and of the perl script in that ... (I also tried with my username instead of nobody. ...
      (comp.lang.perl.misc)
    • send username/password via perl script instead of using browser
      ... automate the authentication of the username and password. ... like to user a perl script but I'm not really sure about the steps. ... function resetear() { ...
      (comp.lang.perl)
    • pushing csv vaules into hash
      ... I need to split values from a csv value and push ... then perform a routine for all of them in a foreach ... address with the message containing their username and password. ... through them with once they are in the array, but then how do I get them ...
      (perl.beginners)