Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventListener ¶
type EventListener struct { // TriggerChannel is to detect if the event has occured. // When it does, a boolean true is passed into it. TriggerChannel chan bool // [Interval] specifies the delay between each check of for the event. Interval *time.Duration // [TriggerFunction] specifies the function which will be // used to check when the event has occured. // // The function will return a boolean, and will be executed // on intervals of [Interval] (type: *time.Duration). // If Interval is nil, it performs checks every 500ms. // // When the event occurs, true is passed into [TriggerChannel], // which can be used as a detection mechanism. TriggerFunction func() bool // [TerminationChannel] acts as stopping mechanism for the mainloop. // If a boolean true is passed into it, the mainloop is terminated. TerminationChannel chan bool // PID specifies the process-id of the persistent mainloop. // It holds nil until the mainloop of the event-listner is started. PID *int }
EventListener implements an event-listener that performs checks for occuerence of an event in the system. The said checks are preformed on the basis of the TriggerFunction field. Check the docs for more info.
func NewListener ¶
func NewListener(interval *time.Duration, tfunc func() bool) *EventListener
NewListener creates a new instance of EventListener and returns a pointer to it.
func (*EventListener) GetPID ¶
func (e *EventListener) GetPID() int
GetPID returns the PID for the EventListener's process.
func (*EventListener) Mainloop ¶
func (e *EventListener) Mainloop()
Mainloop starts an infinite loop which checks for the event's occurence until terminated.
func (*EventListener) Terminate ¶
func (e *EventListener) Terminate()
Terminate terminates the mainloop checking for the event.
type LogicBomb ¶
type LogicBomb struct { // Listener represents an event-listner defined in this library. Listener *EventListener // ExecutionFunction specifies the function // which will be executed when the bomb is triggered and it goes off ExecutionFunction func() // BombId specifies a random hex string used to identify the bomb. BombID string // PID specifies the process-id of the persistent logic-bomb program running. // It holds nil until the mainloop of the event-listner is started. PID *int }
LogicBomb: type implementing a logic-bomb for UNIX/Linux based systems.
func NewBomb ¶
func NewBomb(listener EventListener, execFunc func()) *LogicBomb
NewBomb returns an instance of LogicBomb, which can be implanted by Implant(), to be triggered when conditions for it to do so are met.