#!/usr/bin/perl use DB_File; $X = tie %h, "DB_File", "spwd.db", O_RDWR, 0600, $DB_HASH; @results = (); @fields = ( 0, 1, 2, 3, 5, 4, 9, 6, 7, 8 ); while( $X->seq($key, $value, R_NEXT) == 0 ) { @keyent = unpack("C", $key); if ($keyent[0] == 0x42) { @keyent = unpack("CN", $key); @pwent = unpack("Z*Z*NNNZ*Z*Z*Z*NN", $value); $result = ""; for ($i = 0; $i < 10; $i++) { if ($pwent[10] & (1 << $i)) { $result .= $pwent[$fields[$i]]; } if ($i < 9) { $result .= ":"; } } $results[$keyent[1]] = $result; } } foreach (@results) { print $_ . "\n"; } untie %h; |