Commit graph

3113 commits

Author SHA1 Message Date
Robin Sommer
cbb31cedc3 Merge remote-tracking branch 'origin/topic/dina/modbus' into topic/robin/modbus-merge
* origin/topic/dina/modbus:
  put some make-up on Modbus analyser
  Modbus analyser, added support: FC=20,21
  Modbus analyzer,added support: FC=1,2,15,24
  Modbus analyzer, current support: FC=3,4,5,6,7,16,22,23

I cleaned up the code a bit, mainly layout style.

I did not include the *.bro scripts for now, but a test script
../testing/btest/scripts/base/protocols/modbus/events.bro that prints
out the value for each event.

Merged the Modbus traces from the ics repository into a single trace
as input for the test. They currently trigger 20 of the 34 events.

Addresses #870.
2012-08-29 17:58:41 -07:00
Daniel Thayer
44c6ed5e8c Update language tests
Updated the int and count max/min constant value tests based on latest fixes
in master.
2012-08-29 17:53:37 -05:00
Daniel Thayer
844ecd197e Merge remote-tracking branch 'origin/master' into topic/dnthayer/language-tests 2012-08-29 17:19:55 -05:00
Daniel Thayer
621a90d248 Add more language tests
Added tests for the conditional operator, operator precedence,
modules ("module" and "export" keywords, and the "::" operator), and
for the "copy" keyword.

Also improved tests of max/min values of int, count, and double constants.
2012-08-29 17:14:03 -05:00
Robin Sommer
22cf75dae5 Two fixes.
- Typo in recent scanner fix.

    - Make bif.identify_magic robust against FreeBSD's libmagic config.
2012-08-29 08:11:16 -07:00
Robin Sommer
20c71cac51 Merge remote-tracking branch 'remotes/origin/topic/bernhard/input-warn-on-invalid-numbers'
* remotes/origin/topic/bernhard/input-warn-on-invalid-numbers:
  ...and another small change to error handling -> now errors in single lines do not kill processing, but simply ignore the line, log it, and continue.
  Ok, this one was a little bit sneaky.
  ok, this one might really be a bit too big for 2.1
2012-08-27 12:43:36 -07:00
Robin Sommer
48c6bdf467 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  fix handline of sets only containing a zero-length string.

Conflicts:
	src/input/readers/Ascii.cc
2012-08-27 12:27:24 -07:00
Bernhard Amann
56fa56ffa9 ...and another small change to error handling -> now errors in single lines
do not kill processing, but simply ignore the line, log it, and continue.
2012-08-27 11:38:20 -07:00
Bernhard Amann
a4ca5b0d82 fix handline of sets only containing a zero-length string.
Thank you Robin...
2012-08-27 09:50:51 -07:00
Robin Sommer
352d4bd5e2 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Ok, this one is not really necessary for 2.1 and more of a nice-to-have
  another small bug found while searching for something else...
  Fix two little bugs:
  sorry. the patch for the set_separator.
  make set_separators different from , work for input framework.
  Bug found bei Keith & Seth: input framework was not handling counts and ints out of 32-bit-range correctly.
2012-08-27 09:31:17 -07:00
Bernhard Amann
f133e8808a ok, this one might really be a bit too big for 2.1
Give all kinds of errors when encountering invalid numbers (like out-of-range-warnings, etc).
2012-08-26 22:00:37 -07:00
Bernhard Amann
7e46936728 Ok, this one is not really necessary for 2.1 and more of a nice-to-have
Before this patch, empty values were not hashed at all. Which had the unfortunate side-effect
that e.g. the lines

TEST	-
and
-	TEST

have the same hash values. On re-reads that means that the change will
be ignored.

This is probably pretty academic, but this patch changes it and adds a testcase.

Output of the reread test changes due to re-ordering of the output (probably
due to the fact that the internal hash values are changed and thus transferred
in a different order)
2012-08-26 20:49:21 -07:00
Bernhard Amann
fbe464ffa3 another small bug found while searching for something else...
...one of the change events got the wrong parameters. This actually is a bit embarassing...
2012-08-26 20:26:08 -07:00
Bernhard Amann
a9e6d9ae81 Fix two little bugs:
Escaped ,'s in sets and vectors were unescaped before tokenization

Handling of zero-length-strings as last element in a set was broken (sets ending with a ,).

