You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aliasgar Khimani edited this page Dec 30, 2021
·
4 revisions
Here's an example program making use of the puffgo package:
package main
import (
"fmt""time""github.com/ARaChn3/puffgo"
)
funcmain() {
// interval is the interval between listening cycles of the event listenerinterval:=500*time.Millisecond// First we need to declare an event-listener for the logic-bomb:// We can do so using the NewListener() methodel:=puffgo.NewListener(&interval, triggerFunction)
// We can now create the logic-bomb using the NewBomb method:lb:=puffgo.NewBomb(*el, executionFunction)
// Next, we need to arm the bomb for it to go off when it detects// a signal from the event-listenerlb.Arm()
}
// This can be anything.// For the sake of simplicity, let it be a simple function that returns truefunctriggerFunction() bool {
returntrue
}
// This is the function which is callled when the bomb goes off.// For this example, we'll just make it print somethingfuncexecutionFunction() {
fmt.Println("BOOOOM!!")
}
You may change executionFunction as needed. The same goes for triggerFunction.
What's the result? It's a logic bomb that can be programmed to detect and execute virtually anything upon being triggered.