${CMAKE_SOURCE_DIR}/tools/snort2lua
> ${input}
COMMAND ${CMAKE_COMMAND} -E copy ${input} ${output}
-- DEPENDS snort2lua
++ DEPENDS snort2lua ${CMAKE_CURRENT_LIST_DIR}/get_differences.rb
COMMENT "Documents: building config_changes.txt"
)
list (APPEND ALL_SOURCES ${output})
change: ac-std ==> ac_std
change: accumulate ==> reset = false
change: acs ==> ac_sparse
--change: addressspace_agnostic ==> address_space_agnostic
change: alert_unified2 ==> unified2
change: alt_max_param_len ==> cmd_validity
--change: autogenerate_preprocessor_decoder_rules ==> enable_builtin_rules
change: bind_to ==> bindings
change: bleedover-port-limit ==> bleedover_port_limit
change: bleedover-warnings-enabled ==> bleedover_warnings_enabled
change: block ==> base
--change: checksum_mode ==> checksum_eval
++change: config addressspace_agnostic ==> packets.address_space_agnostic
change: config alertfile: ==> alert_fast.file
change: config alertfile: ==> alert_full.file
++change: config autogenerate_preprocessor_decoder_rules ==> ips.enable_builtin_rules
++change: config checksum_mode ==> network.checksum_eval
++change: config daq ==> daq.type
++change: config daq_dir ==> daq.dir
++change: config daq_mode ==> daq.mode
++change: config daq_var ==> daq.var
++change: config detection_filter ==> alerts.detection_filter_memcap
++change: config disable_inline_init_failopen ==> packets.enable_inline_init_failopen
++change: config enable_deep_teredo_inspection ==> udp.deep_teredo_inspection
++change: config event_filter ==> alerts.event_filter_memcap
change: config file: file_block_timeout ==> block_timeout
change: config file: file_lookup_timeout ==> lookup_timeout
change: config file: file_signature_depth ==> signature_depth
change: config file: file_type_depth ==> type_depth
change: config file: signature ==> enable_signature
change: config file: type_id ==> enable_type
++change: config max_attribute_hosts ==> attribute_table.max_hosts
++change: config max_attribute_services_per_host ==> attribute_table.max_services_per_host
change: config mpls_payload_type: ethernet ==> mpls_payload_type = eth
change: config mpls_payload_type: ipv4 ==> mpls_payload_type = ip4
change: config mpls_payload_type: ipv6 ==> mpls_payload_type = ip6
--change: daq ==> type
--change: daq_dir ==> dir
--change: daq_mode ==> mode
--change: daq_var ==> var
++change: config nopcre ==> detection.pcre_enable
++change: config pkt_count ==> packets.limit
++change: config policy_mode ==> ips.mode
++change: config rate_filter ==> alerts.rate_filter_memcap
++change: config react ==> react.page
++change: config threshold ==> alerts.event_filter_memcap
change: data_chan ==> ignore_data_chan
change: debug-pkts ==> debug_pkts
change: debug-print-fast-pattern ==> debug_print_fast_pattern
change: debug-print-rule-group-build-details ==> debug_print_rule_group_build_details
change: debug-print-rule-groups-compiled ==> debug_print_rule_groups_compiled
change: debug-print-rule-groups-uncompiled ==> debug_print_rule_groups_uncompiled
--change: detection_filter ==> detection_filter_memcap
change: dgmlen ==> dgm_len
--change: disable_inline_init_failopen ==> enable_inline_init_failopen
change: disabled ==> enable
change: dont_reassemble_async ==> reassemble_async
change: dstport ==> dst_port
change: dynamicsidechannel ==> plugin_path
change: enable-single-rule-group ==> enable_single_rule_group
change: enable_cookie ==> enable_cookies
--change: enable_deep_teredo_inspection ==> deep_teredo_inspection
change: enabled ==> enable
change: ethdst ==> eth_dst
change: ethlen ==> eth_len
change: ethsrc ==> eth_src
--change: event_filter ==> event_filter_memcap
change: fastpath-expensive-packets ==> fastpath_expensive_packets
change: filename ==> file
change: flow-file ==> flow_file = true
change: max-pkt-time ==> max_pkt_time
change: max-rule-time ==> max_rule_time
change: max_active_responses ==> max_responses
--change: max_attribute_hosts ==> max_hosts
--change: max_attribute_services_per_host ==> max_services_per_host
change: max_icmp ==> max_sessions
change: max_ip ==> max_sessions
change: max_queued_bytes ==> queue_limit.max_bytes
change: min_fragment_length ==> min_frag_length
change: min_response_seconds ==> min_interval
change: non_rfc_char ==> non_rfc_chars
--change: nopcre ==> pcre_enable
change: overlap_limit ==> max_overlaps
change: pad ==> base
change: paf_max [0:63780] ==> paf_max [1460:63780]
change: pkt-log ==> pkt_log
--change: pkt_count ==> limit
change: pktcnt ==> packets
change: policy bsd-right ==> policy = bsd_right
--change: policy_mode ==> mode
change: ports ==> bindings
change: ports ==> gtp_ports
change: post_depth [-1:65495] ==> post_depth [-1:65535]
change: preprocessor frag3_engine: timeout 0 ==> session_timeout 256
--change: preprocessor normalize_icmp4 ==> icmp4 == <bool>
--change: preprocessor normalize_icmp6 ==> icmp6 == <bool>
--change: preprocessor normalize_ip6 ==> ip6 == <bool>
++change: preprocessor normalize_icmp4 ==> normalize.icmp4
++change: preprocessor normalize_icmp6 ==> normalize.icmp6
++change: preprocessor normalize_ip6 ==> normalize.ip6
change: print ==> count
change: proto ==> protos
change: prune_log_max ==> histogram
--change: rate_filter ==> rate_filter_memcap
--change: react ==> page
change: req_pay ==> base
change: req_urg ==> base
change: req_urp ==> base
change: tcplen ==> tcp_len
change: tcpseq ==> tcp_seq
change: tcpwindow ==> tcp_win
--change: threshold ==> event_filter_memcap
change: time ==> seconds
change: timeout ==> session_timeout
change: trim_mss ==> trim
# CONST REG_EX. DO NOT CHANGE
delete_pattern = /add_deleted_comment\(\"(.*)\"\);/
diff_pattern = /add_diff_option_comment\(\"(.*)\",\s?\"(.*)\"\)/
--template_diff = /<\s*&(.*),.*,\s*&(.*)>/
++template_diff = /<\s*&(.*),\s*&(.*),\s*&(.*)>/
config_delete_template = /deleted_ctor<&(.*)>/
paths_diff = /paths_ctor<\s*&(.*)\s*>/ # check kws_paths.cc
normalizers_diff = /norm_sans_options_ctor<\s?&(.*)>/ # check pps_normalizers
if line =~ diff_pattern
arr << "change: #{$1} ==> #{$2}"
--
end
if line =~ template_diff
-- arr << "change: #{$1} ==> #{$2}"
++ arr << "change: config #{$1} ==> #{$2}.#{$3}"
end
if line =~ config_delete_template
end
if line =~ normalizers_diff
-- arr << "change: preprocessor normalize_#{$1} ==> #{$1} == <bool>"
++ arr << "change: preprocessor normalize_#{$1} ==> normalize.#{$1}"
end
if line =~ unified2_diff
struct Pseudoheader6
{
-- uint32_t sip[4], dip[4];
++ uint32_t sip[4];
++ uint32_t dip[4];
uint8_t zero;
uint8_t protocol;
uint16_t len;
struct Pseudoheader
{
-- uint32_t sip, dip;
++
++ uint32_t sip;
++ uint32_t dip;
uint8_t zero;
uint8_t protocol;
uint16_t len;
namespace detail
{
++
++struct PsuedoheaderUnion
++{
++ union
++ {
++ Pseudoheader ph4;
++ uint16_t ph4_arr[12];
++ };
++};
++
++struct Psuedoheader6Union
++{
++ union
++ {
++ Pseudoheader ph6;
++ uint16_t ph6_arr[18];
++ };
++};
++
static inline uint16_t cksum_add(const uint16_t *buf, std::size_t len, uint32_t cksum)
{
const uint16_t *sp = buf;
}
--static inline void add_ipv4_pseudoheader(const uint16_t* const h,
++static inline void add_ipv4_pseudoheader(const Pseudoheader* const ph4,
uint32_t &cksum)
{
++ /*
++ * This mess is necessary to make static analyzers happy.
++ * Otherwise they assume we are reading garbage values
++ */
++ const PsuedoheaderUnion* const ph4_u = reinterpret_cast
++ <const PsuedoheaderUnion* const>(ph4);
++ const uint16_t* const h = ph4_u->ph4_arr;
++
/* ipv4 pseudo header must have 12 bytes */
cksum += h[0];
cksum += h[1];
}
--static inline void add_ipv6_pseudoheader(const uint16_t* const h,
++static inline void add_ipv6_pseudoheader(const Pseudoheader6* const ph6,
uint32_t &cksum)
{
-- /* PseudoHeader must have 36 bytes */
-- cksum += h[0];
-- cksum += h[1];
-- cksum += h[2];
-- cksum += h[3];
-- cksum += h[4];
-- cksum += h[5];
-- cksum += h[6];
-- cksum += h[7];
-- cksum += h[8];
-- cksum += h[9];
-- cksum += h[10];
-- cksum += h[11];
-- cksum += h[12];
-- cksum += h[13];
-- cksum += h[14];
-- cksum += h[15];
-- cksum += h[16];
-- cksum += h[17];
++ /*
++ * This mess is necessary to make static analyzers happy.
++ * Otherwise they assume we are reading garbage values
++ */
++ const Psuedoheader6Union* const ph6_u = reinterpret_cast
++ <const Psuedoheader6Union* const>(ph6);
++ const uint16_t* const h = ph6_u->ph6_arr;
++
++ /* PseudoHeader must have 36 bytes */
++ cksum += h[0];
++ cksum += h[1];
++ cksum += h[2];
++ cksum += h[3];
++ cksum += h[4];
++ cksum += h[5];
++ cksum += h[6];
++ cksum += h[7];
++ cksum += h[8];
++ cksum += h[9];
++ cksum += h[10];
++ cksum += h[11];
++ cksum += h[12];
++ cksum += h[13];
++ cksum += h[14];
++ cksum += h[15];
++ cksum += h[16];
++ cksum += h[17];
}
{
uint32_t cksum = 0;
-- detail::add_ipv6_pseudoheader((const uint16_t* const)ph, cksum);
++ detail::add_ipv6_pseudoheader(ph, cksum);
return detail::cksum_add(buf, len, cksum);
}
{
uint32_t cksum = 0;
-- detail::add_ipv4_pseudoheader((const uint16_t* const)ph, cksum);
++ detail::add_ipv4_pseudoheader(ph, cksum);
detail::add_tcp_header(h, len, cksum);
return detail::cksum_add(h, len, cksum);
}
{
uint32_t cksum = 0;
-- detail::add_ipv6_pseudoheader((const uint16_t* const)ph, cksum);
++ detail::add_ipv6_pseudoheader(ph, cksum);
detail::add_tcp_header(buf, len, cksum);
return detail::cksum_add(buf, len, cksum);
}
{
uint32_t cksum = 0;
-- detail::add_ipv4_pseudoheader((const uint16_t* const)ph, cksum);
++ detail::add_ipv4_pseudoheader(ph, cksum);
detail::add_udp_header(buf, len, cksum);
return detail::cksum_add(buf, len, cksum);
}
{
uint32_t cksum = 0;
-- detail::add_ipv6_pseudoheader((const uint16_t* const)ph, cksum);
++ detail::add_ipv6_pseudoheader(ph, cksum);
detail::add_udp_header(buf, len, cksum);
return detail::cksum_add(buf, len, cksum);
}
ehlib_LTLIBRARIES += libcd_llc.la
libcd_llc_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
libcd_llc_la_LDFLAGS = -export-dynamic -shared
--libcd_llc_la_SOURCES = libcd_llc.cc
++libcd_llc_la_SOURCES = cd_llc.cc
ehlib_LTLIBRARIES += libcd_gtp.la
libcd_gtp_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
return false;
}
-- ip_len = ntohs(ip4h->get_len());/* set the IP datagram length */
hlen = ip4h->get_hlen() << 2; /* set the IP header length */
if(raw_len < hlen)
ParseError("content hexmode argument has invalid "
"number of hex digits. The argument '%s' "
"must contain a full even byte string.", current_ptr);
++ free(hex);
return (uint8_t*)"";
}
else
{
ParseError("'%c' is not a valid hex value, please input hex values (0x0 - 0xF)",
-- (char) *current_ptr);
++ (char) *current_ptr);
++ free(hex);
return (uint8_t*)"";
}
else
{
ParseError("'%c' is not a valid hex value, please input hex values (0x0 - 0xF)",
-- (char) *current_ptr);
++ (char) *current_ptr);
++ free(hex);
return (uint8_t*)"";
}
DEBUG_WRAP(DebugMessage(DEBUG_FILE,"Hex buffer: %s\n", hex_buf););
if (file_config->FileRules[rule->id])
{
ParseError("file type: duplicated rule id %d defined!", rule->id);
++ free(rule);
return;
}
file_config->FileRules[rule->id] = rule;
}
if (j < opts_len)
-- TextLog_Print(log, "%02x", opts[i].data[j]);
++ TextLog_Print(log, "%02x", 0);
}
TextLog_Putc(log, ' ');
noinst_LIBRARIES = libloggers.a
libloggers_a_SOURCES = \
alert_luajit.cc \
++log_codecs.cc \
loggers.cc \
loggers.h
mod_ctor,
mod_dtor
},
-- (OUTPUT_TYPE_FLAG__LOG | OUTPUT_TYPE_FLAG__ALERT),
++ OUTPUT_TYPE_FLAG__LOG,
codec_log_ctor,
codec_log_dtor
};
--const BaseApi* eh_codecs = &log_codecs_api.base;
++const BaseApi* log_codecs = &log_codecs_api.base;
#include "framework/logger.h"
// to ensure PacketManager::log_protocols() is built into Snort++
--extern const BaseApi* eh_codecs;
++extern const BaseApi* log_codecs;
extern const BaseApi* log_luajit;
#ifdef LINUX
eh_unified2,
#endif
// loggers
++ log_codecs,
log_luajit,
// both
-- eh_codecs,
nullptr
};
state = 3;
break;
case 5: // unquoted escape
-- if ( c == '\n' )
-- state = 0;
-- else if ( c != '\r' )
++ if ( c != '\n' && c != '\r' )
printf("error: invalid escape on line %d\n", lines);
state = 0;
break;
#include "config.h"
#endif
++#include <string>
++#include <limits>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hi_util_xmalloc.h"
//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d!\n",__FILE__,__LINE__);exit(0);}
--
#define MEMASSERT(p)
--#define LOWERCASE tolower
++
/*
*
*/
int KMapAdd( KMAP *km, void * key, int n, void * userdata )
{
-- int i,ksize;
-- int type = 0;
-- unsigned char *P = (unsigned char *)key;
-- KMAPNODE *root;
-- unsigned char xkey[256];
++ int i,ksize;
++ int type = 0;
++ const unsigned char *P = (unsigned char *)key;
++ KMAPNODE *root;
++ std::string xkey;
if( n <= 0 )
{
-- n = strlen( (char*) key );
-- if( n > (int)sizeof(xkey) )
++ std::size_t tmp_len = strlen( (char*) key);
++ if (tmp_len > std::numeric_limits<int>::max())
return -99;
++
++ n = tmp_len;
}
if( km->nocase )
{
++ xkey.resize(n);
++
for(i=0;i<n;i++)
-- xkey[i] = LOWERCASE( P[i] );
-- P = xkey;
++ xkey[i] = std::tolower( P[i] );
++
++ P = (const unsigned char*) xkey.c_str();
}
/* Save key size */
*/
void * KMapFind( KMAP * ks, void * key, int n )
{
-- unsigned char * T = (unsigned char *)key;
-- KMAPNODE * root;
-- unsigned char xkey[256];
-- int i;
++ const unsigned char * T = (unsigned char *)key;
++ KMAPNODE * root;
++ std::string xkey;
++ int i;
if( n <= 0 )
{
-- n = strlen( (char*)key );
-- if( n > (int)sizeof(xkey) )
-- return 0;
++ std::size_t tmp_len = strlen( (char*) key);
++ if (tmp_len > std::numeric_limits<int>::max())
++ return nullptr;
++ n = tmp_len;
}
++
if( ks->nocase )
{
++ xkey.resize(n);
for(i=0;i<n;i++)
-- xkey[i] = LOWERCASE( T[i] );
++ xkey[i] = std::tolower( T[i] );
-- T = xkey;
++ T = (const unsigned char*)(xkey.c_str());
}
//printf("finding key='%.*s'\n",n,T);
#include "config.h"
#endif
++#include <string>
++#include <limits>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hi_util_xmalloc.h"
//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d!\n",__FILE__,__LINE__);exit(0);}
--
#define MEMASSERT(p)
--#define LOWERCASE tolower
/*
*
{
int i,ksize;
int type = 0;
-- unsigned char *P = (unsigned char *)key;
++ const unsigned char *P = (unsigned char *)key;
KMAPNODE *root;
-- unsigned char xkey[256];
++ std::string xkey;
if( n <= 0 )
{
-- n = strlen( (char*) key );
-- if( n > (int)sizeof(xkey) )
++ const std::size_t tmp_len = strlen( (char*) key);
++ if (tmp_len > std::numeric_limits<int>::max())
return -99;
++
++ n = (int) tmp_len;
}
if( km->nocase )
{
++ xkey.resize(n);
++
for(i=0;i<n;i++)
-- xkey[i] = LOWERCASE( P[i] );
-- P = xkey;
++ xkey[i] = std::tolower( P[i] );
++
++ P = (const unsigned char*)xkey.c_str();
}
/* Save key size */
*/
void * KMapFind( KMAP * ks, void * key, int n )
{
-- unsigned char * T = (unsigned char *)key;
-- KMAPNODE * root;
-- unsigned char xkey[256];
-- int i;
++ const unsigned char * T = (unsigned char *)key;
++ KMAPNODE * root;
++ int i;
++ std::string xkey;
if( n <= 0 )
{
-- n = strlen( (char*)key );
-- if( n > (int)sizeof(xkey) )
-- return 0;
++ const std::size_t tmp_len = strlen( (char*) key);
++ if (tmp_len > std::numeric_limits<int>::max())
++ return nullptr;
++ n = (int) tmp_len;
}
++
if( ks->nocase )
{
++ xkey.resize(n);
for(i=0;i<n;i++)
-- xkey[i] = LOWERCASE( T[i] );
++ xkey[i] = std::tolower( T[i] );
-- T = xkey;
++ T = (const unsigned char*)xkey.c_str();
}
//printf("finding key='%.*s'\n",n,T);
if(!table || !str || !ipret) return SFIP_FAILURE;
/* Creates the variable */
-- if( (var = sfvar_alloc(table, str, &status)) == NULL )
++ var = sfvar_alloc(table, str, &status);
++ if( var == NULL )
{
return status;
}
if(cc < 0)
{
ParseError("read %s: %s\n", fname, get_error(errno));
++ free(cp);
return nullptr;
}
if(cc != buf.st_size)
{
ParseError("short read %s (%d != %d)\n", fname, cc, (int) buf.st_size);
++ free(cp);
return nullptr;
}
{
ParseError("SetChroot: Can not chdir to \"%s\": %s\n", directory,
get_error(errno));
++ free(logdir);
return;
}
if(absdir == NULL)
{
ParseError("NULL Chroot found\n");
++ free(logdir);
return;
}
{
ParseError("Can not chroot to \"%s\": absolute: %s: %s\n",
directory, absdir, get_error(errno));
++ free(logdir);
return;
}
{
ParseError("Can not chdir to \"/\" after chroot: %s\n",
get_error(errno));
++ free(logdir);
return;
}
if(strncmp(absdir, logdir, strlen(absdir)))
{
ParseError("Absdir is not a subset of the logdir");
++ free(logdir);
return;
}
logdir, *logstore));
LogMessage("Chroot directory = %s\n", directory);
++ free(logdir);
}
int PNormDecode(char *src, uint16_t srclen, char *dst, uint16_t dstlen, uint16_t *bytes_copied, JSState *js)
{
-- int iRet;
++ int iRet = RET_OK;
const char *end;
char *ptr;
PNormState s;
int JSNormalizeDecode(char *src, uint16_t srclen, char *dst, uint16_t destlen, char **ptr, int *bytes_copied, JSState *js, uint8_t* iis_unicode_map)
{
-- int iRet;
++ int iRet = RET_OK;
const char *start, *end;
JSNormState s;