session

package
v0.0.0-...-163acdf Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 34 Imported by: 98

Documentation

Index

Constants

View Source
const (
	EXEC_COMMAND     = "EXEC_COMMAND"
	MONITOR_MATCH    = "MONITOR_MATCH"
	TARGET_ADD       = "TARGET_ADD"
	TARGET_LINK      = "TARGET_LINK"
	TAG_ADD          = "TAG_ADD"
	ERROR_GENERIC    = "ERROR_GENERIC"
	ERROR_MODULE     = "ERROR_MODULE"
	RESULTS_ADD      = "RESULTS_ADD"
	RESULTS_SYNC     = "RESULTS_SYNC"
	WEBHOOK_SEND     = "WEBHOOK_SEND"
	TRACKER_FOUND    = "TRACKER_FOUND"
	TRACKER_SELECTED = "TRACKER_SELECTED"
	TRACKER_UNKNOWN  = "TRACKER_UNKNOWN"
)
View Source
const (
	INT    = 1
	STRING = 2
	BOOL   = 3
	FLOAT  = 4
)
View Source
const (
	T_TARGET_IP_ADDRESS = "ip_address"
	T_TARGET_USERNAME   = "username"
	T_TARGET_COMMAND    = "command"
	T_TARGET_TEXT       = "text"
	T_TARGET_WEBSITE    = "website"
	T_TARGET_URL        = "url"
	T_TARGET_HEADER     = "header"
	T_TARGET_SEARCH     = "search"
	T_TARGET_BLANK      = ""
	T_TARGET_INSTAGRAM  = "instagram"
	T_TARGET_FILE       = "file"
	T_TARGET_ENTERPRISE = "enterprise"
	T_TARGET_MAC        = "mac"
	T_TARGET_EMAIL      = "email"
	T_TARGET_PHONE      = "phone"
	T_TARGET_COUNTRY    = "country"
	T_TARGET_TWITTER    = "twitter"
	T_TARGET_SESSION    = "session"
	T_TARGET_IMPORT     = "import"
	T_TARGET_PERSON     = "person"
	T_TARGET_SOFTWARE   = "software"
	T_TARGET_WHATSAPP   = "whatsapp"
)

Variables

This section is empty.

Functions

func IntSliceKeyExist

func IntSliceKeyExist(l []int, i int) bool

func LoadAliasMenu

func LoadAliasMenu(line string, module Module, s *Session) []string

func LoadEventsMenu

func LoadEventsMenu(line string, module Module, s *Session) []string

func LoadFindCommandMenu

func LoadFindCommandMenu(line string, module Module, s *Session) []string

func LoadIntervalCommandMenu

func LoadIntervalCommandMenu(line string, module Module, s *Session) []string

func LoadModuleByTypeMenu

func LoadModuleByTypeMenu(line string, module Module, s *Session) []string

func LoadModuleMenu

func LoadModuleMenu(line string, module Module, s *Session) []string

func LoadMonitorCommandMenu

func LoadMonitorCommandMenu(line string, module Module, s *Session) []string

func LoadNoteMenu

func LoadNoteMenu(line string, module Module, s *Session) []string

@todo solve error in parsing line

func LoadNotificationCommandMenu

func LoadNotificationCommandMenu(line string, module Module, s *Session) []string

func LoadResultMenu

func LoadResultMenu(line string, module Module, s *Session) []string

func LoadShCommandMenu

func LoadShCommandMenu(line string, module Module, s *Session) []string

func LoadTargetMenu

func LoadTargetMenu(line string, module Module, s *Session) []string

func LoadTrackerCommandMenu

func LoadTrackerCommandMenu(line string, module Module, s *Session) []string

func LoadWebHookMenu

func LoadWebHookMenu(line string, module Module, s *Session) []string

Types

type Backup

type Backup struct {
	Id              int               `json:"-" gorm:"primary_key:yes;column:id;AUTO_INCREMENT"`
	SessionName     string            `json:"session_name"`
	Information     Information       `json:"information"`
	Instances       []*Instance       `json:"instances"`
	CurrentInstance *Instance         `json:"current_instance"`
	Events          Events            `json:"events"`
	SourceFile      string            `json:"source_file"`
	Version         string            `json:"version" sql:"-"`
	Targets         []*Target         `json:"targets" sql:"-"`
	Monitors        Monitors          `json:"monitors"`
	TypeLists       []string          `json:"type_lists" sql:"-"`
	ServiceFolder   string            `json:"home_folder"`
	Services        []Listener        `json:"services"`
	Alias           map[string]string `json:"-" sql:"-"`
	Interval        []*Interval       `json:"interval"`
	WebHooks        []*WebHook        `json:"web_hooks"`
}

