Commit graph

15 commits

Author SHA1 Message Date
Benjamin Bannier
1f388e3f40 Format shell scripts with shfmt.
All changes in this patch were performed automatically with `shfmt` with
configuration flags specified in `.pre-commit-config.yaml`.

In addition to fixing whitespace the roundtrip through shfmt's AST also
transforms command substitutions

    `cmd`
    # becomes
    $(cmd)

and some redirects

    >&2 echo "msg"
    # becomes
    echo >&2 "msg"
2021-11-24 23:13:02 +01:00
Jon Siwek
67835a6520 Extend external test suite canonifier with set-sorting logic
Two new canonifiers: one to sort the contents of conn.log "service"
field and another to sort the contents of any field of type "set".
2020-08-11 11:26:21 -07:00
Robin Sommer
aee312b5d2 Adding usage guard to canonifier script. 2015-12-18 12:59:26 -08:00
Daniel Thayer
6f1e07f6d5 Fixed some test canonifiers to read only from stdin
Fixed some test canonifier scripts to read from stdin instead of
from a filename specified as a cmd-line argument.  This is needed
in order to be able to reliably use them in a pipeline with other
test canonifiers.

Also removed some unused test canonifier scripts.
2015-09-18 17:30:26 -05:00
Daniel Thayer
f3fb2b2f52 Fix diff-canonifier-external to use basename of input file
Use basename of the input filename because sometimes it will have
directory components, such as for the baseline files.
2015-08-15 21:05:40 -05:00
Robin Sommer
1164fdfb46 Removing location information from ssh.log in external tests. 2013-11-07 02:19:23 -08:00
Robin Sommer
efd343af8d Extending external canonifier to remove fractional values from
capture_loss.log.
2013-07-17 21:57:17 -07:00
Robin Sommer
74e99a27db Ignoring file ids in external tests.
They can change occasionally, and we likewise ignore uids already.
2013-06-04 21:23:50 -07:00
Jon Siwek
037d582b0e FileAnalysis: add custom libmagic database.
- It's derived from the magic database of libmagic 5.14, but with most
  everything not related to mime types removed.

- The custom database is always used by default for mime detection, but
  the more verbose file type detection will fall back on the default
  libmagic installation's database.  The result is: mime type strings
  are now guaranteed to be consistent across platforms, but the verbose
  file type descriptions are not.

- The custom database gets installed in $prefix/share/bro/magic, and
  should even be extensible if files with new patterns are added inside
  the directory.

- The search path for the mime magic database can be controlled via
  BROMAGIC environment variable.

- Remove mime_desc field from ftp.log.

- Stop using the mime/file type canonifier with unit tests.

- libmagic >= 5.04 is now a requirement.
2013-04-12 11:58:19 -05: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
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
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