Commit graph

180 commits

Author SHA1 Message Date
Jon Siwek
3642ecc73e FileAnalysis: misc. tweaks/fixes.
- Add a timeout flag to file_analysis.log so it's easy to tell what
  has had at least one timeout trigger happen.

- Fix ftp-data service tag not being set for reused connections.

- Fix HTTP::Incorrect_File_Type because mime types returned by FAF have
  the charset still in them, but the HTTP::mime_types_extensions table
  does not and it requires an exact string match. (still ugly)

- Add TRIGGER_NEW_CONN to track files going over multiple connections.

- Add an initial file/mime type guess for non-linear file transfers.

- Fix a case where file/mime type detection would never be attempted
  if the start of the file was a content gap.

- Improve mime type tracking of HTTP byte-range/partial-content,
  even if the requests are pipelined or over multiple connections.

- I changed the modbus.events test because having the baseline output
  be 80+ MB is nuts and it was sensitive to connection record redefs.
2013-03-28 16:59:29 -05:00
Jon Siwek
7caa4aa45c FileAnalysis: unit test tweaks (portability, etc.) 2013-03-27 14:51:23 -05:00
Jon Siwek
00a1de3593 FileAnalysis: refactor unit tests to use a common script. 2013-03-22 17:27:16 -05:00
Jon Siwek
e34f6d9e3b Enable GridFTP detection by default. Track/log SSL client certs.
In the *service* field of connection records, GridFTP control channels
are labeled as "gridftp" and data channels as "gridftp-data".

Added *client_subject* and *client_issuer_subject* as &log'd fields to
SSL::Info record.  Also added *client_cert* and *client_cert_chain*
fields to track client cert chain.
2012-10-08 11:38:29 -05:00
Jon Siwek
907c92e1cc Fix mime type diff canonifier to also skip mime_desc columns
In particular, the ftp.log baseline in the new ipv6 test in bro-testing
was failign on various platforms because of this.
2012-08-17 15:22:51 -05: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
Robin Sommer
f2e60a76a8 Script fix for Linux. 2012-07-22 21:04:59 -07:00
Robin Sommer
71fc2a1728 Another small change to MsgThread API.
Threads will now reliably get a call to DoFinish() no matter how the
thread terminates. This will always be called from within the thread,
whereas the destructor is called from the main thread after the child
thread has already terminated.

Also removing debugging code.

However, two problems remain with the ASCII writer (seeing them only
on MacOS):

    - the #start/#end timestamps contain only dummy values right now.
      The odd thing is that once I enable strftime() to print actual
      timestamps, I get crashes (even though strftime() is supposed to
      be thread-safe).

    - occassionally, there's still output missing in tests. In those
      cases, the file descriptor apparently goes bad: a write() will
      suddently return EBADF for reasons I don't understand yet.
2012-07-22 15:50:12 -07:00
Robin Sommer
5ef83900d8 Sed usage in canonifier script didn't work on non-Linux systems. 2012-07-20 12:28:34 -07:00
Robin Sommer
5cfb8d65c3 Updating tests for the #start/#end change. 2012-07-19 22:28:55 -07:00
Robin Sommer
87e10b5f97 Further threading and API restructuring for logging and input
frameworks.

There were a number of cases that weren't thread-safe. In particular,
we don't use std::string anymore for anything that's passed between
threads (but instead plain old const char*, with manual memmory
managmenet).

This is still a check-point commit, I'll do more testing.
2012-07-19 22:28:30 -07:00
Robin Sommer
f6b883bafc Further reworking the thread API. 2012-07-19 21:22:28 -07:00
Robin Sommer
f73eb3b086 Reworking thread termination logic.
Turns out the finish methods weren't called correctly, caused by a
mess up with method names which all sounded too similar and the wrong
one ended up being called. I've reworked this by changing the
thread/writer/reader interfaces, which actually also simplifies them
by getting rid of the requirement for writer backends to call their
parent methods (i.e., less opportunity for errors).

This commit also includes the following (because I noticed the problem
above when working on some of these):

     - The ASCII log writer now includes "#start <timestamp>" and
      "#end <timestamp> lines in the each file. The latter supersedes
      Bernhard's "EOF" patch.

      This required a number of tests updates. The standard canonifier
      removes the timestamps, but some tests compare files directly,
      which doesn't work if they aren't printing out the same
      timestamps (like the comm tests).

     - The above required yet another change to the writer API to
       network_time to methods.

     - Renamed ASCII logger "header" options to "meta".

     - Fixes #763 "Escape # when first character in log file line".

All btests pass for me on Linux FC15. Will try MacOS next.
2012-07-19 21:21:53 -07:00
Jon Siwek
350c93c136 Remove an old, unused diff canonifier. 2012-06-15 11:22:15 -05:00
Robin Sommer
fabe891d4f Fixing pack_scale and time-as-int.
Also removing now unneccessary canonifier script, and updating test
baselines.
2012-05-14 22:04:57 -07:00
Robin Sommer
a7bc12066b Merge remote-tracking branch 'origin/master' into topic/robin/dataseries
Conflicts:
	CMakeLists.txt
	cmake