type BackupInstances

type BackupInstances struct {
	Instances []*Instance `json:"instances"`
}

type BackupInterval

type BackupInterval struct {
	Interval []*Interval `json:"interval"`
}

type BackupMonitors

type BackupMonitors struct {
	Monitors Monitors `json:"monitors"`
}

type BackupSession

type BackupSession struct {
	Id            int               `json:"-" gorm:"primary_key:yes;column:id;AUTO_INCREMENT"`
	SessionName   string            `json:"session_name"`
	Information   Information       `json:"information"`
	Events        Events            `json:"events"`
	SourceFile    string            `json:"source_file"`
	Version       string            `json:"version" sql:"-"`
	TypeLists     []string          `json:"type_lists" sql:"-"`
	ServiceFolder string            `json:"home_folder"`
	Services      []Listener        `json:"services"`
	Alias         map[string]string `json:"-" sql:"-"`
}

type BackupTargets

type BackupTargets struct {
	Targets []*Target `json:"targets" sql:"-"`
}

type BackupWebhooks

type BackupWebhooks struct {
	WebHooks []*WebHook `json:"web_hooks"`
}

type Bounds

type Bounds struct {
	Distance  float64  `json:"distance"`
	NorthWest Position `json:"north_west"`
	SouthWest Position `json:"south_west"`
	NorthEast Position `json:"north_east"`
	SouthEast Position `json:"south_east"`
}

type Connection

type Connection struct {
	ConnectionInstance
	ORM        *gorm.DB               `json:"-"`
	Migrations map[string]interface{} `json:"-"`
}

func (*Connection) GetDB

func (c *Connection) GetDB() *sql.DB

func (*Connection) GetORM

func (c *Connection) GetORM() *gorm.DB

func (*Connection) LoadMigration

func (c *Connection) LoadMigration()

func (*Connection) Migrate

func (c *Connection) Migrate() bool

type ConnectionInstance

type ConnectionInstance interface {
	GetORM() *gorm.DB
	GetDB() *sql.DB
	Migrate() bool
}

type CronJob

type CronJob interface {
	Name() string
	Run() (bool, error)
	GetHibernate() time.Duration
	HasConfiguration() bool
	GetConfiguration() map[string]string
	GetRequired() []string
}

type Event

type Event struct {
	EventId string      `json:"event_id"`
	Type    string      `json:"type"`
	Value   interface{} `json:"raw"`
	JSON    interface{} `json:"json"`
	Date    time.Time   `json:"date"`
}

type Events

type Events struct {
	Watcher []string `json:"notifier"`
	Lists   []*Event `json:"lists"`
}

type Headers

type Headers map[string]string

func (Headers) Add

func (header Headers) Add(key string, value string)

type Information

type Information struct {
	ApiStatus      bool `json:"api_status"`
	TrackerStatus  bool `json:"tracker_status"`
	ModuleLaunched int  `json:"module_launched"`
	Event          int  `json:"event"`
}

func (*Information) AddEvent

func (i *Information) AddEvent()

func (*Information) AddModule

func (i *Information) AddModule()

func (*Information) SetApi

func (i *Information) SetApi(s bool)

func (*Information) SetTracker

func (i *Information) SetTracker(s bool)

type Instance

type Instance struct {
	Id        string             `json:"id"`
	Module    string             `json:"module"`
	Results   [][]OpfResultValue `json:"results"`
	CreatedAt time.Time          `json:"created_at"`
}

func (*Instance) GetModuleName

func (i *Instance) GetModuleName() string

Get instance module name

func (*Instance) SetResults

func (i *Instance) SetResults(r []OpfResultValue)

Set result to instance

type Interval

type Interval struct {
	Id               string        `json:"id"`
	S                *Session      `json:"-"`
	Commands         []string      `json:"commands"`
	Delay            int           `json:"delay"`
	Time             time.Duration `json:"time"`
	ExecutionNumbers int           `json:"execution_numbers"`
	LastRun          time.Time     `json:"last_run"`
	NextRun          time.Time     `json:"next_run"`
	Activated        bool          `json:"activated"`
}

func (*Interval) Down

func (i *Interval) Down() *Interval

func (*Interval) GetCommands

