0,0 → 1,31 |
--- Nfcomm.pm.origin |
+++ Nfcomm.pm |
@@ -261,0 +262,25 @@ sub RunNfdump { |
+ #backward compatibility for filter checks |
+ if ( $args =~ s/(.*)\s?\-o\s+\"fmt:([^\"]*)\"\s?(.*)// ) { |
+ $$opts{'format'} = $2; |
+ $args = $1." ".$3; |
+ } |
+ my $format = $$opts{'format'}; |
+ if ( exists $$opts{'format'} and $$opts{'format'} ) { |
+ my @_tmp; |
+ foreach my $line ( split(/[^%a-z]/, $$opts{'format'}) ) { |
+ next if $line !~ /^\%/; |
+ |
+ unless ( $line =~ /^\%ff|ts|te|tr|td|pr|exp|eng|sa|da|sap|dap|sp|dp|sn|dn|nh|nhb|ra|sas|das|nas|pas|in|out|pkt|ipkt|opkt|byt|ibyt|obyt|fl|flg|tos|stos|dtos|dir|smk|dmk|fwd|svln|dvln|ismc|odmc|idmc|osmc|mpls1|mpls2|mpls3|mpls4|mpls5|mpls6|mpls7|mpls8|mpls9|mpls10|mpls|bps|pps|bpp|nfc|evt|xevt|msec|iacl|eacl|xsa|xda|xsp|xdp|xsap|xdap|uname|nevt|ivrf|evrf|nsa|nda|nsp|ndp|pbstart|pbend|pbstep|pbsize|cl|sl|al$/ ) { |
+ print $socket $EODATA; |
+ print $socket "ERR Illegal characters in format\n"; |
+ return; |
+ } |
+ } |
+ if ( $format =~ /[^\s!-~\n]+/ || $format =~ /['"`\\]/ ) { |
+ print $socket $EODATA; |
+ print $socket "ERR Illegal characters in format\n"; |
+ return; |
+ } |
+ $format = "-o \"fmt:".$$opts{'format'}."\""; |
+ } |
+ |
@@ -320 +345 @@ sub RunNfdump { |
- my $pid = open(NFDUMP, "$NfConf::PREFIX/nfdump $args '$filter' 2>&1|"); |
+ my $pid = open(NFDUMP, "$NfConf::PREFIX/nfdump $args $format '$filter' 2>&1|"); |