Fixing unit tests and some minor bugs.

This commit is contained in:
Jon Siwek 2011-09-22 12:42:16 -05:00
parent 39af63841b
commit d2118200ea
13 changed files with 25 additions and 21 deletions

View file

@ -102,7 +102,6 @@ rest_target(${psd} policy/integration/barnyard2/main.bro)
rest_target(${psd} policy/integration/barnyard2/types.bro) rest_target(${psd} policy/integration/barnyard2/types.bro)
rest_target(${psd} policy/misc/analysis-groups.bro) rest_target(${psd} policy/misc/analysis-groups.bro)
rest_target(${psd} policy/misc/loaded-scripts.bro) rest_target(${psd} policy/misc/loaded-scripts.bro)
rest_target(${psd} policy/misc/pf-ring-load-balancing.bro)
rest_target(${psd} policy/misc/profiling.bro) rest_target(${psd} policy/misc/profiling.bro)
rest_target(${psd} policy/misc/trim-trace-file.bro) rest_target(${psd} policy/misc/trim-trace-file.bro)
rest_target(${psd} policy/protocols/conn/known-hosts.bro) rest_target(${psd} policy/protocols/conn/known-hosts.bro)
@ -115,7 +114,7 @@ rest_target(${psd} policy/protocols/http/detect-MHR.bro)
rest_target(${psd} policy/protocols/http/detect-intel.bro) rest_target(${psd} policy/protocols/http/detect-intel.bro)
rest_target(${psd} policy/protocols/http/detect-sqli.bro) rest_target(${psd} policy/protocols/http/detect-sqli.bro)
rest_target(${psd} policy/protocols/http/detect-webapps.bro) rest_target(${psd} policy/protocols/http/detect-webapps.bro)
rest_target(${psd} policy/protocols/http/headers.bro) rest_target(${psd} policy/protocols/http/header-names.bro)
rest_target(${psd} policy/protocols/http/software.bro) rest_target(${psd} policy/protocols/http/software.bro)
rest_target(${psd} policy/protocols/http/var-extraction-cookies.bro) rest_target(${psd} policy/protocols/http/var-extraction-cookies.bro)
rest_target(${psd} policy/protocols/http/var-extraction-uri.bro) rest_target(${psd} policy/protocols/http/var-extraction-uri.bro)

View file

@ -207,7 +207,8 @@ function default_path_func(id: ID, path: string, rec: any) : string
else else
{ {
# In case there is a logging stream in the global namespace. # In case there is a logging stream in the global namespace.
return to_lower(id_str); # TODO: same bug as above with split and lack of terminating \0
return fmt("%s", to_lower(id_str));
} }
} }
@ -241,8 +242,7 @@ function create_stream(id: ID, stream: Stream) : bool
function disable_stream(id: ID) : bool function disable_stream(id: ID) : bool
{ {
if ( ! __disable_stream(id) ) return __disable_stream(id);
return F;
} }
function add_filter(id: ID, filter: Filter) : bool function add_filter(id: ID, filter: Filter) : bool

View file

@ -14,7 +14,7 @@ export {
## The vector of HTTP header names sent by the server. No header ## The vector of HTTP header names sent by the server. No header
## values are included here, just the header names. ## values are included here, just the header names.
server_headers_names: vector of string &log &optional; server_header_names: vector of string &log &optional;
}; };
## A boolean value to determine if client header names are to be logged. ## A boolean value to determine if client header names are to be logged.

View file

@ -1,4 +1,5 @@
@load base/protocols/ssh
@load base/frameworks/metrics @load base/frameworks/metrics
@load base/frameworks/notice @load base/frameworks/notice
@load base/frameworks/intel @load base/frameworks/intel
@ -72,4 +73,4 @@ event SSH::heuristic_failed_login(c: connection)
if ( ! (id$orig_h in ignore_guessers && if ( ! (id$orig_h in ignore_guessers &&
id$resp_h in ignore_guessers[id$orig_h]) ) id$resp_h in ignore_guessers[id$orig_h]) )
Metrics::add_data(FAILED_LOGIN, [$host=id$orig_h], 1); Metrics::add_data(FAILED_LOGIN, [$host=id$orig_h], 1);
} }

View file

@ -25,6 +25,7 @@
@load integration/barnyard2/types.bro @load integration/barnyard2/types.bro
@load misc/analysis-groups.bro @load misc/analysis-groups.bro
@load misc/loaded-scripts.bro @load misc/loaded-scripts.bro
@load misc/profiling.bro
@load misc/trim-trace-file.bro @load misc/trim-trace-file.bro
@load protocols/conn/known-hosts.bro @load protocols/conn/known-hosts.bro
@load protocols/conn/known-services.bro @load protocols/conn/known-services.bro
@ -37,11 +38,16 @@
@load protocols/http/detect-MHR.bro @load protocols/http/detect-MHR.bro
@load protocols/http/detect-sqli.bro @load protocols/http/detect-sqli.bro
@load protocols/http/detect-webapps.bro @load protocols/http/detect-webapps.bro
@load protocols/http/header-names.bro
@load protocols/http/software.bro @load protocols/http/software.bro
@load protocols/http/var-extraction-cookies.bro @load protocols/http/var-extraction-cookies.bro
@load protocols/http/var-extraction-uri.bro @load protocols/http/var-extraction-uri.bro
@load protocols/smtp/blocklists.bro
@load protocols/smtp/detect-suspicious-orig.bro @load protocols/smtp/detect-suspicious-orig.bro
@load protocols/smtp/software.bro @load protocols/smtp/software.bro
@load protocols/ssh/detect-bruteforcing.bro
@load protocols/ssh/geo-data.bro
@load protocols/ssh/interesting-hostnames.bro
@load protocols/ssh/software.bro @load protocols/ssh/software.bro
@load protocols/ssl/known-certs.bro @load protocols/ssl/known-certs.bro
@load protocols/ssl/validate-certs.bro @load protocols/ssl/validate-certs.bro