func (i *Interval) GetCommands() []string

func (*Interval) GetDelay

func (i *Interval) GetDelay() int

func (*Interval) SetCommand

func (i *Interval) SetCommand(command string) *Interval

func (*Interval) SetDelay

func (i *Interval) SetDelay(delay int) *Interval

func (*Interval) SetId

func (i *Interval) SetId() *Interval

func (*Interval) SetSession

func (i *Interval) SetSession(s *Session) *Interval

func (*Interval) SetTimeType

func (i *Interval) SetTimeType(s string) *Interval

func (*Interval) Up

func (i *Interval) Up() bool

type Linking

type Linking struct {
	LinkingId      int    `json:"-" gorm:"primary_key:yes;column:id;AUTO_INCREMENT"`
	SessionId      int    `json:"session_id" gorm:"column:session_id"`
	TargetBase     string `json:"target_base" gorm:"column:target_base"`
	TargetId       string `json:"target_id" gorm:"column:target_id"`
	TargetName     string `json:"target_name" gorm:"column:target_name"`
	TargetType     string `json:"target_type" gorm:"column:target_type"`
	TargetResultId string `json:"target_result_id" gorm:"column:target_result_id"`
	OpfResultsTo   string `json:"target_results_to"`
}

func (Linking) TableName

func (Linking) TableName() string

type Listener

type Listener struct {
	ExecutedAt    time.Time `json:"executed_at"`
	NextExecution time.Time `json:"next_execution"`
	CronJob       CronJob   `json:"cron_job"`
}

type Module

type Module interface {
	Start()
	Name() string
	Author() string
	Description() string
	GetType() []string
	ListArguments()
	GetExport() []OpfResults
	SetExport(result OpfResults)
	GetResults() []string
	GetInformation() ModuleInformation
	CheckRequired() bool
	SetParameter(name string, value string) (bool, error)
	GetParameter(name string) (Param, error)
	GetAllParameters() []Param
	WithProgram(name string) bool
	GetExternal() []string
	CreateNewParam(name string, description string, value string, isRequired bool, paramType int)
}

type ModuleEvent

type ModuleEvent struct {
	ModuleName string
	Results    interface{}
}

type ModuleFilter

type ModuleFilter interface {
	Start(mod Module)
	Name() string
	Description() string
	Author() string
	WorkWith(name string) bool
}

type ModuleInformation

type ModuleInformation struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Author      string   `json:"author"`
	Type        []string `json:"type"`
	Parameters  []Param  `json:"parameters"`
}

type Monitor

type Monitor struct {
	Session   *Session      `json:"-"`
	MonitorId string        `json:"monitor_id"`
	Search    []string      `json:"search"`
	Strict    bool          `json:"strict"`
	Status    bool          `json:"status"`
	Result    []*OpfResults `json:"-"`
	CreatedAt time.Time     `json:"created_at"`
	UpdatedAt time.Time     `json:"updated_at"`
}

func (*Monitor) Checking

func (m *Monitor) Checking()

func (*Monitor) Down

func (m *Monitor) Down()

func (*Monitor) HasResult

func (m *Monitor) HasResult(resultId string) bool

func (*Monitor) SetId

func (m *Monitor) SetId() *Monitor

func (*Monitor) SetSession

func (m *Monitor) SetSession(s *Session)

func (*Monitor) Up

func (m *Monitor) Up()

func (*Monitor) ViewResults

func (m *Monitor) ViewResults()

type MonitorMatch

type MonitorMatch struct {
	Monitor *Monitor    `json:"monitor"`
	Result  *OpfResults `json:"result"`
}

type Monitors

type Monitors []*Monitor

type Note

type Note struct {
	Id   string `json:"id"`
	Text string `json:"text"`
}

type Notification

type Notification struct {
	Id        string `json:"id"`
	Text      string `json:"text"`
	IsRead    bool   `json:"as_read"`
	CreatedAt time.Time
}

func (*Notification) Read

func (n *Notification) Read()

Set notification with read status

type OpfClient

type OpfClient struct {
	Client  http.Client
	Header  Headers
	Data    []byte
	WithTor bool
}

func GetOpfClient

func GetOpfClient() OpfClient

func (*OpfClient) Perform

func (c *OpfClient) Perform(method string, uri string) (*http.Response, error)

func (*OpfClient) Read

func (c *OpfClient) Read(r io.ReadCloser) ([]byte, error)

func (*OpfClient) SetData

func (c *OpfClient) SetData(data interface{}) (*OpfClient, error)

func (*OpfClient) SetUserAgent

func (c *OpfClient) SetUserAgent(user string) *OpfClient

type OpfResultValue

type OpfResultValue struct {
	Key       string    `json:"key"`
	Value     string    `json:"value"`
	Notes     []Note    `json:"notes"`
	CreatedAt time.Time `json:"created_at"`
}

Struct of module result value

type OpfResults

type OpfResults struct {
	Id         int              `json:"-" gorm:"primary_key:yes;column:id;AUTO_INCREMENT"`
	SessionId  int              `json:"-" gorm:"session_id"`
	ModuleName string           `json:"module_name"`
	ResultId   string           `json:"result_id" gorm:"primary_key:yes;column:result_id"`
	TargetId   string           `json:"target_id" gorm:"target_id"`
	Values     []OpfResultValue `json:"values"`
	ToJSON     json.RawMessage  `json:"to_json"`
	Notes      []Note
	Auxiliary  []string  `json:"-" sql:"-"`
	CreatedAt  time.Time `json:"created_at"`
}

Struct of module result

func (*OpfResults) AddNoteToResult

func (result *OpfResults) AddNoteToResult(text string)

func (*OpfResults) Bytes

func (r *OpfResults) Bytes() ([]byte, error)

func (*OpfResults) GetCompactKeys

func (r *OpfResults) GetCompactKeys() string

Compact keys with separator

func (*OpfResults) GetCompactValues

func (r *OpfResults) GetCompactValues() string

Compact values with separator

func (*OpfResults) GetKeys

func (r *OpfResults) GetKeys() []string

Get result keys

func (*OpfResults) JSON

func (r *OpfResults) JSON() json.RawMessage

func (*OpfResults) Save

func (r *OpfResults) Save(module Module, target *Target) bool

func (*OpfResults) Set

func (r *OpfResults) Set(key string, value string)

type Param

type Param struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Value       string `json:"value"`
	IsRequired  bool   `json:"is_required"`
	ParamType   int    `json:"param_type"`
}

type Position

type Position struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Session

type Session struct {
	SessionName string      `json:"session_name"`
	Information Information `json:"information"`
	Connection  Connection  `json:"-" sql:"-"`
	Client      OpfClient   `json:"-"`
	Tracker     struct {
		Position []Position   `json:"position"`
		Selected *Tracking    `json:"selected"`
		Tracked  []*Tracking  `json:"tracked"`
		Server   *http.Server `json:"-"`
	} `json:"tracker"`
	Instances       []*Instance       `json:"instances"`
	CurrentInstance *Instance         `json:"current_instance"`
	Events          Events            `json:"events"`
	SourceFile      string            `json:"source_file"`
	Config          config.Config     `json:"config" sql:"-"`
	Version         string            `json:"version" sql:"-"`
	Targets         []*Target         `json:"targets" sql:"-"`
	Modules         []Module          `json:"modules" sql:"-"`
	Monitors        Monitors          `json:"monitors"`
	Filters         []ModuleFilter    `json:"filters" sql:"-"`
	Prompt          *readline.Config  `json:"-" sql:"-"`
	Stream          Stream            `json:"-" sql:"-"`
	TypeLists       []string          `json:"type_lists" sql:"-"`
	ServiceFolder   string            `json:"home_folder"`
	Services        []Listener        `json:"services"`
	Alias           map[string]string `json:"-" sql:"-"`
	Users           []*User           `json:"users"`
	Interval        []*Interval       `json:"interval"`
	WebHooks        []*WebHook        `json:"web_hooks"`
	Notifications   []*Notification   `json:"notifications"`
}

func (*Session) AddAlias

func (s *Session) AddAlias(alias string, module string)

func (*Session) AddOrFirstTracker

func (s *Session) AddOrFirstTracker(t Tracking) Tracking

func (*Session) AddService

func (s *Session) AddService(service Listener)

func (*Session) AddTag

func (s *Session) AddTag(target *Target, tag string) (bool, error)

func (*Session) AddTarget

func (s *Session) AddTarget(t string, name string) (string, error)

func (*Session) AddTracker

func (s *Session) AddTracker(tracker Tracking) Tracking

func (*Session) AutoStartWebHook

func (s *Session) AutoStartWebHook()

func (*Session) AutoStopWebHook

func (s *Session) AutoStopWebHook()

func (*Session) BooleanToString

