if test "x$DNET_H" = "xno" -a "x$DUMBNET_H" = "xno"; then
echo
echo " ERROR: dnet header not found, go get it from"
- echo " http://code.google.com/p/libdnet/ or use the --with-dnet-*"
+ echo " https://github.com/dugsong/libdnet.git or use the --with-dnet-*"
echo " options, if you have it installed in an unusual place"
exit
fi
int hit = 0, miss = 0;
impl->stop = 0;
- while ( hit < cnt || cnt <= 0 )
+ while ( (hit < cnt || cnt <= 0) && !impl->stop )
{
int status = file_daq_process(impl, callback, user);
else if ( status < 0 )
return status;
- else if ( ++miss == 2 || impl->stop )
+ else if ( ++miss == 2 )
break;
}
return DAQ_SUCCESS;
ERROR: invalid perf_monitor.max_file_size = 4.29497e+09
-* Using -L when -c is also used will not actually log; nor will it warn or
- error out. This is likely to confuse.
+* When using -c and -L together, the last on the command line wins (-c -L
+ will dump; -L -c will analyze).
+
+* Modules instantiated by command line only will not get default settings
+ unless hard-coded. This notably applies to -A and -L options.
==== Rules
* daq from http://www.snort.org for packet IO
-* dnet from http://code.google.com/p/libdnet/ for network utility functions
+* dnet from https://github.com/dugsong/libdnet.git for network utility functions
* LuaJIT from http://luajit.org for configuration and scripting
Process hext packets from stdin:
snort -c $my_path/etc/snort/snort.lua \
- --plugin-path $my_path/lib/snort_extra \
- --daq-dir $my_path/lib/snort_extra/daqs --daq hext -i tty << END
+ --daq-dir $my_path/lib/snort/daqs --daq hext -i tty << END
$packet 10.1.2.3 48620 -> 10.9.8.7 80
"GET / HTTP/1.1\r\n"
"Host: localhost\r\n"
Process raw ethernet from hext file:
snort -c $my_path/etc/snort/snort.lua \
- --plugin-path $my_path/lib/snort_extra \
- --daq-dir $my_path/lib/snort_extra/daqs --daq hext \
+ --daq-dir $my_path/lib/snort/daqs --daq hext \
--daq-var dlt=1 -r <hext-file>
-Process a directory of plain files (ie non-pcap) with 4 threads:
+Process a directory of plain files (ie non-pcap) with 4 threads with 8K
+buffers:
snort -c $my_path/etc/snort/snort.lua \
- --plugin-path $my_path/lib/snort_extra \
- --daq-dir $my_path/lib/snort_extra/daqs --daq file \
- --pcap-dir path/to/files -z 4
+ --daq-dir $my_path/lib/snort/daqs --daq file \
+ --pcap-dir path/to/files -z 4 -s 8192
Bridge two TCP connections on port 8000 and inspect the traffic:
snort -c $my_path/etc/snort/snort.lua \
- --plugin-path $my_path/lib/snort_extra \
- --daq-dir $my_path/lib/snort_extra/daqs --daq socket
+ --daq-dir $my_path/lib/snort/daqs --daq socket
==== Logger Alternatives
Dump TCP stream payload in hext mode:
- snort -c $my_path/etc/snort/snort.lua \
- --plugin-path $my_path/lib/snort_extra -L hext
+ snort -c $my_path/etc/snort/snort.lua -L hext
Output timestamp, pkt_num, proto, pkt_gen, dgm_len, dir, src_ap, dst_ap,
rule, action for each alert:
add_example_library(alert_ex loggers alert_ex.cc)
-add_example_library(log_hext loggers log_hext.cc)
install (
FILES alert.lua
libalert_ex_la_LDFLAGS = -export-dynamic -shared
libalert_ex_la_SOURCES = alert_ex.cc
-loglib_LTLIBRARIES += liblog_hext.la
-liblog_hext_la_CXXFLAGS = $(AM_CXXFLAGS)
-liblog_hext_la_LDFLAGS = -export-dynamic -shared
-liblog_hext_la_SOURCES = log_hext.cc
-
dist_loglib_SCRIPTS = alert.lua
AM_CXXFLAGS = @AM_CXXFLAGS@
fp_print_service_groups(sc->spgmmTable);
if ( mpse_count )
+ {
LogLabel("search engine");
-
- MpseManager::print_mpse_summary(fp->get_search_api());
+ MpseManager::print_mpse_summary(fp->get_search_api());
+ }
if ( fp->get_num_patterns_truncated() )
LogMessage("%25.25s: %-12u\n", "truncated patterns", fp->get_num_patterns_truncated());
break;
case PktType::FILE:
- fpEvalHeaderSvc(p, omd, SNORT_PROTO_FILE);
+ fpEvalHeaderSvc(p, omd, SNORT_PROTO_USER);
break;
default:
alert_full.cc
alert_syslog.cc
alert_unixsock.cc
+ log_hext.cc
log_null.cc
log_pcap.cc
unified2.cc
add_shared_library(alert_full loggers alert_full.cc)
add_shared_library(alert_syslog loggers alert_syslog.cc)
add_shared_library(alert_unixsock loggers alert_unixsock.cc)
+ add_shared_library(log_hext loggers log_hext.cc)
add_shared_library(log_null loggers log_null.cc)
add_shared_library(log_pcap loggers log_pcap.cc)
add_shared_library(unified2 loggers unified2.cc unified2_common.h)
alert_full.cc \
alert_syslog.cc \
alert_unixsock.cc \
+log_hext.cc \
log_null.cc \
log_pcap.cc \
unified2.cc \
libalert_unixsock_la_LDFLAGS = -export-dynamic -shared
libalert_unixsock_la_SOURCES = alert_unixsock.cc
+ehlib_LTLIBRARIES += liblog_hext.la
+liblog_hext_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
+liblog_hext_la_LDFLAGS = -export-dynamic -shared
+liblog_hext_la_SOURCES = log_hext.cc
+
ehlib_LTLIBRARIES += liblog_null.la
liblog_null_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
liblog_null_la_LDFLAGS = -export-dynamic -shared
raw = false;
limit = 0;
units = 0;
- width = 0;
+ width = 20;
return true;
}
hext_dtor
};
+#ifdef BUILDING_SO
SO_PUBLIC const BaseApi* snort_plugins[] =
{
&hext_api.base,
nullptr
};
+#else
+const BaseApi* log_hext = &hext_api.base;
+#endif
extern const BaseApi* alert_full;
extern const BaseApi* alert_syslog;
extern const BaseApi* alert_unix_sock;
+extern const BaseApi* log_hext;
extern const BaseApi* log_null;
extern const BaseApi* log_pcap;
extern const BaseApi* eh_unified2;
alert_syslog,
alert_unix_sock,
// loggers
+ log_hext,
log_null,
log_pcap,
case PSEUDO_PKT_TCP:
return "stream_tcp";
+ case PSEUDO_PKT_USER:
+ return "stream_user";
+
case PSEUDO_PKT_DCE_RPKT:
return "dce2_rpc_reass";
{
PSEUDO_PKT_IP,
PSEUDO_PKT_TCP,
+ PSEUDO_PKT_USER,
PSEUDO_PKT_DCE_RPKT,
PSEUDO_PKT_DCE_SEG,
PSEUDO_PKT_DCE_FRAG,
#include "time/profiler.h"
#include "packet_io/sfdaq.h"
#include "detection/detection_util.h"
+#include "target_based/snort_protocols.h"
#include "stream_file.h"
#include "file_module.h"
PROFILE_VARS;
MODULE_PROFILE_START(file_ssn_stats);
+ p->flow->ssn_state.application_protocol = SNORT_PROTO_USER;
StreamFileConfig* c = get_file_cfg(p->flow->ssn_server);
file_api->file_process(p->flow, (uint8_t*)p->data, p->dsize, position(p), c->upload, false);
set_file_data((uint8_t*)p->data, p->dsize);
up.proto_bits = p->proto_bits;
up.application_protocol_ordinal = p->application_protocol_ordinal;
+ up.pseudo_type = PSEUDO_PKT_USER;
- up.packet_flags = flags | PKT_REBUILT_STREAM;
+ up.packet_flags = flags | PKT_REBUILT_STREAM | PKT_PSEUDO;
up.packet_flags |= (p->packet_flags & (PKT_FROM_CLIENT|PKT_FROM_SERVER));
up.packet_flags |= (p->packet_flags & (PKT_STREAM_EST|PKT_STREAM_UNEST_UNI));