2012-04-17 16:37:37 -07:00
Robin Sommer
91a3ce9518 Additional test output canonification for ds2txt's timestamps. 2012-04-16 15:20:10 -07:00
Robin Sommer
7131feefbc Working on DataSeries support.
- The option to use integers insteads of double was ignored.

   - Renaming script-level options to remove the ds_ prefix.

   - Log rotation didn't work.

   - A set of simple unit tests.
2012-04-09 17:46:56 -07:00
Robin Sommer
fb0614b5c6 Adding notice_policy.log canonification for external tests.
These was still producing false positives.
2012-04-04 17:46:13 -07:00
Jon Siwek
ef5e9caaf4 Changes to how script coverage integrates with test suites.
- BRO_PROFILER_FILE now passes .X* templated filenames to mkstemp
  for generating unique coverage state files.  All test suites
  now use this so each Bro instance writes to a unique coverage file.
- Rearranging Makefile targets.  The general rule is that if the
  all/brief target fails out due to a test failure, then the dependent
  coverage target won't run, but can still be invoked directly later.
  (e.g. make brief || make coverage)
2012-03-01 13:00:44 -06:00
Robin Sommer
bfeca444db Sorting all output for the external tests.
Let's see how this goes. The script keeps comments at the beginning.
2012-02-29 17:09:38 -08:00
Daniel Thayer
4a6a9fe9f2 Fix sorting of lines in Brofiler coverage.log
Lines with a range were being output with text "lines", and so were
being listed after all other lines belonging to the same Bro script
(e.g., "lines 123-125" was listed after "line 492").  Fixed by using
the text "line" instead of "lines".

Line numbers with fewer digits were being listed after line numbers
with more digits (e.g., "line 85" was listed after "line 237").
Fixed by sorting on a reformatted string (this string does not appear
in the output) where line numbers are right justified (padded on left
with spaces) so that sorting produces the expected results.
2012-01-30 17:35:19 -06:00
Jon Siwek
0065cf6148 Fix mktemp portability issue affecting test coverage. (addresses #752)
Also update Makefiles to behave better for brief targets and in absence
of external test repos.
2012-01-27 11:01:50 -06:00
Robin Sommer
f6f9dd952f Fixed for Brofiler merge. 2012-01-26 20:55:24 -08:00
Jon Siwek
0287f7adc2 Fix superfluous/duplicate data getting in to testing coverage log. 2012-01-18 11:45:53 -06:00
Jon Siwek
9aefeec4ce Integrate Bro script coverage profiling with the btest suite. 2012-01-11 16:30:25 -06:00
Jon Siwek
ff1768f857 Minor fixes to external test process. (addresses #298)
- Skip diffing of debug.log always.
- Skip diffing of reporter.log if it only contains an error about
  missing GeoIP support.
- Canonicalize X.509 Distinguished Name subjects since that can vary
  depending on installed OpenSSL version.
2011-12-20 11:47:39 -06:00
Jon Siwek
357341c887 Changing some external testing scripts.
- The absolute path canonifier was overzealously canonifying relevant
  log fields, so it's no longer generally applied to diffing all
  baselines.  I don't think there's any logs that require local
  filesystem path names that aren't already tested by a unit test,
  but if any show up in the future, they can be canonified on a
  case-by-case basis.

- Removed some logs from being diff'd in the diff-all script
  because they're either already covered by a unit test
  (load_scripts.log) or because of difficulty/maintainenance
  tradeoff (prof.log).

Baselines for the external bro-testing repo still need updating.
2011-10-04 10:51:41 -05:00
Robin Sommer
cb2cb117d0 Excluding log fields of name mime_type for comparision.
This is because libmagic can return different results depending on
installation.

Note, this still doesn't fix all problems: smtp-entities sets md5
depending on the mime-type returned by libmagic ...
2011-09-09 11:41:03 -07:00
Robin Sommer
c738701ffd Cleaning up some testing stuff.
- The Makefiles now run btest with "-f diag.log" so that diangnostics
  output will always be written into that file.

- Makefiles now hardcode path to btest to avoid picking up the wrong version
  if in PATH.

- The canonifier scripts now live in testing/scripts, and they are
  used from both btest/ and external/.

- There's a new diff-remove-uids scripts that removed connection UIDs
  for diffing. The external/* tests now use that by default.

- Timestamp removal now has its own script: diff-remove-timestamps.
  diff-canonifier calls that.

- All Makefile have a "brief" target that runs btest with -b.

- The higher-level directories have Makefile to call the subdirs.
2011-07-05 18:47:08 -07:00