models

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	ID     uint `json:"id" gorm:"primarykey"`
	FileID uint `json:"file_id" gorm:"index:idx_cred"`

	Rule string    `json:"rule"`
	Time time.Time `json:"time"`

	UserDomain string `json:"user_domain"`
	Username   string `json:"username"`
	Password   string `json:"password"`

	CPF string `json:"cpf"`

	Url       string `json:"url"`
	UrlDomain string `json:"url_domain"`

	Severity int     `json:"severity"`
	Entropy  float32 `json:"entropy"`

	NearText string `json:"near_text"`
}

func (Credential) CalcHash added in v0.1.21

func (cred Credential) CalcHash(additional_data string) string

func (Credential) MarshalJSON

func (cred Credential) MarshalJSON() ([]byte, error)

Custom Marshaller for Credential

func (*Credential) Sanitize added in v0.1.30

func (cred *Credential) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

type Document added in v0.1.36

type Document struct {
	ID     uint `json:"id" gorm:"primarykey"`
	FileID uint `json:"file_id" gorm:"index:idx_document"`

	Time time.Time `json:"time"`

	Raw    string `json:"raw"`
	Number string `json:"number"`
	IsCPF  bool   `json:"is_cpf"`
	IsCNPJ bool   `json:"is_cnpj"`

	Source   string `json:"source"`
	FileName string `json:"file_name"`
	Line     string `json:"line"`

	NearText string `json:"near_text"`
}

func (Document) CalcHash added in v0.1.36

func (d Document) CalcHash(additional_data string) string

func (Document) MarshalJSON added in v0.1.36

func (d Document) MarshalJSON() ([]byte, error)

Custom Marshaller for Document

func (*Document) Sanitize added in v0.1.36

func (d *Document) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

type Email

type Email struct {
	ID     uint `json:"id" gorm:"primarykey"`
	FileID uint `json:"file_id" gorm:"index:idx_email"`

	Time time.Time `json:"time"`

	Domain string `json:"domain"`
	Email  string `json:"email"`

	NearText string `json:"near_text"`
}

func (Email) CalcHash added in v0.1.21

func (eml Email) CalcHash(additional_data string) string

func (Email) MarshalJSON

func (eml Email) MarshalJSON() ([]byte, error)

Custom Marshaller for URL

func (*Email) Sanitize added in v0.1.30

func (eml *Email) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

type File

type File struct {
	ID uint `json:"id" gorm:"primarykey"`

	Provider  string    `json:"provider"` //IntelX, ...
	FilePath  string    `json:"file_path"`
	FileName  string    `json:"file_name"`
	Name      string    `json:"name"`
	Date      time.Time `json:"date"`
	Bucket    string    `json:"bucket"`
	MediaType string    `json:"media_type"`
	IndexedAt time.Time `json:"indexed_at"`

	Size        uint   `json:"size"`
	ProviderId  string `json:"provider_id"`
	MIMEType    string `json:"mime_type"`
	Fingerprint string `json:"fingerprint";gorm:"unique;not null"`

	Content string `json:"content"`

	// Failed flag set if the result should be considered failed
	Failed       bool   `json:"failed"`
	FailedReason string `json:"failed_reason"`

	Credentials []Credential `json:"credentials" gorm:"constraint:OnDelete:CASCADE"`
	Emails      []Email      `json:"emails" gorm:"constraint:OnDelete:CASCADE"`
	URLs        []URL        `json:"urls" gorm:"constraint:OnDelete:CASCADE"`
	Phones      []Phone      `json:"phones" gorm:"constraint:OnDelete:CASCADE"`
	Documents   []Document   `json:"documents" gorm:"constraint:OnDelete:CASCADE"`
}

Name,Date,Bucket,Media,Content Type,Size,System ID

func (File) Clone added in v0.1.1

func (file File) Clone() *File

func (File) MarshalJSON

func (file File) MarshalJSON() ([]byte, error)

Custom Marshaller for File

func (*File) Sanitize added in v0.1.30

func (file *File) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

type Finding

type Finding struct {
	// Rule is the name of the rule that was matched
	RuleID      string
	Description string

	StartLine   int
	EndLine     int
	StartColumn int
	EndColumn   int

	Line string `json:"-"`

	Match string

	// Secret contains the full content of what is matched in
	// the tree-sitter query.
	Secret string

	// File is the name of the file containing the finding
	File        string
	SymlinkFile string
	Commit      string
	Link        string `json:",omitempty"`

	// Entropy is the shannon entropy of Value
	Entropy float32

	Author  string
	Date    string
	Message string
	Tags    []string

	// unique identifier
	Fingerprint string

	Credential Credential
	Email      Email
	Url        URL
	Phone      Phone
	Document   Document
}

Finding contains information about strings that have been captured by a tree-sitter query.

type Phone added in v0.1.36

type Phone struct {
	ID     uint `json:"id" gorm:"primarykey"`
	FileID uint `json:"file_id" gorm:"index:idx_phone"`

	Time time.Time `json:"time"`

	Country string `json:"country"`
	Raw     string `json:"raw"`
	Phone   string `json:"phone"`

	Source   string `json:"source"`
	FileName string `json:"file_name"`
	Line     string `json:"line"`

	NearText string `json:"near_text"`
}

func (Phone) CalcHash added in v0.1.36

func (p Phone) CalcHash(additional_data string) string

func (Phone) MarshalJSON added in v0.1.36

func (p Phone) MarshalJSON() ([]byte, error)

Custom Marshaller for Phone

func (*Phone) Sanitize added in v0.1.36

func (p *Phone) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

type URL

type URL struct {
	ID     uint `json:"id" gorm:"primarykey"`
	FileID uint `json:"file_id" gorm:"index:idx_url"`

	Time time.Time `json:"time"`

	Domain string `json:"domain"`
	Url    string `json:"url"`

	NearText string `json:"near_text"`
}

func (URL) CalcHash added in v0.1.21

func (u URL) CalcHash(additional_data string) string

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

Custom Marshaller for URL

func (*URL) Sanitize added in v0.1.30

func (u *URL) Sanitize()

Sanitize removes null bytes and invalid UTF-8 sequences from all string fields

Jump to

Keyboard shortcuts

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