mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Merge remote-tracking branch 'origin/topic/robin/631-deprecation-v2'
During merge I split the test for bro_init/bro_done/bro_script_loaded event errors into individual tests since the other testing of the zeek versions of those events seemed fine to otherwise keep. * origin/topic/robin/631-deprecation-v2: Update NEWS for naming changes. Small cleanup and updating submodules. Remove test for legacy plugin. Remove legancy symlinks in aux/. Add warnings when loading scripts ending in ".bro", or using legacy environment variables. Fix missing rename. No longer symlink local.zeek to local.bro. Update notice user agent. Remove old_comm_usage_is_ok. Remove bro-config.h.in and bro-path-dev.in. Change Bro wrapper script to now abort when old executable names are still used. Remove APIs that were explicitly deprecated to be removed in 3.1.
This commit is contained in:
commit
70b45d1aba
57 changed files with 164 additions and 568 deletions
|
@ -1,4 +0,0 @@
|
|||
24
|
||||
echo ${TEST} > "my file"
|
||||
27
|
||||
echo \${TEST} > \"my file\"
|
|
@ -1 +1,3 @@
|
|||
warning in /home/robin/bro/master/testing/btest/.tmp/core.load-explicit-bro-suffix-fallback/load-explicit-bro-suffix-fallback.zeek, line 5: Loading script 'foo.bro' with legacy extension, support for '.bro' will be removed in Zeek v4.1
|
||||
warning in /home/robin/bro/master/testing/btest/.tmp/core.load-explicit-bro-suffix-fallback/load-explicit-bro-suffix-fallback.zeek, line 5: Loading script 'foo.bro' with legacy extension, support for '.bro' will be removed in Zeek v4.1
|
||||
loaded foo.zeek
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
warning in /Users/tim/Desktop/projects/zeek/testing/btest/../../scripts//base/utils/json.zeek, line 2: deprecated script loaded from command line arguments ="Remove in 3.1. to_json is now always available as a built-in function."
|
|
@ -8,4 +8,3 @@
|
|||
-./frameworks/openflow/cluster.zeek
|
||||
-./frameworks/packet-filter/cluster.zeek
|
||||
-./frameworks/sumstats/cluster.zeek
|
||||
-./utils/json.zeek
|
||||
|
|
2
testing/btest/Baseline/language.bro_init/out
Normal file
2
testing/btest/Baseline/language.bro_init/out
Normal file
|
@ -0,0 +1,2 @@
|
|||
error in /Users/jsiwek/pro/zeek/zeek/testing/btest/.tmp/language.bro_init/bro_init.zeek, line 5: event bro_init() is no longer available, use zeek_init() instead
|
||||
error in /Users/jsiwek/pro/zeek/zeek/testing/btest/.tmp/language.bro_init/bro_init.zeek, line 10: event bro_done() is no longer available, use zeek_done() instead
|
1
testing/btest/Baseline/language.bro_script_loaded/out
Normal file
1
testing/btest/Baseline/language.bro_script_loaded/out
Normal file
|
@ -0,0 +1 @@
|
|||
error in /Users/jsiwek/pro/zeek/zeek/testing/btest/.tmp/language.bro_script_loaded/bro_script_loaded.zeek, line 5: event bro_script_loaded() is no longer available, use zeek_script_loaded() instead
|
|
@ -1,8 +1,6 @@
|
|||
zeek_init at priority 10!
|
||||
bro_init at priority 5!
|
||||
zeek_init at priority 0!
|
||||
bro_init at priority -10!
|
||||
zeek_init at priority -10!
|
||||
zeek_done at priority 10!
|
||||
bro_done at priority 5!
|
||||
zeek_done at priority 0!
|
||||
bro_done at priority -10!
|
||||
zeek_done at priority -10!
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
zeek_script_loaded priority 10
|
||||
bro_script_loaded priority 5
|
||||
zeek_script_loaded priority 0
|
||||
bro_script_loaded priority -10
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
Demo::Foo - A Foo test analyzer (dynamic, version 1.0.0)
|
||||
[Analyzer] Foo (ANALYZER_FOO, enabled)
|
||||
[Event] foo_message
|
||||
|
||||
===
|
||||
foo_message, [orig_h=::1, orig_p=37927/tcp, resp_h=::1, resp_p=4242/tcp], Hello, Foo!\x0a
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local a = "echo ${TEST} > \"my file\"";
|
||||
|
||||
print |a|;
|
||||
print a;
|
||||
|
||||
local b = str_shell_escape(a);
|
||||
print |b|;
|
||||
print b;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
# We don't have a foo.bro, but we'll accept foo.zeek.
|
||||
@load foo.bro
|
||||
|
|
12
testing/btest/language/bro_init.zeek
Normal file
12
testing/btest/language/bro_init.zeek
Normal file
|
@ -0,0 +1,12 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
print "ran bro_init()";
|
||||
}
|
||||
|
||||
event bro_done()
|
||||
{
|
||||
print "ran bro_done()";
|
||||
}
|
8
testing/btest/language/bro_script_loaded.zeek
Normal file
8
testing/btest/language/bro_script_loaded.zeek
Normal file
|
@ -0,0 +1,8 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
event bro_script_loaded(path: string, level: count) &priority=5
|
||||
{
|
||||
if ( /zeek_script_loaded.zeek/ in path )
|
||||
print "bro_script_loaded priority 5";
|
||||
}
|
|
@ -1,36 +1,24 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
event zeek_init() &priority=-10
|
||||
{
|
||||
print "zeek_init at priority -10!";
|
||||
}
|
||||
|
||||
event zeek_init() &priority=10
|
||||
{
|
||||
print "zeek_init at priority 10!";
|
||||
}
|
||||
|
||||
event bro_init() &priority=5
|
||||
{
|
||||
print "bro_init at priority 5!";
|
||||
}
|
||||
|
||||
event zeek_init() &priority=0
|
||||
{
|
||||
print "zeek_init at priority 0!";
|
||||
}
|
||||
|
||||
event bro_init() &priority=-10
|
||||
event zeek_done() &priority=-10
|
||||
{
|
||||
print "bro_init at priority -10!";
|
||||
}
|
||||
|
||||
|
||||
event zeek_done() &priority=10
|
||||
{
|
||||
print "zeek_done at priority 10!";
|
||||
}
|
||||
|
||||
event bro_done() &priority=5
|
||||
{
|
||||
print "bro_done at priority 5!";
|
||||
print "zeek_done at priority -10!";
|
||||
}
|
||||
|
||||
event zeek_done() &priority=0
|
||||
|
@ -38,7 +26,7 @@ event zeek_done() &priority=0
|
|||
print "zeek_done at priority 0!";
|
||||
}
|
||||
|
||||
event bro_done() &priority=-10
|
||||
event zeek_done() &priority=10
|
||||
{
|
||||
print "bro_done at priority -10!";
|
||||
print "zeek_done at priority 10!";
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
event zeek_script_loaded(path: string, level: count) &priority=10
|
||||
|
@ -7,20 +7,8 @@ event zeek_script_loaded(path: string, level: count) &priority=10
|
|||
print "zeek_script_loaded priority 10";
|
||||
}
|
||||
|
||||
event bro_script_loaded(path: string, level: count) &priority=5
|
||||
{
|
||||
if ( /zeek_script_loaded.zeek/ in path )
|
||||
print "bro_script_loaded priority 5";
|
||||
}
|
||||
|
||||
event zeek_script_loaded(path: string, level: count) &priority=0
|
||||
{
|
||||
if ( /zeek_script_loaded.zeek/ in path )
|
||||
print "zeek_script_loaded priority 0";
|
||||
}
|
||||
|
||||
event bro_script_loaded(path: string, level: count) &priority=-10
|
||||
{
|
||||
if ( /zeek_script_loaded.zeek/ in path )
|
||||
print "bro_script_loaded priority -10";
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
project(Zeek-Plugin-Demo-Foo)
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.3)
|
||||
|
||||
if ( NOT BRO_DIST )
|
||||
message(FATAL_ERROR "BRO_DIST not set")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${BRO_DIST}/cmake)
|
||||
|
||||
include(BroPlugin)
|
||||
|
||||
bro_plugin_begin(Demo Foo)
|
||||
bro_plugin_cc(src/Plugin.cc)
|
||||
bro_plugin_cc(src/Foo.cc)
|
||||
bro_plugin_bif(src/events.bif)
|
||||
bro_plugin_pac(src/foo.pac src/foo-protocol.pac src/foo-analyzer.pac)
|
||||
bro_plugin_end()
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
const ports = { 4242/tcp };
|
||||
|
||||
event zeek_init() &priority=5
|
||||
{
|
||||
Analyzer::register_for_ports(Analyzer::ANALYZER_FOO, ports);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
@load Demo/Foo/base/main
|
|
@ -1,59 +0,0 @@
|
|||
|
||||
#include "Foo.h"
|
||||
#include "foo_pac.h"
|
||||
#include "events.bif.h"
|
||||
|
||||
#include <analyzer/protocol/tcp/TCP_Reassembler.h>
|
||||
|
||||
using namespace plugin::Demo_Foo;
|
||||
|
||||
Foo::Foo(Connection* conn)
|
||||
: analyzer::tcp::TCP_ApplicationAnalyzer("Foo", conn)
|
||||
{
|
||||
interp = new binpac::Foo::Foo_Conn(this);
|
||||
}
|
||||
|
||||
Foo::~Foo()
|
||||
{
|
||||
delete interp;
|
||||
}
|
||||
|
||||
void Foo::Done()
|
||||
{
|
||||
analyzer::tcp::TCP_ApplicationAnalyzer::Done();
|
||||
|
||||
interp->FlowEOF(true);
|
||||
interp->FlowEOF(false);
|
||||
}
|
||||
|
||||
void Foo::EndpointEOF(bool is_orig)
|
||||
{
|
||||
analyzer::tcp::TCP_ApplicationAnalyzer::EndpointEOF(is_orig);
|
||||
interp->FlowEOF(is_orig);
|
||||
}
|
||||
|
||||
void Foo::DeliverStream(int len, const u_char* data, bool orig)
|
||||
{
|
||||
analyzer::tcp::TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
|
||||
|
||||
assert(TCP());
|
||||
|
||||
if ( TCP()->IsPartial() )
|
||||
// punt on partial.
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
interp->NewData(orig, data, data + len);
|
||||
}
|
||||
catch ( const binpac::Exception& e )
|
||||
{
|
||||
ProtocolViolation(fmt("Binpac exception: %s", e.c_msg()));
|
||||
}
|
||||
}
|
||||
|
||||
void Foo::Undelivered(uint64 seq, int len, bool orig)
|
||||
{
|
||||
analyzer::tcp::TCP_ApplicationAnalyzer::Undelivered(seq, len, orig);
|
||||
interp->NewGap(orig, len);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "analyzer/protocol/tcp/TCP.h"
|
||||
#include "analyzer/protocol/pia/PIA.h"
|
||||
|
||||
namespace binpac { namespace Foo { class Foo_Conn; } }
|
||||
|
||||
namespace plugin {
|
||||
namespace Demo_Foo {
|
||||
|
||||
class Foo : public analyzer::tcp::TCP_ApplicationAnalyzer {
|
||||
public:
|
||||
Foo(Connection* conn);
|
||||
~Foo();
|
||||
|
||||
virtual void Done();
|
||||
virtual void DeliverStream(int len, const u_char* data, bool orig);
|
||||
virtual void Undelivered(uint64 seq, int len, bool orig);
|
||||
virtual void EndpointEOF(bool is_orig);
|
||||
|
||||
static analyzer::Analyzer* Instantiate(Connection* conn)
|
||||
{ return new Foo(conn); }
|
||||
|
||||
protected:
|
||||
binpac::Foo::Foo_Conn* interp;
|
||||
};
|
||||
|
||||
} }
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
#include "Plugin.h"
|
||||
|
||||
#include "Foo.h"
|
||||
|
||||
namespace plugin { namespace Demo_Foo { Plugin plugin; } }
|
||||
|
||||
using namespace plugin::Demo_Foo;
|
||||
|
||||
plugin::Configuration Plugin::Configure()
|
||||
{
|
||||
AddComponent(new ::analyzer::Component("Foo", plugin::Demo_Foo::Foo::Instantiate));
|
||||
|
||||
plugin::Configuration config;
|
||||
config.name = "Demo::Foo";
|
||||
config.description = "A Foo test analyzer";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
event foo_message%(c: connection, data: string%);
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
refine connection Foo_Conn += {
|
||||
|
||||
function Foo_data(msg: Foo_Message): bool
|
||||
%{
|
||||
StringVal* data = new StringVal(${msg.data}.length(), (const char*) ${msg.data}.data());
|
||||
BifEvent::generate_foo_message(bro_analyzer(), bro_analyzer()->Conn(), data);
|
||||
return true;
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
refine typeattr Foo_Message += &let {
|
||||
proc: bool = $context.connection.Foo_data(this);
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
type Foo_Message(is_orig: bool) = record {
|
||||
data: bytestring &restofdata;
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
%include binpac.pac
|
||||
%include bro.pac
|
||||
|
||||
%extern{
|
||||
#include "Foo.h"
|
||||
|
||||
#include "events.bif.h"
|
||||
%}
|
||||
|
||||
analyzer Foo withcontext {
|
||||
connection: Foo_Conn;
|
||||
flow: Foo_Flow;
|
||||
};
|
||||
|
||||
connection Foo_Conn(bro_analyzer: BroAnalyzer) {
|
||||
upflow = Foo_Flow(true);
|
||||
downflow = Foo_Flow(false);
|
||||
};
|
||||
|
||||
%include foo-protocol.pac
|
||||
|
||||
flow Foo_Flow(is_orig: bool) {
|
||||
datagram = Foo_Message(is_orig) withcontext(connection, this);
|
||||
};
|
||||
|
||||
%include foo-analyzer.pac
|
|
@ -1,14 +0,0 @@
|
|||
# Test that legacy Bro plugins still work.
|
||||
# @TEST-EXEC: ${DIST}/aux/zeek-aux/plugin-support/init-plugin -u . Demo Foo
|
||||
# @TEST-EXEC: cp -r %DIR/legacy-plugin/* .
|
||||
# @TEST-EXEC: ./configure --bro-dist=${DIST} && make
|
||||
# @TEST-EXEC: unset ZEEK_PLUGIN_PATH; BRO_PLUGIN_PATH=`pwd` zeek -NN Demo::Foo >>output
|
||||
# @TEST-EXEC: echo === >>output
|
||||
# @TEST-EXEC: unset ZEEK_PLUGIN_PATH; BRO_PLUGIN_PATH=`pwd` zeek -r $TRACES/port4242.trace %INPUT >>output
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff output
|
||||
|
||||
event foo_message(c: connection, data: string)
|
||||
{
|
||||
print "foo_message", c$id, data;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue