2598 |
tom.houday |
1 |
--- Nfcomm.pm.origin
|
|
|
2 |
+++ Nfcomm.pm
|
|
|
3 |
@@ -261,0 +262,25 @@ sub RunNfdump {
|
|
|
4 |
+ #backward compatibility for filter checks
|
|
|
5 |
+ if ( $args =~ s/(.*)\s?\-o\s+\"fmt:([^\"]*)\"\s?(.*)// ) {
|
|
|
6 |
+ $$opts{'format'} = $2;
|
|
|
7 |
+ $args = $1." ".$3;
|
|
|
8 |
+ }
|
|
|
9 |
+ my $format = $$opts{'format'};
|
|
|
10 |
+ if ( exists $$opts{'format'} and $$opts{'format'} ) {
|
|
|
11 |
+ my @_tmp;
|
|
|
12 |
+ foreach my $line ( split(/[^%a-z]/, $$opts{'format'}) ) {
|
|
|
13 |
+ next if $line !~ /^\%/;
|
|
|
14 |
+
|
|
|
15 |
+ 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$/ ) {
|
|
|
16 |
+ print $socket $EODATA;
|
|
|
17 |
+ print $socket "ERR Illegal characters in format\n";
|
|
|
18 |
+ return;
|
|
|
19 |
+ }
|
|
|
20 |
+ }
|
|
|
21 |
+ if ( $format =~ /[^\s!-~\n]+/ || $format =~ /['"`\\]/ ) {
|
|
|
22 |
+ print $socket $EODATA;
|
|
|
23 |
+ print $socket "ERR Illegal characters in format\n";
|
|
|
24 |
+ return;
|
|
|
25 |
+ }
|
|
|
26 |
+ $format = "-o \"fmt:".$$opts{'format'}."\"";
|
|
|
27 |
+ }
|
|
|
28 |
+
|
|
|
29 |
@@ -320 +345 @@ sub RunNfdump {
|
|
|
30 |
- my $pid = open(NFDUMP, "$NfConf::PREFIX/nfdump $args '$filter' 2>&1|");
|
|
|
31 |
+ my $pid = open(NFDUMP, "$NfConf::PREFIX/nfdump $args $format '$filter' 2>&1|");
|