http://www.perlmonks.org?node_id=997481


in reply to Re: Inserting domain name into Snort rule
in thread Inserting domain name into Snort rule

Im probably doing something wrong but I pulled out the join statement and plugged it in to a while loop to read the csv file and all I get are a bunch of |00|.


#!/usr/bin/perl

$work = "/var/tmp/work";
$input = "$work/domainlist.csv";

open (IN,"$input");
open (OUT,">domainlist.rules");
while (<IN>) {
  chomp();
  $domain = $_;

    print join '|', '', ( map { sprintf('%02d',length $domain), $domain } split /\./, shift ), '00', '';

}