func (s *Session) BooleanToString(element bool) string

func (*Session) CheckTypeExist

func (s *Session) CheckTypeExist(t string) bool

func (*Session) ClearScreen

func (s *Session) ClearScreen()

func (*Session) CountUnReadNotifications

func (s *Session) CountUnReadNotifications() int

Count unread session notification

func (*Session) CreateCacheInstances

func (s *Session) CreateCacheInstances(base string) error

func (*Session) CreateCacheIntervals

func (s *Session) CreateCacheIntervals(base string) error

func (*Session) CreateCacheMonitors

func (s *Session) CreateCacheMonitors(base string) error

func (*Session) CreateCacheSession

func (s *Session) CreateCacheSession(base string) error

func (*Session) CreateCacheTargets

func (s *Session) CreateCacheTargets(base string) error

func (*Session) CreateCacheWebhooks

func (s *Session) CreateCacheWebhooks(base string) error

func (*Session) DeleteEvent

func (s *Session) DeleteEvent(id string)

func (*Session) DeleteMonitor

func (s *Session) DeleteMonitor(monitorId string)

func (*Session) DeleteResult

func (s *Session) DeleteResult(id string)

func (*Session) ExportNow

func (s *Session) ExportNow() SessionExport

func (*Session) FindLinked

func (s *Session) FindLinked(m string, res OpfResults) ([]string, error)

func (*Session) FindLinkedTargetByResult

func (s *Session) FindLinkedTargetByResult(t *Target)

func (*Session) FromSourceFile

func (s *Session) FromSourceFile() error

func (*Session) GetAlias

func (s *Session) GetAlias(alias string) (string, error)

func (*Session) GetCurrentInstance

func (s *Session) GetCurrentInstance() *Instance

Get current session module execution instance

func (*Session) GetEvent

func (s *Session) GetEvent(id string) (*Event, error)

func (*Session) GetEvents

func (s *Session) GetEvents() Events

func (*Session) GetInterval

func (s *Session) GetInterval(id string) (*Interval, error)

func (*Session) GetLastTracker

func (s *Session) GetLastTracker() (*Tracking, error)

func (*Session) GetMonitor

func (s *Session) GetMonitor(monitorId string) (*Monitor, error)

func (*Session) GetMonitors

func (s *Session) GetMonitors() Monitors

func (*Session) GetName

func (s *Session) GetName() string

func (*Session) GetNotification

func (s *Session) GetNotification(id string) (*Notification, error)

Get a notification

func (*Session) GetResult

func (s *Session) GetResult(id string) (*OpfResults, error)

func (*Session) GetResultsAfter

func (s *Session) GetResultsAfter(results []*OpfResults, afterTime time.Time) []*OpfResults

func (*Session) GetResultsBefore

func (s *Session) GetResultsBefore(results []*OpfResults, beforeTime time.Time) []*OpfResults

func (*Session) GetSeparator

func (s *Session) GetSeparator() string

func (*Session) GetTarget

func (s *Session) GetTarget(id string) (*Target, error)

func (*Session) GetTargetByName

func (s *Session) GetTargetByName(name string) (*Target, error)

func (*Session) GetTracker

func (s *Session) GetTracker(trackerId string) (*Tracking, error)

func (*Session) GetTrackerBestMover

func (s *Session) GetTrackerBestMover() *Tracking

func (*Session) GetTrackerRouter

func (s *Session) GetTrackerRouter() *mux.Router

func (*Session) GetTrackingUrlWithParam

func (s *Session) GetTrackingUrlWithParam() string

func (*Session) GetUser

func (s *Session) GetUser(username string) (*User, error)

func (*Session) GetWebHook

func (s *Session) GetWebHook(id string) (*WebHook, error)

func (*Session) GetWebHookByName

func (s *Session) GetWebHookByName(name string) (*WebHook, error)

func (*Session) HasWatcher

func (s *Session) HasWatcher(t string) bool

Checking if watcher as been set in session

func (*Session) ImportFromCsv

func (s *Session) ImportFromCsv(fileName string, delimiter string, primary int, verbose bool, linking []int)

Import data from CSV file

func (*Session) IntegerToString

func (s *Session) IntegerToString(element int) string

func (*Session) IsJSON

func (s *Session) IsJSON(str string) bool

func (*Session) ListAlias

func (s *Session) ListAlias()

func (*Session) ListModules

func (s *Session) ListModules()

func (*Session) ListTargets

func (s *Session) ListTargets()

func (*Session) ListType

func (s *Session) ListType() []string

func (*Session) ListWebHooks

func (s *Session) ListWebHooks()

func (*Session) LoadCache

func (s *Session) LoadCache(name string)

Load session file cache to current session

func (*Session) LoadIntervalFromSourceFile

func (s *Session) LoadIntervalFromSourceFile() error

func (*Session) LoadModuleConfiguration

func (s *Session) LoadModuleConfiguration(module string) (map[string]string, error)

func (*Session) LoadWebHook

func (s *Session) LoadWebHook()

func (*Session) NewEvent

func (s *Session) NewEvent(t string, value interface{}) *Event

func (*Session) NewInstance

func (s *Session) NewInstance(module string) *Instance

Create a new module execution instance

func (*Session) NewInterval

func (s *Session) NewInterval(command string) *Interval

func (*Session) NewMonitor

func (s *Session) NewMonitor(scope string) *Monitor

func (*Session) NewNotification

func (s *Session) NewNotification(text string) *Notification

Create a new notification

func (*Session) NewUser

func (s *Session) NewUser(username string, password string) (*User, error)

func (*Session) ParseCommand

func (s *Session) ParseCommand(line string) []string

func (*Session) ParseCommands

func (s *Session) ParseCommands(str string)

func (*Session) ParseModuleConfig

func (s *Session) ParseModuleConfig()

func (*Session) PushPrompt

func (s *Session) PushPrompt()

func (*Session) PushType

func (s *Session) PushType(t string)

func (*Session) PutWebHook

func (s *Session) PutWebHook(wh WebHook)

func (*Session) ReadLineAutoCompleteCacheName

func (s *Session) ReadLineAutoCompleteCacheName() func(string) []string

func (*Session) ReadLineAutoCompleteFilters

func (s *Session) ReadLineAutoCompleteFilters() func(string) []string

func (*Session) ReadLineAutoCompleteInterval

func (s *Session) ReadLineAutoCompleteInterval() func(string) []string

func (*Session) ReadLineAutoCompleteListAlias

func (s *Session) ReadLineAutoCompleteListAlias() func(string) []string

func (*Session) ReadLineAutoCompleteListModules

func (s *Session) ReadLineAutoCompleteListModules() func(string) []string

func (*Session) ReadLineAutoCompleteListWebHooks

func (s *Session) ReadLineAutoCompleteListWebHooks() func(string) []string

func (*Session) ReadLineAutoCompleteModuleResults

func (s *Session) ReadLineAutoCompleteModuleResults() func(string) []string

func (*Session) ReadLineAutoCompleteMonitor

func (s *Session) ReadLineAutoCompleteMonitor() func(string) []string

func (*Session) ReadLineAutoCompleteNotification

func (s *Session) ReadLineAutoCompleteNotification() func(string) []string

func (*Session) ReadLineAutoCompleteResults

func (s *Session) ReadLineAutoCompleteResults() func(string) []string

func (*Session) ReadLineAutoCompleteTargets

func (s *Session) ReadLineAutoCompleteTargets() func(string) []string

func (*Session) ReadLineAutoCompleteTracker

func (s *Session) ReadLineAutoCompleteTracker() func(string) []string

func (*Session) ReadLineAutoCompleteType

func (s *Session) ReadLineAutoCompleteType() func(string) []string

func (*Session) RemoveTarget

func (s *Session) RemoveTarget(id string) (bool, error)

func (*Session) ResetPosition

func (s *Session) ResetPosition()

func (*Session) SearchFilter

func (s *Session) SearchFilter(name string) (ModuleFilter, error)

func (*Session) SearchModule

func (s *Session) SearchModule(name string) (Module, error)

func (*Session) SendToWebHook

func (s *Session) SendToWebHook(w *WebHook, event *Event) error

func (*Session) ServeTrackerGUI

func (s *Session) ServeTrackerGUI()

func (*Session) SetInstance

func (s *Session) SetInstance(i *Instance) *Session

Set module execution instance to current

func (*Session) SetPosition

func (s *Session) SetPosition(position Position)

func (*Session) SetPositionFromTracker

func (s *Session) SetPositionFromTracker(tracker *Tracking)

func (*Session) SetSourceFile

func (s *Session) SetSourceFile(file string)

func (*Session) StringToBoolean

func (s *Session) StringToBoolean(element string) bool

func (*Session) StringToInt64

func (s *Session) StringToInt64(element string) int64

func (*Session) StringToInteger

func (s *Session) StringToInteger(element string) int

func (*Session) ToCache

func (s *Session) ToCache(name string)

Store current session in cache

func (*Session) UpdatePrompt

func (s *Session) UpdatePrompt()

Update a prompt

func (*Session) UpdateTarget

func (s *Session) UpdateTarget(id string, value string)

func (*Session) WaitInterval

func (s *Session) WaitInterval()

func (*Session) WaitMonitor

func (s *Session) WaitMonitor()

func (*Session) WithFilter

func (s *Session) WithFilter(module Module) bool

type SessionExport

type SessionExport struct {
	Id            int            `json:"-"`
	SessionName   string         `json:"session_name"`
	Information   Information    `json:"information"`
	Config        config.Config  `json:"config" sql:"-"`
	Version       string         `json:"version" sql:"-"`
	Targets       []*Target      `json:"subjects" sql:"-"`
	Modules       []Module       `json:"modules" sql:"-"`
	Filters       []ModuleFilter `json:"filters" sql:"-"`
	Stream        Stream         `json:"-" sql:"-"`
	TypeLists     []string       `json:"type_lists" sql:"-"`
	ServiceFolder string         `json:"home_folder"`
	Services      []Listener     `json:"services"`
}

type SessionFilter

type SessionFilter struct {
	ModuleFilter
	With []string
}

func (*SessionFilter) AddModule

func (filter *SessionFilter) AddModule(name string)

func (*SessionFilter) WorkWith

func (filter *SessionFilter) WorkWith(name string) bool

type SessionModule

type SessionModule struct {
	Module
	Export     []OpfResults
	Parameters []Param  `json:"parameters"`
	History    []string `json:"history"`
	External   []string `json:"external"`
	Results    []string
}

func (*SessionModule) CheckRequired

func (module *SessionModule) CheckRequired() bool

func (*SessionModule) CreateNewParam

func (module *SessionModule) CreateNewParam(name string, description string, value string, isRequired bool, paramType int)

func (*SessionModule) GetAllParameters

func (module *SessionModule) GetAllParameters() []Param

func (*SessionModule) GetExport

func (module *SessionModule) GetExport() []OpfResults

func (*SessionModule) GetExternal

func (module *SessionModule) GetExternal() []string

func (*SessionModule) GetParameter

func (module *SessionModule) GetParameter(name string) (Param, error)

func (*SessionModule) GetResults

func (module *SessionModule) GetResults() []string

func (*SessionModule) ListArguments

func (module *SessionModule) ListArguments()

func (*SessionModule) SetExport

func (module *SessionModule) SetExport(result OpfResults)

func (*SessionModule) SetParameter

func (module *SessionModule) SetParameter(name string, value string) (bool, error)

func (*SessionModule) WithProgram

func (module *SessionModule) WithProgram(name string) bool

type Source

type Source struct {
	Type    string      `json:"type"`
	Content interface{} `json:"content"`
}

type Stream

type Stream struct {
	Sess    *Session          `json:"-"`
	Verbose bool              `json:"verbose"`
	CSV     bool              `json:"csv"`
	History map[string]string `json:"history"`
}

func (*Stream) Backgound

func (stream *Stream) Backgound(text string)

func (*Stream) Error

func (stream *Stream) Error(text string)

func (*Stream) GenerateTable

func (stream *Stream) GenerateTable() table.Writer

func (*Stream) Render

func (stream *Stream) Render(t table.Writer)

func (*Stream) Standard

func (stream *Stream) Standard(text string)

func (*Stream) Success

func (stream *Stream) Success(text string)

func (*Stream) Warning

func (stream *Stream) Warning(text string)

func (*Stream) WithoutDate

func (stream *Stream) WithoutDate(text string)

type Tags

type Tags struct {
	TagId string `json:"-"`
	Text  string `json:"text"`
}

type Target

type Target struct {
	Id           int                      `json:"-" gorm:"primary_key:yes;column:id;AUTO_INCREMENT"`
	SessionId    int                      `json:"-" gorm:"column:session_id"`
	TargetId     string                   `json:"id" gorm:"column:target_id"`
	Sess         *Session                 `json:"-" gorm:"-"`
	Name         string                   `json:"name" gorm:"column:target_name"`
	Type         string                   `json:"type" gorm:"column:target_type"`
	Results      map[string][]*OpfResults `sql:"-" json:"results"`
	TargetLinked []Linking                `json:"target_linked" sql:"-"`
	Notes        []Note                   `json:"notes" sql:"-"`
	Tags         []Tags                   `json:"tags"  sql:"-"`
}

func (*Target) AddNote

func (target *Target) AddNote(text string)

func (*Target) CheckType

func (target *Target) CheckType() bool

func (*Target) GetFormatedResults

func (target *Target) GetFormatedResults(module string) ([]map[string]string, error)

func (*Target) GetId

func (target *Target) GetId() string

func (*Target) GetLastResults

func (target *Target) GetLastResults(module string)

func (*Target) GetLinked

func (target *Target) GetLinked() []Linking

func (*Target) GetModuleResults

func (target *Target) GetModuleResults(name string) ([]*OpfResults, error)

func (*Target) GetName

func (target *Target) GetName() string

func (*Target) GetResult

func (target *Target) GetResult(id string) (*OpfResults, error)

func (*Target) GetResults

func (target *Target) GetResults() map[string][]*OpfResults

func (*Target) GetSeparator

func (target *Target) GetSeparator() string

func (*Target) GetTags

func (target *Target) GetTags() []Tags

func (*Target) GetType

func (target *Target) GetType() string

func (*Target) HasTag

func (target *Target) HasTag(tag string) bool

func (*Target) Is

func (target *Target) Is(t string) bool
func (target *Target) Link(target2 Linking)

func (*Target) Linked

func (target *Target) Linked()

func (*Target) NewResult

func (target *Target) NewResult() *OpfResults

func (*Target) PushLinked

func (target *Target) PushLinked(t Linking)

func (*Target) ResultExist

func (target *Target) ResultExist(result OpfResults) bool

func (*Target) Save

func (target *Target) Save(module Module, result OpfResults) bool

type Tracking

type Tracking struct {
	Id          string             `json:"id"`
	Session     *Session           `json:"-"`
	Position    TrackingPosition   `json:"position"`
	Identifier  string             `json:"identifier"`
	Description string             `json:"description"`
	Picture     string             `json:"picture"`
	Memories    []TrackingPosition `json:"memories"`
	IsHistory   bool               `json:"is_history"`
	Time        time.Time          `json:"time"`
}

func CreateTrackerFromValue

func CreateTrackerFromValue(s *Session, lat string, lng string, id string, description string) *Tracking

func (*Tracking) GetDescription

func (t *Tracking) GetDescription() string

func (*Tracking) GetHistories

func (t *Tracking) GetHistories() []*Tracking

func (*Tracking) GetIdentifier

func (t *Tracking) GetIdentifier() string

func (*Tracking) GetLatitude

func (t *Tracking) GetLatitude() string

func (*Tracking) GetLongitude

func (t *Tracking) GetLongitude() string

func (*Tracking) GetMemories

func (t *Tracking) GetMemories() []TrackingPosition

func (*Tracking) GetTime

func (t *Tracking) GetTime() time.Time

func (*Tracking) Synchronize

func (t *Tracking) Synchronize()

func (*Tracking) ViewPositions

func (t *Tracking) ViewPositions()

type TrackingPosition

type TrackingPosition struct {
	Latitude  string    `json:"latitude"`
	Longitude string    `json:"longitude"`
	Bounds    Bounds    `json:"bounds"`
	Time      time.Time `json:"time"`
}

func (*TrackingPosition) ToBounds

func (tp *TrackingPosition) ToBounds(m float64)

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Key      string `json:"api_key"`
}

type WebHook

type WebHook struct {
	Id     string   `json:"id"`
	Name   string   `json:"name"`
	Events []string `json:"events"`
	URL    string   `json:"url"`
	Method string   `json:"method"`
	Status bool     `json:"status"`
}

func (*WebHook) Down

func (w *WebHook) Down()

func (*WebHook) GetEvents

func (w *WebHook) GetEvents() string

func (*WebHook) GetId

func (w *WebHook) GetId() string

func (*WebHook) GetMethod

func (w *WebHook) GetMethod() string

func (*WebHook) GetName

func (w *WebHook) GetName() string

func (*WebHook) GetStatus

func (w *WebHook) GetStatus() bool

func (*WebHook) GetURL

func (w *WebHook) GetURL() string

func (*WebHook) SetStatus

func (w *WebHook) SetStatus(s bool) *WebHook

func (*WebHook) Up

func (w *WebHook) Up()

Jump to

Keyboard shortcuts

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