File tree Expand file tree Collapse file tree 6 files changed +89
-17
lines changed
tests/ips_options/so_and_soid Expand file tree Collapse file tree 6 files changed +89
-17
lines changed Original file line number Diff line number Diff line change 1+ build /
2+ install /
3+ sid_3_13.h
Original file line number Diff line number Diff line change 1+ cmake_minimum_required ( VERSION 3.4.3 )
2+ project (sorule_id_3_13 C CXX)
3+
4+ set (CMAKE_CXX_STANDARD 14)
5+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
6+ set (CMAKE_CXX_EXTENSIONS OFF )
7+
8+ include ( FindPkgConfig )
9+ pkg_search_module ( SNORT3 REQUIRED snort>=3 )
10+
11+ add_library (
12+ so_rule
13+ MODULE
14+ sid_3_13.cc
15+ sid_3_13.h
16+ )
17+
18+ target_compile_options (
19+ so_rule
20+ PRIVATE
21+ -fno-rtti
22+ )
23+
24+ set_target_properties (
25+ so_rule
26+ PROPERTIES
27+ PREFIX ""
28+ )
29+
30+ target_include_directories (
31+ so_rule PUBLIC
32+ ${SNORT3_INCLUDE_DIRS}
33+ )
34+
35+ install (
36+ TARGETS so_rule
37+ LIBRARY
38+ DESTINATION "${CMAKE_SOURCE_DIR} /install"
39+ )
Original file line number Diff line number Diff line change 1+ .PHONY : build sid_3-13.h install clean
2+
3+ build : sid_3_13.h
4+ cmake -B build/ -G Ninja .
5+ cmake --build build/
6+
7+ sid_3_13.h : sid_3_13.txt
8+ snort --rule-to-text < sid_3_13.txt > sid_3_13.h
9+
10+ install :
11+ cmake --install build/
12+
13+ clean :
14+ rm sid_3_13.h
15+ rm -rf build/
16+ rm -rf install/
File renamed without changes.
Original file line number Diff line number Diff line change 1+ alert http
2+ (
3+ msg:"Too much Cheez Whiz is bad mkay.";
4+ flow:to_server,established;
5+ http_uri; content:"crazy";
6+ http_uri:query; content:"withThe=CheezWhiz";
7+ http_uri:query; content:"cans=";
8+ service:http;
9+ reference:url,http://www.kraftbrands.com/cheezwhiz/;
10+ classtype:misc-activity;
11+ gid:3;
12+ sid:13;
13+ rev:1;
14+ soid:3_13_1;
15+ so:cans 7;
16+ )
17+
Original file line number Diff line number Diff line change @@ -5,35 +5,32 @@ base=sid_3_13
55pcap=" cheez.pcap"
66cfg=" snort.lua"
77
8- gcc_opts=" -std=c++14 -Wall -g -ggdb -O0"
9- stub_opts=" --warn-all --plugin-path ."
8+ stub_opts=" --warn-all --plugin-path so_rule/install"
109run_opts=" -q -A csv"
1110
1211setup ()
1312{
14- CXX=g++
15-
16- if [[ " $OSTYPE " == " freebsd" * ]]; then
17- CXX=' clang++'
18- elif [[ " $OSTYPE " == " linux-musl" * ]]; then
19- gcc_opts=" -std=c++14 -Wall -g -ggdb -O0"
20- fi
21-
22- local cppflags=" $( pkg-config --cflags snort) $( pkg-config --variable=DAQ_CPPFLAGS snort) "
23-
24- $snort --rule-to-text < $base .txt > $base .h
25- ${CXX} -c $gcc_opts $cppflags -fPIC -o $base .o $base .cc
26- ${CXX} -shared -o $base .so $base .o
13+ pushd so_rule/
14+ make sid_3_13.h build install
15+ popd
16+ ls -alh so_rule/install
2717}
2818
2919@test " SO and SOID - 3:13" {
20+ echo $snort $stub_opts --dump-dynamic-rules > stub.rule
3021 $snort $stub_opts --dump-dynamic-rules > stub.rule
22+
23+ echo $snort $stub_opts -c $cfg -R stub.rule -r $pcap $run_opts & > snort.out
3124 $snort $stub_opts -c $cfg -R stub.rule -r $pcap $run_opts & > snort.out
25+
26+ cat snort.out
3227 cat stub.rule snort.out | diff expected -
3328}
3429
3530teardown ()
3631{
37- rm -f snort.out * .z * .o * .so stub.rule * .h
32+ pushd so_rule/
33+ make clean
34+ popd
35+ rm -f snort.out stub.rule
3836}
39-
You can’t perform that action at this time.
0 commit comments