Created
September 8, 2015 19:05
-
-
Save jamesallman/11abd6d565c1ec437c1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my %HoH; | |
while (<>) { | |
next unless $. > 1; | |
chomp; | |
my @csv = split(/,/); | |
my ($epr, $source_ip, $destination_ip, $trf_port) = ($csv[0], $csv[5], $csv[6], $csv[4]); | |
$HoH{$epr}{source_ip}{$source_ip} = 1; | |
$HoH{$epr}{destination_ip}{$destination_ip} = 1; | |
$HoH{$epr}{trf_port}{$trf_port} = 1; | |
} | |
foreach my $epr ( keys %HoH ) { | |
print "set srcaddr { "; | |
foreach ( keys $HoH{$epr}{source_ip} ) { | |
print "\"$_\" "; | |
} | |
print "}\n"; | |
print "set dstaddr { "; | |
foreach ( keys $HoH{$epr}{destination_ip} ) { | |
print "\"$_\" "; | |
} | |
print "}\n"; | |
print "set service { "; | |
foreach ( keys $HoH{$epr}{trf_port} ) { | |
print "\"$_\" "; | |
} | |
print "}\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment