mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Added plugin.unprocessed_packet_hook btest
This commit is contained in:
parent
d0f8c50417
commit
6e8dae316b
8 changed files with 540 additions and 2 deletions
|
@ -0,0 +1,39 @@
|
|||
|
||||
#include "Plugin.h"
|
||||
|
||||
#include <Func.h>
|
||||
#include <Event.h>
|
||||
#include <Conn.h>
|
||||
#include <Desc.h>
|
||||
#include <threading/Formatter.h>
|
||||
#include <RunState.h>
|
||||
|
||||
namespace btest::plugin::Demo_Unprocessed_Packet { Plugin plugin; }
|
||||
|
||||
using namespace btest::plugin::Demo_Unprocessed_Packet;
|
||||
|
||||
zeek::plugin::Configuration Plugin::Configure()
|
||||
{
|
||||
EnableHook(zeek::plugin::HOOK_UNPROCESSED_PACKET);
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Demo::Unprocessed_Packet";
|
||||
config.description = "Exercises all plugin hooks";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
||||
|
||||
void Plugin::HookUnprocessedPacket(const zeek::Packet* packet)
|
||||
{
|
||||
zeek::ODesc d;
|
||||
d.Add("[");
|
||||
d.Add("ts=");
|
||||
d.Add(packet->time);
|
||||
d.Add(" len=");
|
||||
d.Add(packet->len);
|
||||
d.Add("]");
|
||||
|
||||
fprintf(stdout, "%.6f %-23s %s\n", zeek::run_state::network_time, "| HookUnprocessedPacket", d.Description());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue