Commit graph

5140 commits

Author SHA1 Message Date
Robin Sommer
3abf626908 Merge remote-tracking branch 'origin/topic/jsiwek/broxygen'
BIT-1098

* origin/topic/jsiwek/broxygen:
  Fix Broxygen-related compile errors.
  Add a Broxygen coverage test.
  Internal Broxygen organization/documentation/polish.
  Add unit tests for Broxygen config file targets.
  Change Broxygen config file format.
  Broxygen doc-related test updates.  Fix two regressions.
  A couple documentation fixes.
  Integrate new Broxygen functionality into Sphinx.
  Implement majority of Broxygen features delegated to Bro.
  Broxygen can now read a config file specifying particular targets.
  Remove unneeded Broxygen comments in scan.bro.
  Replace safe_basename/safe_dirname w/ SafeBasename/SafeDirname.
  Add BIF interface for retrieving comments/docs.
  Quick optimization to Broxygen doc gathering.
  Flesh out Broxygen doc-gathering skeleton.
  Refactor search_for_file() util function.
  Initial skeleton of new Broxygen infrastructure.
2013-12-04 11:14:19 -08:00
Seth Hall
4484b8d60d Merge branch 'master' of ssh://git.bro-ids.org/bro 2013-12-04 13:25:20 -05:00
Jon Siwek
2ea6011186 Improve a unit test involving 'when' conditionals.
May fix a sporadic failure, in which case it was just not getting enough
time to run or lookup_hostname() taking longer than ~3 seconds.  Else,
the new output should give more hints on what's going wrong.  In any
case, termination conditions for the test are now explicit.
2013-12-03 16:51:36 -06:00
Jon Siwek
4014cdc277 Fix string slice notation, addresses BIT-1097.
Slice ranges were not correctly determined for negative indices and also
off by one in general (included one more element at the end of the
substring than what actually matched the index range).

It's now equivalent to Python slice notation.  Accessing a string at
a single index is also the same as Python except that an out-of-range
index returns an empty string instead of throwing an expection.
2013-12-03 14:39:21 -06:00
Robin Sommer
c0b8384660 Merge remote-tracking branch 'origin/topic/jsiwek/broccoli-vectors'
* origin/topic/jsiwek/broccoli-vectors:
  Unit test for broccoli vector support.
2013-12-03 10:57:03 -08:00
Jon Siwek
5aa04089af Unit test for broccoli vector support.
Broccoli clients can only recv events w/ vectors for now.

Also changed ordering of Bro type tag enum -- the addition of opaque
types changed the value of the vector type, making broccoli.h's
definition out of sync.  Probably could have just changed broccoli's
definition, but seems more correct to go back to using the same value
for vectors as they were before opaques.  It's also better in case
there's some other location I'm not aware of where the values are
replicated.
2013-12-03 11:28:06 -06:00
Robin Sommer
bda0c29f66 Restructuring the plugin API to accomodate hooks.
I got rid of the earlier separate InterpreterPlugin class. Instead
Plugin now has a set of virtual methods HookSomething()... that
plugins can override. For efficiency purposes, they however need to
register first that they are interested in a hook, otherwise the
virtual method will never be called. The idea is to extend the set of
hooks over time as we figure out what's useful.

This is a checkpoint commit that's essentially untested and probably
broken. It compiles, though.
2013-11-26 14:04:29 -08:00
Robin Sommer
555df1e7ea Checkpointing the dynamic plugin code.
This is essentially the code from the dynamic-plugin branch except for
some pieces that I have split out into separate, earlier commits.

I'm going to updatre things in this branch going forward.
2013-11-26 14:04:29 -08:00
Robin Sommer
7412470d66 Prettyfing Describe() for record types.
If a record type has a name and ODesc is set to short, we now print
the name instead of the full field list.
2013-11-26 14:04:29 -08:00
Robin Sommer
d727af097b Minor API changes to analyzers. 2013-11-26 11:22:23 -08:00
Robin Sommer
d34f23c8d4 A set of file analysis extensions.
- Enable manager to associate analyzers with a MIME type. With that,
  one can now say enable all analyzers for, e.g., "image/gif". This is
  exposed to script-land as

    Files::add_analyzers_for_mime_type(f: fa_file, mtype: string)

  For MIME types identified via libmagic, this happens automatically
  (via the file_new() handler in files/main.bro).

- Extend the analyzer API to better match that of protocol analyzers:

    - Adding unique analyzer IDs so that we can refer to instances
      from script-land.

    - Adding subtypes to Components so that a single analyzer
      implementation can support different types of analyzers
      internally.

    - Add an analyzer method SetTag() that allows to set the tag after
      construction.

    - Adding Init() and Done() methods for consistency with what other
      classes offer.

- Add debug logging to the file_analysis stream.

TODO: test cases missing for the new script-land functionality.
2013-11-26 11:20:14 -08:00
Robin Sommer
f0fe270029 Minor interface changes to provide more accessor methods for class
information.

In particular, adding a few const versions of methods.
2013-11-26 10:57:02 -08:00
Robin Sommer
b6c1b35bb8 Updating submodule(s).
[nomail]
2013-11-26 10:35:04 -08:00
Jon Siwek
9163935aba Fix Broxygen-related compile errors. 2013-11-25 16:08:46 -06:00
Jon Siwek
25e28c04f0 Add a Broxygen coverage test. 2013-11-25 15:49:53 -06:00
Jon Siwek
e58865af22 Internal Broxygen organization/documentation/polish. 2013-11-25 14:36:05 -06:00
Daniel Thayer
5b6468a302 Add documentation for event parameters
Added documentation that was missing for some event parameters, and
fixed documented name of event parameters.
2013-11-22 16:36:08 -06:00
Robin Sommer
de9f03b0bf New script misc/dump-events.bro, along with core support, that dumps events Bro is raising
in an easily readable form.

This is for debugging purposes, obviously.

Example, including only SMTP events:

    > bro -r smtp.trace misc/dump-events.bro DumpEvents::include=/smtp/

    [...]
    1254722768.219663 smtp_reply
                  [0] c: connection   = [id=[orig_h=10.10.1.4, orig_p=1470/tcp, resp_h=74.53.140.153, [...]
                  [1] is_orig: bool   = F
                  [2] code: count     = 220
                  [3] cmd: string     = >
                  [4] msg: string     = xc90.websitewelcome.com ESMTP Exim 4.69 #1 Mon, 05 Oct 2009 01:05:54 -0500
                  [5] cont_resp: bool = T

    1254722768.219663 smtp_reply
                  [0] c: connection   = [id=[orig_h=10.10.1.4, orig_p=1470/tcp, resp_h=74.53.140.153, [...]
                  [1] is_orig: bool   = F
                  [2] code: count     = 220
                  [3] cmd: string     = >
                  [4] msg: string     = We do not authorize the use of this system to transport unsolicited,
                  [5] cont_resp: bool = T
    [...]
2013-11-22 14:20:00 -08:00
Robin Sommer
08c7dd3d71 Prettyfing Describe() for record types.
If a record type has a name and ODesc is set to short, we now print
the name instead of the full field list.
2013-11-22 13:54:40 -08:00
Jon Siwek
27138b893a Add unit tests for Broxygen config file targets. 2013-11-22 14:59:16 -06:00
Daniel Thayer
6f06705c23 Fix typos in BIF documentation
Fixed typos in documentation of hexstr_to_bytestring.
Also added documentation that was missing for function parameters
and return values of other BIFs.
2013-11-22 14:49:16 -06:00
Jon Siwek
e3f74dc319 Change Broxygen config file format.
"<type> <pattern> <output-file>" seems a more natural order for
specifying targets.
2013-11-22 14:37:07 -06:00
Jon Siwek
98dcfc64a8 Broxygen doc-related test updates. Fix two regressions.
- Fix automatic function parameter documentation formatting for
  record fields that are functions.

- Document redefs in a fixed order.
2013-11-22 14:18:24 -06:00
Jon Siwek
7e0864468c A couple documentation fixes.
- Move notice index wrapper doc to doc/script-reference -- doc/scripts
  no longer contains any static documentation because that location
  will be managed by Bro to generate per-script docs.

- :doc: references for generated per-script docs now need the ".bro"
  suffix.  (IMO this is better since it directly mirrors the actual
  script's file name and can't be confused w/ a package).
2013-11-21 15:59:07 -06:00
Jon Siwek
96ba5c82a3 Merge branch 'master' into topic/jsiwek/broxygen 2013-11-21 15:46:55 -06:00
Jon Siwek
9967aea52c Integrate new Broxygen functionality into Sphinx.
Add a "broxygen" domain Sphinx extension w/ directives to allow
on-the-fly documentation to be generated w/ Bro and included in files.

This means all autogenerated reST docs are now done by Bro.  The odd
CMake/Python glue scipts which used to generate some portions are now
gone.  Bro and the Sphinx extension handle checking for outdated docs
themselves.

Parallel builds of `make doc` target should now work (mostly because
I don't think there's any tasks that can be done in parallel anymore).

Overall, this seems to simplify things and make the Broxygen-generated
portions of the documentation visible/traceable from the main Sphinx
source tree.  The one odd thing still is that per-script documentation
is rsync'd in to a shadow copy of the Sphinx source tree within the
build dir.  This is less elegant than using the new broxygen extension
to make per-script docs, but rsync is faster and simpler.  Simpler as in
less code because it seems like, in the best case, I'd need to write a
custom Sphinx Builder to be able to get that to even work.
2013-11-21 14:34:32 -06:00
Rafael Bonilla
a33d25b3bd New Bro Manual Development Edition and basic.css to fix btest output overflow problem (Update 1). 2013-11-21 12:56:00 -06:00
Vlad Grigorescu
e8b5acba4e Merge branch 'master' of ssh://git.bro.org/bro into topic/vladg/bgp 2013-11-19 20:27:31 -05:00
Vlad Grigorescu
9e0b0f9187 Basic RADIUS support - checkpoint 2013-11-19 20:20:36 -05:00
Robin Sommer
dc52846b6f Updating submodule(s).
[nomail]
2013-11-18 14:04:02 -08:00
Robin Sommer
7cccb857fb Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Update local.bro for Bro 2.2

Adding to BIT-1095.
2013-11-18 14:02:09 -08:00
Daniel Thayer
3effe5df08 Update local.bro for Bro 2.2
Removed some commented-out code that no longer works in Bro 2.2 (because
Notice::policy is now a hook).
2013-11-15 11:39:27 -06:00
Robin Sommer
f18f9511ac Updating submodule(s).
[nomail]
2013-11-15 07:06:00 -08:00
Jon Siwek
4f6d01000a Implement majority of Broxygen features delegated to Bro.
Still have to update the Sphinx integration.
2013-11-14 14:00:51 -06:00
Daniel Thayer
7025d511e4 Update the documentation of types and attributes
Documented the new substring extraction functionality.
Clarified the description of "&priority" and "void".
Also fixed various typos.
2013-11-13 16:45:43 -06:00
Robin Sommer
3d1fd6ca5e Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix the irc_reply event for certain server message types.
2013-11-11 13:48:50 -08:00
Robin Sommer
1e31538829 Merge remote-tracking branch 'origin/topic/bernhard/ticket1094'
* origin/topic/bernhard/ticket1094:
  Add minimal testcase for sqlite writer crash.
  Fixed Segmentation fault in SQLite Writer.

BIT-1094 #merged
BIT-1095 #comment Add to 2.2.1
2013-11-11 13:42:52 -08:00
Bernhard Amann
81d0def327 Add minimal testcase for sqlite writer crash.
The writer did not work with a non-empty set or vector
as the last element in the logged column.
2013-11-10 22:04:16 -08:00
Jon Crussell
cb6f6467c7 Fixed Segmentation fault in SQLite Writer.
Segmentation fault caused by accessing fields with pos which is
one-based for setting SQLite field values. Fix is to simply subtract one
from pos. Discovered when trying to store HTTP traffic to a SQLite
database with the following Bro script:

event bro_init() {
  local filter: Log::Filter = [
    $name = "sqlite",
    $path = "http",
    $config = table(["tablename"] = "http_logs"),
    $writer = Log::WRITER_SQLITE
  ];

  Log::add_filter(HTTP::LOG, filter);
}
2013-11-10 22:02:24 -08:00
Seth Hall
1e43dfc46a Fix the irc_reply event for certain server message types. 2013-11-08 16:49:03 -05:00
Seth Hall
cc314084a8 Fix the irc_reply event for several server message types. 2013-11-08 16:47:22 -05:00
Robin Sommer
071bd2689d Updating CHANGES and VERSION. 2013-11-07 10:26:35 -08:00
Robin Sommer
48117eda37 Removing one more "beta". 2013-11-07 10:25:50 -08:00
Robin Sommer
91a6fb9af7 Updating submodule(s).
[nomail]
2013-11-07 07:09:29 -08:00
Robin Sommer
1164fdfb46 Removing location information from ssh.log in external tests. 2013-11-07 02:19:23 -08:00
Robin Sommer
18ba9a1626 Updating submodule(s).
[nomail]
2013-11-07 01:22:21 -08:00
Robin Sommer
ba258ab865 Updating CHANGES and VERSION. 2013-11-07 01:21:20 -08:00
Robin Sommer
da9c31db55 Fixing warnings during doc build.
Includes adding a stub file that has been missing for a while already.
2013-11-07 00:46:48 -08:00
Robin Sommer
f46e4a5578 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix typos in sumstats doc and update doc test
  Update docs and tests for a recent change to detect-MHR.bro
  Update tests and baselines for sumstats docs
2013-11-06 22:55:01 -08:00
Daniel Thayer
410e4babd0 Fix typos in sumstats doc and update doc test 2013-11-06 18:56:39 -06:00