jbush82 has asked for the wisdom of the Perl Monks concerning the following question:
#!C:\perl\bin\perl.exe -w use strict; my @known_bad; #eac +h element is a line within the knownbad.txt file open(FILE, "knownbad.txt") or die("Unable to open file"); @known_bad = <FILE>; close(FILE); my $bad_data; my $bad_file; my $bad_md5; my $bad_file_array_element; my %bad_file_md5; foreach $bad_data (@known_bad) { + #take data from knownbad.txt file and parse it into a hash chomp($bad_data); ($bad_file, $bad_md5) = split(/\,/, $bad_data); push(@{ $bad_file_md5{"$bad_file"} }, "$bad_md5"); } my $system_file_location; my $system_file; my %system_file_data; #open FILES, "psexec.exe -n 2 \\\\192.168.1.10 cmd.exe \/C dir C\:\\ \ +/S \/B |" or die; open FILES, "cmd.exe \/C dir C\:\\ \/S \/B |" or die; + #take data from directory listing and parse it into a +hash while ( <FILES> ) { ( $system_file_location, $system_file ) = m/(.*)[\\\/](.+)/ ? +( $1, $2 ) : ( undef, $_ ); # print "$system_file is in the directory $system_file_location +\n"; push(@{ $system_file_data{"$system_file"} }, "$system_file_loc +ation"); } close FILES;
$VAR1 = { 'arbies.dll' => [ '388B8FBC36A8558587AFC90FB23A3B99' ], 'psexec.exe' => [ '78A2C9D79C21DDFCB7CED32F5EBEC618', '388B8FBC36A8558587AFC90FB23A3B99' ], 'notepad.exe' => [ '388B8FBC36A8558587AFC90FB23A3B99' ], 'angelfood.txt' => [ '388B8FBC36A8558587AFC90FB23A3B99' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to get the intersect of hashes
by grizzley (Chaplain) on May 15, 2008 at 07:39 UTC | |
by Anonymous Monk on May 15, 2008 at 16:48 UTC | |
by jbush82 (Novice) on May 15, 2008 at 07:54 UTC | |
by moritz (Cardinal) on May 15, 2008 at 08:15 UTC | |
by jbush82 (Novice) on May 15, 2008 at 08:30 UTC | |
by grizzley (Chaplain) on May 15, 2008 at 08:12 UTC | |
by jbush82 (Novice) on May 15, 2008 at 08:28 UTC | |
by moritz (Cardinal) on May 15, 2008 at 08:37 UTC | |
| |
by grizzley (Chaplain) on May 15, 2008 at 08:40 UTC | |
| |
by ikegami (Patriarch) on May 15, 2008 at 15:11 UTC | |
|
Re: Need to get the intersect of hashes
by pc88mxer (Vicar) on May 15, 2008 at 15:48 UTC |