sigolyze

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sigolyze

Go

Signature based anlysis library for golang

Signature example

{
    "name": "Example Signature",
    "patterns": [
      {
        "name": "Pattern 1",
        "value": "Value1",
        "is_regex": true
      },
      {
        "name": "Pattern 2",
        "value": "Value2",
        "is_regex": false
      }
    ],
    "tags": ["tag1", "tag2"],
    "meta": [
      {
        "name": "Meta1",
        "info": ["detail1", "detail2"]
      },
      {
        "name": "Meta2",
        "info": ["detail3"]
      }
    ]
  }

Documentation

Overview

Package sigolyze provides interface to quick signature-based substring searching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	Signatures      []Signature
	SignaturesByTag map[string][]*Signature
}

Compiler stores all pre-compiled signatures

func NewCompiler

func NewCompiler() *Compiler

NewCompiler is a Compiler constructor

func (*Compiler) LoadSignature

func (c *Compiler) LoadSignature(data []byte) error

LoadSignature loads new signature to compiler and compiles it

func (*Compiler) LoadSignatureFromJson

func (c *Compiler) LoadSignatureFromJson(path string) error

LoadSignatureFromJson is warpper around LoadSignatureFrom to load signature from .json file

type MetaInfo

type MetaInfo struct {
	Name string   `json:"name"`
	Info []string `json:"info"`
}

func (*MetaInfo) NewMetaInfo

func (m *MetaInfo) NewMetaInfo(name string, info []string) *MetaInfo

type Pattern

type Pattern struct {
	Name    string `json:"name"`
	Value   string `json:"value"`
	IsRegex bool   `json:"is_regex"`
}

func (*Pattern) NewPattern

func (p *Pattern) NewPattern(name string, value string, isRegex bool) *Pattern

type Signature

type Signature struct {
	Name     string     `json:"name"`
	Patterns []Pattern  `json:"patterns"`
	Tags     []string   `json:"tags"`
	Meta     []MetaInfo `json:"meta"`
	Matcher  *ahocorasick.Matcher
	// contains filtered or unexported fields
}

Signature contains pre-compiled ahocorasick mather and regex strings as well as some metainforamtion to define signature.

func Match

func Match(compiler *Compiler, data string) []*Signature

Match searches matches in given data with all compiler's signatures. It returns all matched signatures.

func MatchTags

func MatchTags(compiler *Compiler, data string, tags []string) []*Signature

MatchTags searches matches in given data with exact tagged compiler's signatures. It returns all matched signatures.

func (*Signature) NewSignature

func (s *Signature) NewSignature(name string, patterns []Pattern, tags []string, meta []MetaInfo) *Signature

Jump to

Keyboard shortcuts

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