generator

package
v0.0.0-...-0a18445 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const INDENT = "  "

INDENT are the characters used for indenting code.

Variables

This section is empty.

Functions

func CamelToSnakeCase

func CamelToSnakeCase(s string) string

CamelToSnakeCase converts identifier in camel case (FooBarBaz) to snake case (foo_bar_baz)

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator takes a FileDescriptor (a helper type which is just a thin wrapper around a FileDescriptorProto) and a generates a YARA module for the protocol buffer defined by the FileDescriptor. See: https://godoc.org/github.com/jhump/protoreflect/desc#FileDescriptor https://godoc.org/github.com/golang/protobuf/protoc-gen-go/descriptor#FileDescriptorProto

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates an new module generator.

func (*Generator) Parse

func (g *Generator) Parse(fd *desc.FileDescriptor, out io.Writer) error

Parse receive a FileDescriptor describing a .proto file and writes the source code for the corresponding YARA module into the provided writer. The .proto file must include a snippet similar to the one below.

  import "yara.proto"

  package "foo"

  option (yara.module_options) = {
	   name : "foo"
	   root_message: "foo.FooMessage";
  };

These options are required for the generator to be able to generate the YARA module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL