Go to the documentation of this file.
28 static int DetectSNMPCommunityTest(
void)
40 0x30, 0x27, 0x02, 0x01, 0x01, 0x04, 0x0b, 0x5b,
41 0x52, 0x30, 0x5f, 0x43, 0x40, 0x63, 0x74, 0x69,
42 0x21, 0x5d, 0xa1, 0x15, 0x02, 0x04, 0x2b, 0x13,
43 0x3f, 0x85, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00,
44 0x30, 0x07, 0x30, 0x05, 0x06, 0x01, 0x01, 0x05,
49 memset(&f, 0,
sizeof(
Flow));
56 f.
proto = IPPROTO_UDP;
69 "alert snmp any any -> any any ("
70 "msg:\"SNMP Test Rule\"; "
71 "snmp.community; content:\"[R0_C@cti!]\"; "
77 "alert snmp any any -> any any ("
78 "msg:\"SNMP Test Rule\"; "
79 "snmp.community; content:\"private\"; "
87 STREAM_TOSERVER, request,
sizeof(request));
109 static void DetectSNMPCommunityRegisterTests(
void)
112 DetectSNMPCommunityTest);
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
#define FLOW_PKT_TOSERVER
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
void StreamTcpInitConfig(bool)
To initialize the stream global configuration data.
#define FLOW_INITIALIZE(f)
#define PASS
Pass the test.
AppLayerParserThreadCtx * alp_tctx
Per thread variable structure.
int SigGroupCleanup(DetectEngineCtx *de_ctx)
uint8_t FlowGetProtoMapping(uint8_t proto)
Function to map the protocol to the defined FLOW_PROTO_* enumeration.
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
void StreamTcpFreeConfig(bool quiet)
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
void UTHFreePacket(Packet *p)
UTHFreePacket: function to release the allocated data from UTHBuildPacket and the packet itself.
#define FLOW_PKT_ESTABLISHED
DetectEngineCtx * DetectEngineCtxInit(void)
AppProto alproto
application level protocol