for i, line in enumerate(inlines):
if line.find("case ALPROTO_TEMPLATE:") > -1:
- # Duplicate the section starting an this line and
+ # Duplicate the section starting at this line and
# including the following 2 lines.
for j in range(i, i + 3):
temp = inlines[j]
output.write(temp)
if line.find("return ALPROTO_TEMPLATE;") > -1:
- output.write(
- line.replace("TEMPLATE", protoname.upper()).replace(
- "template", protoname.lower()))
+ # Duplicate the section starting at this line and
+ # including the following line.
+ for j in range(i, i + 2):
+ temp = inlines[j]
+ temp = temp.replace("TEMPLATE", protoname.upper())
+ temp = temp.replace("template", protoname.lower())
+ output.write(temp)
output.write(line)
open(filename, "w").write(output.getvalue())
return ALPROTO_PGSQL;
if (strcmp(proto_name, "telnet") == 0)
return ALPROTO_TELNET;
- if (strcmp(proto_name,"template")==0) return ALPROTO_TEMPLATE;
- if (strcmp(proto_name,"template-rust")==0) return ALPROTO_TEMPLATE_RUST;
+ if (strcmp(proto_name, "template") == 0)
+ return ALPROTO_TEMPLATE;
+ if (strcmp(proto_name, "template-rust") == 0)
+ return ALPROTO_TEMPLATE_RUST;
if (strcmp(proto_name,"rdp")==0) return ALPROTO_RDP;
if (strcmp(proto_name,"http2")==0) return ALPROTO_HTTP2;
if (strcmp(proto_name, "bittorrent-dht") == 0)
#include "detect-engine-build.h"
#include "rust.h"
-
-static int DetectTemplateRustBufferSetup(DetectEngineCtx *, Signature *,
- const char *);
+static int DetectTemplateRustBufferSetup(DetectEngineCtx *, Signature *, const char *);
static uint8_t DetectEngineInspectTemplateRustBuffer(DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine,
const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
SCLogNotice("Template application layer detect registered.");
}
-static int DetectTemplateRustBufferSetup(DetectEngineCtx *de_ctx, Signature *s,
- const char *str)
+static int DetectTemplateRustBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
s->init_data->list = g_template_rust_id;
FAIL_IF_NULL(de_ctx);
/* This rule should match. */
- s = DetectEngineAppendSig(de_ctx,
- "alert tcp any any -> any any ("
- "msg:\"TEMPLATE Test Rule\"; "
- "template_rust_buffer; content:\"World!\"; "
- "sid:1; rev:1;)");
+ s = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any ("
+ "msg:\"TEMPLATE Test Rule\"; "
+ "template_rust_buffer; content:\"World!\"; "
+ "sid:1; rev:1;)");
FAIL_IF_NULL(s);
/* This rule should not match. */
- s = DetectEngineAppendSig(de_ctx,
- "alert tcp any any -> any any ("
- "msg:\"TEMPLATE Test Rule\"; "
- "template_rust_buffer; content:\"W0rld!\"; "
- "sid:2; rev:1;)");
+ s = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any ("
+ "msg:\"TEMPLATE Test Rule\"; "
+ "template_rust_buffer; content:\"W0rld!\"; "
+ "sid:2; rev:1;)");
FAIL_IF_NULL(s);
SigGroupBuild(de_ctx);
DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx);
- AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TEMPLATE_RUST,
- STREAM_TOSERVER, request, sizeof(request));
+ AppLayerParserParse(
+ NULL, alp_tctx, &f, ALPROTO_TEMPLATE_RUST, STREAM_TOSERVER, request, sizeof(request));
/* Check that we have app-layer state. */
FAIL_IF_NULL(f.alstate);
#ifndef __DETECT_TEMPLATE_RUST_BUFFER_H__
#define __DETECT_TEMPLATE_RUST_BUFFER_H__
-
void DetectTemplateRustBufferRegister(void);
#endif /* __DETECT_TEMPLATE_RUST_BUFFER_H__ */
#include "rust.h"
typedef struct LogTemplateFileCtx_ {
- uint32_t flags;
+ uint32_t flags;
OutputJsonCtx *eve_ctx;
} LogTemplateFileCtx;
OutputJsonThreadCtx *ctx;
} LogTemplateLogThread;
-static int JsonTemplateLogger(ThreadVars *tv, void *thread_data,
- const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
+static int JsonTemplateLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f,
+ void *state, void *tx, uint64_t tx_id)
{
SCLogNotice("JsonTemplateLogger");
LogTemplateLogThread *thread = thread_data;
SCFree(output_ctx);
}
-static OutputInitResult OutputTemplateLogInitSub(ConfNode *conf,
- OutputCtx *parent_ctx)
+static OutputInitResult OutputTemplateLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
OutputInitResult result = { NULL, false };
OutputJsonCtx *ajt = parent_ctx->data;