View file

@ -334,7 +334,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
(flow != FLOW_RETURN /* we fell off the end */ || (flow != FLOW_RETURN /* we fell off the end */ ||
! result /* explicit return with no result */) && ! result /* explicit return with no result */) &&
! f->HasDelayed() ) ! f->HasDelayed() )
reporter->Warning("non-void function returns without a value:", id->Name()); reporter->Warning("non-void function returns without a value: %s", id->Name());
if ( result && g_trace_state.DoTrace() ) if ( result && g_trace_state.DoTrace() )
{ {

View file

@ -1,4 +1,7 @@
# depth name #separator \x09
#path loaded_scripts
#fields depth name
#types count string
0 scripts/base/init-bare.bro 0 scripts/base/init-bare.bro
1 build/src/base/const.bif.bro 1 build/src/base/const.bif.bro
1 build/src/base/types.bif.bro 1 build/src/base/types.bif.bro

View file

@ -1,4 +1,7 @@
# depth name #separator \x09
#path loaded_scripts
#fields depth name
#types count string
0 scripts/base/init-bare.bro 0 scripts/base/init-bare.bro
1 build/src/base/const.bif.bro 1 build/src/base/const.bif.bro
1 build/src/base/types.bif.bro 1 build/src/base/types.bif.bro

View file

@ -1,8 +0,0 @@
# This test will fail if there are Bro scripts that have been temporarily
# blacklisted from the documentation generation process for some reason
# (e.g. they're a work-in-progress or otherwise fail to parse). It's meant
# to serve as a reminder that some future action may be needed to generate
# documentation for the blacklisted scripts.
#
# @TEST-EXEC: $DIST/doc/scripts/genDocSourcesList.sh
# @TEST-EXEC: btest-diff .stderr

View file

@ -5,7 +5,7 @@
#@TEST-EXEC: test -e $DIST/scripts/base/init-default.bro #@TEST-EXEC: test -e $DIST/scripts/base/init-default.bro
#@TEST-EXEC: ( cd $DIST/scripts/base && find . -name '*.bro' ) | sort >"all scripts found" #@TEST-EXEC: ( cd $DIST/scripts/base && find . -name '*.bro' ) | sort >"all scripts found"
#@TEST-EXEC: bro misc/loaded-scripts #@TEST-EXEC: bro misc/loaded-scripts
#@TEST-EXEC: cat loaded_scripts.log | egrep -v '/build/|/loaded-scripts.bro' | awk 'NR>1{print $2}' | sed 's#/./#/#g' >loaded_scripts.log.tmp #@TEST-EXEC: cat loaded_scripts.log | egrep -v '/build/|/loaded-scripts.bro|#' | awk 'NR>1{print $2}' | sed 's#/./#/#g' >loaded_scripts.log.tmp
#@TEST-EXEC: cat loaded_scripts.log.tmp | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix #@TEST-EXEC: cat loaded_scripts.log.tmp | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix
#@TEST-EXEC: cat loaded_scripts.log.tmp | sed "s#`cat prefix`#./#g" | sort >init-default.bro #@TEST-EXEC: cat loaded_scripts.log.tmp | sed "s#`cat prefix`#./#g" | sort >init-default.bro
#@TEST-EXEC: diff -u "all scripts found" init-default.bro 1>&2 #@TEST-EXEC: diff -u "all scripts found" init-default.bro 1>&2

View file

@ -7,6 +7,6 @@
# @TEST-EXEC: bro -b misc/loaded-scripts # @TEST-EXEC: bro -b misc/loaded-scripts
# @TEST-EXEC: test -e loaded_scripts.log # @TEST-EXEC: test -e loaded_scripts.log
# @TEST-EXEC: cat loaded_scripts.log | awk 'NR>1{print $2}' | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix # @TEST-EXEC: cat loaded_scripts.log | egrep -v '#' | awk 'NR>1{print $2}' | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix
# @TEST-EXEC: cat loaded_scripts.log | sed "s#`cat prefix`##g" >canonified_loaded_scripts.log # @TEST-EXEC: cat loaded_scripts.log | sed "s#`cat prefix`##g" >canonified_loaded_scripts.log
# @TEST-EXEC: btest-diff canonified_loaded_scripts.log # @TEST-EXEC: btest-diff canonified_loaded_scripts.log

View file

@ -7,6 +7,6 @@
# @TEST-EXEC: bro misc/loaded-scripts # @TEST-EXEC: bro misc/loaded-scripts
# @TEST-EXEC: test -e loaded_scripts.log # @TEST-EXEC: test -e loaded_scripts.log
# @TEST-EXEC: cat loaded_scripts.log | awk 'NR>1{print $2}' | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix # @TEST-EXEC: cat loaded_scripts.log | egrep -v '#' | awk 'NR>1{print $2}' | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix
# @TEST-EXEC: cat loaded_scripts.log | sed "s#`cat prefix`##g" >canonified_loaded_scripts.log # @TEST-EXEC: cat loaded_scripts.log | sed "s#`cat prefix`##g" >canonified_loaded_scripts.log
# @TEST-EXEC: btest-diff canonified_loaded_scripts.log # @TEST-EXEC: btest-diff canonified_loaded_scripts.log