Hashing of lines just containing zero-length-strings was broken (now a \0 is appended to each
string before it is hashed - giving us a hash of something for a line just consisting of \0s.
This also allows to differentiate between vectors with varying numbers of zero-length-strings).
2012-08-26 19:17:21 -07:00
Bernhard Amann
977c1d7c5a make set_separators different from , work for input framework.
1-line-patch + test.
2012-08-26 17:52:07 -07:00
Bernhard Amann
124c985d7a Bug found bei Keith & Seth: input framework was not handling counts and ints out of 32-bit-range correctly.
Note - another bugfix will be coming later (problem reading sets containing zero-length-strings & un-escaping-bug in sets)
2012-08-26 14:49:37 -07:00
Daniel Thayer
90281a2423 Add tests of the Bro scripting language
Added tests of all built-in Bro data types (including different
representations of constant values, and max./min. values), keywords, and
operators (including special properties of certain operators, such as
short-circuit evaluation and associativity).
2012-08-24 11:32:49 -05:00
Robin Sommer
6dd43ea017 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Update documentation for builtin types
  Adding an identifier to the SMTP blocklist notices for duplicate suppression.
  Doc fixes for signature 'eval' conditions.
  Remove orphaned unit tests.
  Add type checking for signature 'eval' condition functions.
2012-08-23 12:00:10 -07:00
Jon Siwek
ff60b0bb4b Remove orphaned unit tests.
Looks like they're maybe from 1.5 and not applicable/updateable.
2012-08-23 11:59:51 -05:00
Jon Siwek
bef0ce1c98 Add type checking for signature 'eval' condition functions.
Otherwise functions could be called with a mismatching argument list
and cause a crash at run-time.  The incorrect function type is now
reported at parse-time.
2012-08-23 11:52:39 -05:00
Robin Sommer
42355bf6f1 Merge remote-tracking branch 'origin/topic/bernhard/input-allow_invalid_types'
* origin/topic/bernhard/input-allow_invalid_types:
  to be sure - add a small assertion
  add an option to the input framework that allows the user to chose to not die upon encountering files/functions.

That's the last feature for 2.1!
2012-08-22 16:11:28 -07:00
Jon Siwek
93744c8d9b Add test serialization to "leak" unit tests that use communication. 2012-08-22 16:54:00 -05:00
Jon Siwek
655a73bc13 Change to metrics/basic-cluster unit test for reliability.
If the metrics break interval happened to occur between first and second
worker starting up and getting connected to the cluster, the test
would fail because the second worker didn't get a chance to connect and
send data.  The test now waits for the cluster setup to complete
before workers send metrics data.
2012-08-22 16:46:47 -05:00
Jon Siwek
e66e9e5d32 Minor tweak to coverage.bare-mode-errors unit test.
Adding trailing slash to $DIST/scripts makes the `find` work
with a symlinked 'scripts' dir.
2012-08-22 11:12:27 -05:00
Bernhard Amann
1498a3bd59 Merge remote-tracking branch 'origin/master' into topic/bernhard/input-allow_invalid_types 2012-08-22 07:30:58 -07:00
Bernhard Amann
e754590046 Merge remote-tracking branch 'origin/fastpath' into fastpath 2012-08-22 07:28:23 -07:00
Bernhard Amann
b53be21750 add an option to the input framework that allows the user
to chose to not die upon encountering files/functions.

I am not entirely sure if I like the approach I took for
this, it is a bit... hacky.
2012-08-22 06:46:45 -07:00
Bernhard Amann
cd67603f49 add testcase for input of set.
Sets can be imported by not specifying $val in the add_table call.

This actually was already implemented, I just completely forgot about it.
2012-08-21 21:48:49 -07:00
Jon Siwek
bb4b68946f Tweak to rotate-custom.bro unit test.
This one would fail intermittently in the cases where log files were
opened or closed on a different second of the time of day from each
other since the "out" baseline contains only a single "#open" and
"#close" tag (indicating all logs opened/closed on same second of time
of day).  Piping aggregated log output through the timestamp canonifier
before `uniq` makes it so "#open" and "#close" tags for different
seconds of the time of day are reduced to a single one.
2012-08-21 15:22:54 -05:00
Jon Siwek
f201a9f1a7 Fix portability of printing to files returned by open("/dev/stderr").
The BroFile ctor now wraps /dev/std{in,out,err} string arguments
into the actual FILE* provided by stdio.h because use of the former
directly isn't POSIX compliant and led to subtle differences that
broke unit tests on certain platforms (e.g. OS X redirection of stderr
behavior started differing from Linux).  The BroFile (un)serialization
methods already did this kind of logic, so adding it in the ctor also
should make things more consistent.

Some of the reporter-related unit tests looked like they were missing
output because of this, and the coverage test for bare-mode errors
needed tweaking to branch on whether or not libcurl was available
(since the error output differs when elasticsearch isn't there).
2012-08-17 17:27:02 -05:00
Jon Siwek
508ac1c7ba Unit test tweaks/fixes.
- Some baselines for tests in "leaks" group were outdated.

- Changed a few of the cluster/communication tests to terminate
  more explicitly instead of relying on btest-bg-wait to kill
  processes.  This makes the tests finish faster in the success case
  and makes the reason for failing clearer in the that case.
2012-08-16 16:33:46 -05:00
Robin Sommer
d1c78d0300 Updating baselines. 2012-08-10 13:25:18 -07:00
Robin Sommer
9cea1d3b27 Merge remote-tracking branch 'origin/topic/seth/reporter-to-stderr'
* origin/topic/seth/reporter-to-stderr:
  A couple of tests for printing reporter messages to STDERR.
  Small improvements for printing reporter messages to STDERR.
  Reporter warnings and error now print to stderr by default.

Closes #836.
2012-08-10 12:29:07 -07:00
Robin Sommer
2e936c7570 Merge remote-tracking branch 'origin/topic/dnthayer/more-bif-tests'
* origin/topic/dnthayer/more-bif-tests:
  Add more BIF tests
  Add tests for untested BIFs

Closes #863,
2012-08-10 12:24:53 -07:00
Seth Hall
cfe1402281 A couple of tests for printing reporter messages to STDERR. 2012-08-09 14:48:46 -04:00
Daniel Thayer
bda8631f32 Add more BIF tests 2012-08-07 14:10:55 -05:00
Seth Hall
a4af46e1f4 Functional intelligence framework.
- All 5 intelligence tests pass.
- Some initial memory optimizations done.
  - More work needs done to reduce duplicate data in memory.
- Input framework integration.
  - Define files to read in the "Bro intelligence format" in Intel::read_files.
- Cluster transparency.
- DNS Zones are a fully supported data type.
  - Queries for Intel::DOMAIN values will automatically check in DNS_ZONE intelligence.
2012-08-06 09:34:14 -04:00
Bernhard Amann
a2b5028b58 fix little sneaky bug in input framework with an edge case.
An assertion would trigger in the case when a predicate refuses
a new entry and another entry with the same index elements was
already in the table. (I thought that code block was unreachable
... did not think of this case).
2012-08-04 22:38:26 -07:00
Bernhard Amann
18550ab009 small bug in test script. Still worked, because the internal type checking let this through... 2012-08-04 22:24:44 -07:00
Daniel Thayer
10b671a638 Add tests for untested BIFs 2012-08-03 17:24:04 -05:00
Robin Sommer
9f2abd0697 Fix input test for recent default change on fastpath. 2012-07-27 12:39:20 -07:00
Robin Sommer
767a792148 Tests updates for recent open/close log change. 2012-07-27 12:39:11 -07:00
Robin Sommer
c66c6d7c46 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Small (potential performance) improvement for logging framework.
  Script-level rotation postprocessor fix.
  update input framework documentation to reflect want_record change.
  Fix crash when encountering an InterpreterException in a predicate in logging or input Framework.
  make want_record=T the default for events
2012-07-27 12:26:18 -07:00
Robin Sommer
1fd0d7a607 Changing the start/end markers in logs to open/close now reflecting
wall clock.

Triggers lots of (simple) baseline updates.
2012-07-27 12:15:21 -07:00
Bernhard Amann
76ea182387 make want_record=T the default for events 2012-07-26 21:13:49 -07:00
Robin Sommer
86ae7d8b7c Test for input framework failing to find a file.
The output isn't the nicest yet ...
2012-07-26 17:27:56 -07:00
Robin Sommer
ef3b75129f Updating baseline for custom-rotate test. 2012-07-26 15:38:12 -07:00
Robin Sommer
d262a70509 Merge remote-tracking branch 'origin/fastpath'
Small tweak: I added the "same writer" constraint to the loop
condition as well. Makes sense?

* origin/fastpath:
  Change path conflicts between log filters to be auto-corrected.
2012-07-26 15:30:35 -07:00
Robin Sommer
412bebb703 Tweaking the custom-rotate test to produce stable output.
There seems to be a race condition in capturing the external shell's
stdout output reliably. As far as I can tell, Bro's doing everything
correctly though, the log postprocessors gets executed as expected. So
I rewrote the test to capture the output in a separate file first, and
that seems to solve the test failures.
2012-07-26 15:25:48 -07:00
Jon Siwek
63e8bf72ed Change path conflicts between log filters to be auto-corrected.
This change makes it so when differing logging filters on the same
stream attempt to write to the same writer/path combination, the path
of the filter doing the later write will be automatically adjusted so
that it does not conflict with the other.  The path is adjusted by
appending "-N", where N is the smallest integer greater or equal to 2
required to resolve the path name conflict.

Addresses #842.
2012-07-26 16:55:49 -05:00