Commit graph

6667 commits

Author SHA1 Message Date
Robin Sommer
d3bf552a63 Merge remote-tracking branch 'origin/topic/jsiwek/ticket-957'
* origin/topic/jsiwek/ticket-957:
  Fix function type-equivalence requiring same param names, addresses #957

Closes #957.
2013-03-07 13:31:55 -08:00
Jon Siwek
7e4963b22c Fix new[]/delete mismatch in RE.cc reported by jbaines, addresses #958. 2013-03-07 14:44:01 -06:00
Jon Siwek
f4d59f8137 Fix compiler warnings. 2013-03-07 14:41:18 -06:00
Jon Siwek
2293443ea0 Fix function type-equivalence requiring same param names, addresses #957 2013-03-07 13:02:33 -06:00
Jon Siwek
589952f4d9 Merge branch 'master' into topic/jsiwek/file-analysis
Conflicts:
	src/FileAnalyzer.cc
	testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log
2013-03-07 11:06:00 -06:00
Robin Sommer
a4e40bb402 Merge remote-tracking branch 'origin/topic/bernhard/vector-assignment'
Closes #956.

* origin/topic/bernhard/vector-assignment:
  change vector assignment operator and remove unnecessary argument (expr)
2013-03-06 16:50:53 -08:00
Robin Sommer
8a6d68e00f Merge remote-tracking branch 'origin/topic/bernhard/remove-length'
Closes #955.

* origin/topic/bernhard/remove-length:
  forgot to remove the baselines for the now unnecessary bifs
  remove the byte_len and length bifs
2013-03-06 16:46:20 -08:00
Robin Sommer
9f99a4a942 Merge remote-tracking branch 'origin/topic/jsiwek/local-container-init'
Closes #952.

* origin/topic/jsiwek/local-container-init:
  Fix init of local sets/vectors via curly brace initializer lists.
2013-03-06 15:11:10 -08:00
Robin Sommer
d931079021 Merge remote-tracking branch 'origin/topic/jsiwek/ticket946'
Closes #946.

* origin/topic/jsiwek/ticket946:
  Fix memory leaks resulting from 'when' and 'return when' statements.
  Fix three bugs with 'when' and 'return when' statements. Addresses #946
2013-03-06 15:09:24 -08:00
Robin Sommer
a15b630cac Merge remote-tracking branch 'origin/topic/jsiwek/gtp-enhancements'
* origin/topic/jsiwek/gtp-enhancements:
  Add parsing for GTPv1 extension headers and control messages.
2013-03-06 15:00:45 -08:00
Robin Sommer
c13eae3253 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix possible null pointer dereference in identify_data BIF.
  Fix build on OpenBSD 5.2.
2013-03-06 14:54:50 -08:00
Bernhard Amann
8f259f866d change vector assignment operator and remove unnecessary argument (expr) 2013-03-06 14:08:06 -08:00
Bernhard Amann
986b346e3f remove the byte_len and length bifs 2013-03-06 13:45:42 -08:00
Jon Siwek
00b2d34a8e FileAnalysis: add binary input reader and BIFs for sending in data.
This allows the input framework to feed files in to Bro for analysis.
2013-03-06 12:59:54 -06:00
Bernhard Amann
5e8e12182a add base64-encode functionality and bif.
This allows replacing an ugly openssl-call from one of
the policy scripts. The openssl call is now replaced with
a still-but-less-ugly call to base64_encode.

I do not know if I split the Base64 classes in a "smart" way... :)
2013-03-05 16:05:07 -08:00
Jon Siwek
c330b46128 FileAnalysis: add libmagic file type detection. 2013-03-04 16:20:10 -06:00
Jon Siwek
c88babf6ef Fix init of local sets/vectors via curly brace initializer lists. 2013-03-01 16:42:16 -06:00
Jon Siwek
9425c2508f Change semantics of FileAnalysis::stop BIF to internally mean "ignore".
The manager has to remember that the file is being ignored until either
EOF or timeout.
2013-03-01 14:03:37 -06:00
Jon Siwek
6cb58a5228 FileAnalysis: minor code reorg/tweak of BOF buffering stuff. 2013-03-01 09:55:49 -06:00
Jon Siwek
720858fb36 FileAnalysis: refactor add/remove/stop BIFs, add BOF triggers/fields.
The add_action, remove_action, and stop BIFs now go through a queue to
ensure that modifications are made at well-defined times and don't end
up invalidating loop iterators.
2013-02-28 17:19:16 -06:00
Jon Siwek
2481f9f837 Fix possible null pointer dereference in identify_data BIF.
There was no check/handling for if magic_buffer() returns null.
Also centralized libmagic calls for consistent error handling/output.
2013-02-27 16:04:36 -06:00
Jon Siwek
691622b3aa Refactor how file analysis actions are tracked.
The Info record now uses a "table[ActionArgs] of ActionResults", which
allows for simultaneous actions of a given type as long as other args
(fields in the ActionArgs record) are different.
2013-02-25 16:35:42 -06:00
Jon Siwek
4b30cc2e24 Add file analysis action to send data to script-land in chosen events. 2013-02-22 16:49:53 -06:00
Jon Siwek
dd9f361bc7 Fix build on OpenBSD 5.2. 2013-02-22 10:45:22 -06:00
Seth Hall
ff2c2c7e52 Merge remote-tracking branch 'origin/topic/jsiwek/file-analysis' into topic/seth/file-analysis-exe-analyzer
Conflicts:
	src/CMakeLists.txt
	src/file_analysis.bif
	src/file_analysis/Info.cc
2013-02-22 02:38:29 -05:00
Seth Hall
efc76fd052 Initial groundwork for analyzer actions in file analysis framework. 2013-02-22 02:36:41 -05:00
Jon Siwek
85410a7657 Add MD5/SHA1/SHA256 file analysis hashing actions. 2013-02-21 21:05:01 -06:00
Jon Siwek
ceb471fb36 Prettify file analysis IDs to be more like connection uids. 2013-02-20 22:09:39 -06:00
Jon Siwek
d158c7ffdf Fix memory leaks resulting from 'when' and 'return when' statements.
Addresses #946.
2013-02-19 16:19:16 -06:00
Jon Siwek
7e5115460c Fix three bugs with 'when' and 'return when' statements. Addresses #946
- 'when' statements were problematic when used in a function/event/hook
  that had local variables with an assigned function value.  This was
  because 'when' blocks operate on a clone of the frame and the cloning
  process serializes locals and the serialization of functions had an
  infinite cycle in it (ID -> BroFunc -> ID -> BroFunc ...).  The ID
  was only used for the function name and type information, so
  refactoring Func and subclasses to depend on those two things instead
  fixes the issue.

- 'return when' blocks, specifically, didn't work whenever execution
  of the containing function's body does another function call before
  reaching the 'return when' block, because of an assertion.  This was
  was due to logic in CallExpr::Eval always clearing the CallExpr
  associated with the Frame after doing the call, instead of restoring
  any previous CallExpr, which the code in Trigger::Eval expected to
  have available.

- An assert could be reached when the condition of a 'when' statement
  depended on checking the value of global state variables.  The assert
  in Trigger::QueueTrigger that checks that the Trigger isn't disabled
  would get hit because Trigger::Eval/Timeout disable themselves after
  running, but don't unregister themselves from the NotifierRegistry,
  which keeps calling QueueTrigger for every state access of the global.
2013-02-19 11:38:17 -06:00
Jon Siwek
f8af42cf9a Reorganizing file analysis source code. 2013-02-14 16:07:42 -06:00
Jon Siwek
f04d189d3f More work on the interface to add/remove file analysis actions.
Added the file extraction action and did other misc. cleanup.  Most of
the minimal core features/support for file analysis should be working at
this point, just have to start fleshing things out.
2013-02-14 12:53:20 -06:00
Jon Siwek
b9d204005d Merge branch 'master' into topic/jsiwek/file-analysis 2013-02-08 09:53:27 -06:00
Jon Siwek
26bf99c5a3 Add parsing for GTPv1 extension headers and control messages.
Added a generic gtpv1_message event generated for any GTP message type.

Added specific events for the create/update/delete PDP context
request/response messages.

Addresses #934.
2013-02-07 14:59:02 -06:00
Robin Sommer
52f52f60a5 Merge branch 'topic/robin/exit-after-terminate'
* topic/robin/exit-after-terminate:
  Updating submodule(s).
  Fixing exit-after-terminate when used with bare mode.
  New option exit_only_after_terminate to prevent Bro from exiting.
2013-02-04 09:44:33 -08:00
Robin Sommer
8c807d19c3 Fixing exit-after-terminate when used with bare mode. 2013-01-30 20:08:36 -08:00
Robin Sommer
f6c8995fd2 Merge remote-tracking branch 'origin/topic/jsiwek/record-coerce-orphans'
* origin/topic/jsiwek/record-coerce-orphans:
  Add an error for record coercions that would orphan a field.

Closes #936.
2013-01-25 13:53:12 -08:00
Jon Siwek
7d3b20d4fb Fix runaway reference counting bug in record coercion.
The RecordVal ctor refs the type arg via the MutableVal -> Val ctors,
so this line was double incrementing the type's ref count, but could
only decrement it once upon the Val's destruction.
2013-01-25 11:57:21 -06:00
Jon Siwek
b72fbaf99f Fix memory leak in some reporter messaging cases.
Related to the changes in fdd11428.
2013-01-24 10:26:54 -06:00
Jon Siwek
69afc4a882 Add an error for record coercions that would orphan a field.
These cases should be avoidable by fixing scripts where they occur and
they can also help catch typos that would lead to unintentional runtime
behavior.

Adding this already revealed several scripts where a field in an inlined
record was never removed after a code refactor.
2013-01-24 09:56:19 -06:00
Robin Sommer
762c034ec2 Merge remote-tracking branch 'origin/topic/bernhard/input-logging-commmon-functions'
* origin/topic/bernhard/input-logging-commmon-functions:
  add the last of Robins suggestions (separate info-struct for constructors).
  port memory leak fix from master
  harmonize function naming
  move AsciiInputOutput over to threading
  and thinking about it, ascii-io doesn't need the separator
  change constructors
  and factor stuff out the input framework too.
  factor out ascii input/output.
  std::string accessors to escape_sequence functionality
  intermediate commit - it has been over a month since I touched this...

I cleaned up the AsciiInputOutput class somewhat, including renaming
it to AsciiFormatter, renaming some of its methods, and turning the
static methods into members for consistency.

Closes #929.
2013-01-23 16:51:54 -08:00
Robin Sommer
c780bfdb48 Merge remote-tracking branch 'origin/topic/jsiwek/ticket-932'
* origin/topic/jsiwek/ticket-932:
  Fix uninitialized locals in event/hook handlers from having a value.

Closes #932.
2013-01-23 15:17:55 -08:00
Robin Sommer
854891930d Merge remote-tracking branch 'origin/topic/jsiwek/ticket-930'
* origin/topic/jsiwek/ticket-930:
  Add a null value check in CompositeHash::ComputeHash.
  Change reporter messages to more reliably print to stderr.

Closes #930.
2013-01-23 14:48:25 -08:00
Robin Sommer
dcd675280e Merge remote-tracking branch 'origin/topic/jsiwek/no-switch-fallthrough'
* origin/topic/jsiwek/no-switch-fallthrough:
  Add "fallthrough" keyword, require a flow statement to end case blocks.
  Disable automatic case fallthrough in switch stmts.  Addresses #754.

I've added a test for the error case where no break/fallthrough/return
is given.

Closes #754.
2013-01-23 14:41:23 -08:00
Jon Siwek
dd5f48e003 Missed a line that should have been in last commit. 2013-01-22 11:04:29 -06:00
Jon Siwek
2b7aedc688 Prototype file analyzer/actions, connect TCP analyzer to file analysis.
No way to add analyzers/actions and they don't do anything yet.
2013-01-22 10:48:00 -06:00
Robin Sommer
4f39470c1b New option exit_only_after_terminate to prevent Bro from exiting.
If set, the main loop won't terminate before somebody calls
terminate().

This should make input framework testing more reliable I'd hope.
2013-01-18 17:34:33 -08:00
Robin Sommer
fdf79196c6 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fixing variable size issues (was uint, should be long) with http response code.
  Revert "Trick for parallelizing input framework unit tests."
  add opaque type-ignoring for the accept_unsupported_types input framework option.
2013-01-18 17:19:40 -08:00
Gilbert Clark
cce73a3aad Fixing variable size issues (was uint, should be long) with http response code. 2013-01-18 14:23:34 -05:00
Gilbert Clark
0a7e0cc7d5 Merge branch 'master' into fastpath 2013-01-18 14:16:37 -05:00