models

package
v0.0.0-...-84c3d05 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCampaign

func CreateCampaign(campaign *Campaign) (err error)

CreateCampaign creates a campaign in the database

func CreateCredential

func CreateCredential(credential *Credential) (err error)

CreateCredential creates a source in the database

func CreateFakeCreds

func CreateFakeCreds(h *Honeypot, source *Source) (credentials string, err error)

CreateFakeCreds creates randomly-generated fake credentials and returns a string with the data

func CreateHit

func CreateHit(hit *Hit) (err error)

CreateHit creates a hit in the database

func CreateListener

func CreateListener(listener *Listener) (err error)

CreateListener creates a listener in the database

func CreateSource

func CreateSource(source *Source) (err error)

CreateSource creates a source in the database

func DeleteCampaign

func DeleteCampaign(campaign *Campaign, id int) (err error)

DeleteCampaign deletes a campaign in the database

func DeleteHit

func DeleteHit(hit *Hit, id int) (err error)

DeleteHit deletes a hit in the database

func DeleteListener

func DeleteListener(listener *Listener, id int) (err error)

DeleteListener deletes a listener in the database

func DeleteSource

func DeleteSource(source *Source, id int) (err error)

DeleteSource deletes a source in the database

func GetCampaign

func GetCampaign(campaign *Campaign, id int) (err error)

GetCampaign gets a campaign in the database corresponding to id

func GetCampaigns

func GetCampaigns(campaigns *[]Campaign) (err error)

GetCampaigns gets all campaigns in database

func GetHit

func GetHit(hit *Hit, id int) (err error)

GetHit gets a hit in the database corresponding to id

func GetHits

func GetHits(hits *[]Hit) (err error)

GetHits gets all hits in database

func GetHoneypots

func GetHoneypots(honeypots *[]Honeypot) (err error)

GetHoneypots gets all hits in database

func GetListener

func GetListener(listener *Listener, id int) (err error)

GetListener gets a listener in the database corresponding to id

func GetListeners

func GetListeners(listeners *[]Listener) (err error)

GetListeners gets all listeners in database

func GetSource

func GetSource(source *Source, id int) (err error)

GetSource gets a source in the database corresponding to id

func GetSources

func GetSources(sources *[]Source) (err error)

GetSources gets all sources in database

func UpdateCampaign

func UpdateCampaign(campaign *Campaign, id int) (err error)

UpdateCampaign updates a campaign in the database

func UpdateListener

func UpdateListener(listener *Listener, id int) (err error)

UpdateListener updates a listener in the database

func UpdateSource

func UpdateSource(source *Source, id int) (err error)

UpdateSource updates a source in the database

Types

type Campaign

type Campaign struct {
	ID        uint       `gorm:"primary_key" json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt"`
	Name      string     `json:"name" validate:"required"`
	Honeypots []Honeypot `json:"honeypots"`
	Hits      []Hit      `json:"hits"`
}

Campaign model

func (*Campaign) BeforeSave

func (c *Campaign) BeforeSave() (err error)

BeforeSave hook validates campaign

func (*Campaign) Validate

func (c *Campaign) Validate() error

Validate validates struct fields

type Credential

type Credential struct {
	ID         uint       `gorm:"primary_key" json:"id"`
	CreatedAt  time.Time  `json:"createdAt"`
	UpdatedAt  time.Time  `json:"updatedAt"`
	DeletedAt  *time.Time `json:"deletedAt"`
	Username   string     `json:"username" validate:"required"`
	Password   string     `json:"password" validate:"required"`
	HoneypotID uint       `json:"honeypotId" validate:"required"`
}

Credential model

func (*Credential) BeforeSave

func (c *Credential) BeforeSave() (err error)

BeforeSave hook validates credential

func (*Credential) Validate

func (c *Credential) Validate() error

Validate validates struct fields

type Hit

type Hit struct {
	ID           uint       `gorm:"primary_key" json:"id"`
	CreatedAt    time.Time  `json:"createdAt"`
	UpdatedAt    time.Time  `json:"updatedAt"`
	DeletedAt    *time.Time `json:"deletedAt"`
	CampaignID   uint       `json:"campaignId" validate:"required"`
	CredentialID *uint      `json:"credentialId"`
	Email        *string    `json:"email"`
	HoneypotID   uint       `json:"honeypotId" validate:"required"`
	ListenerID   uint       `json:"listenerId" validate:"required"`
	SourceID     uint       `json:"sourceId" validate:"required"`
	IPAddress    *string    `json:"ipAddress"`
	Type         HitType    `json:"type" validate:"required"`
}

Hit model

func (*Hit) BeforeSave

func (h *Hit) BeforeSave() (err error)

BeforeSave hook validates hit

func (*Hit) Validate

func (h *Hit) Validate() error

Validate validates struct fields

type HitType

type HitType int

HitType defines the different hit types

const (
	FacebookRequest HitType = iota + 1
	LoginAttempt
	LinkedInRequest
	LinkedInConnect
)

Enumerate various hits

type Honeypot

type Honeypot struct {
	ID          uint         `gorm:"primary_key" json:"id"`
	CreatedAt   time.Time    `json:"createdAt"`
	UpdatedAt   time.Time    `json:"updatedAt"`
	DeletedAt   *time.Time   `json:"deletedAt"`
	Name        string       `json:"name" validate:"required"`
	CampaignID  uint         `json:"campaignId"`
	Credentials []Credential `json:"credentials"`
	ListenerID  uint         `json:"listenerId" validate:"required"`
	SourceID    uint         `json:"sourceId" validate:"required"`
}

Honeypot model

func (*Honeypot) AfterCreate

func (h *Honeypot) AfterCreate(scope *gorm.Scope) (err error)

AfterCreate creates and save the fake Pastebin credentials if the Honeypot has a Pastebin Source

func (*Honeypot) BeforeSave

func (h *Honeypot) BeforeSave() (err error)

BeforeSave hook validates honeypot

func (*Honeypot) BeforeUpdate

func (h *Honeypot) BeforeUpdate() (err error)

BeforeUpdate creates and save the fake Pastebin credentials if the Honeypot has a Pastebin Source

func (*Honeypot) Validate

func (h *Honeypot) Validate() error

Validate validates struct fields

type Listener

type Listener struct {
	ID        uint       `gorm:"primary_key" json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt"`
	Name      string     `json:"name" validate:"required"`
	Type      uint       `json:"type" validate:"required"`
	URL       *string    `json:"url"`
	Email     *string    `json:"email"`
}

Listener model

func (*Listener) BeforeSave

func (l *Listener) BeforeSave() (err error)

BeforeSave hook validates listener

func (*Listener) Validate

func (l *Listener) Validate() error

Validate validates struct fields

type ListenerType

type ListenerType int

ListenerType defines the different listener types

const (
	LoginListener ListenerType = iota + 1
	SocialListener
)

Enumerate various listeners

type Source

type Source struct {
	ID           uint           `gorm:"primary_key" json:"id"`
	CreatedAt    time.Time      `json:"createdAt"`
	UpdatedAt    time.Time      `json:"updatedAt"`
	DeletedAt    *time.Time     `json:"deletedAt"`
	Name         string         `gorm:"not null" json:"name" validate:"required"`
	Type         uint           `json:"type" validate:"required"`
	APIKey       *string        `json:"apiKey"`
	Email        *string        `json:"email"`
	Honeypots    []Honeypot     `json:"honeypots"`
	PastebinURLs pq.StringArray `gorm:"type:varchar(100)[]" json:"pastebinUrls"`
}

Source model

func (*Source) BeforeSave

func (s *Source) BeforeSave() (err error)

BeforeSave hook validates source

func (*Source) Validate

func (s *Source) Validate() error

Validate validates struct fields

type SourceType

type SourceType int

SourceType defines the different fake OSINT sources

const (
	FacebookSource SourceType = iota + 1
	LinkedInSource
	PastebinSource
)

Enumerate various actions

Jump to

Keyboard shortcuts

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