Skip to content

Documentation

Aliasgar Khimani edited this page Nov 13, 2021 · 1 revision

Overview

Package gfb implements a logical-fork-bomb so it can be used and customized as needed.

The package implements the type: ForkBomb defined in ForkBomb.go. The type defines several methods to control the function of the logic bomb.

NOTE: This package also makes use of puffgo's EventListener type. For more info, visit the puffgo project wiki.

The definition of the types in the package, and the respective functions can be found below.

Index

Overview
type ForkBomb
func Newbomb(listener *puffgo.EventListener) *ForkBomb
func (fb *forkBomb) Arm()
func (fb *forkBomb) Disarm()

type ForkBomb

type ForkBomb struct {

	// Listener specifies the EventListener for the bomb.
	// If Listener is nil, the ForkBomb will go off as soon
	// as the program/binary is executed.
	//
	// To create an event-listener, use the NewListener function
	// present in the puffgo project.
	// For more details, visit the puffgo wiki.
	Listener *puffgo.EventListener
}

ForkBomb is a type implementing a logical-fork-bomb.

It makes use of concurrent processes via puffgo.EventListener to detect the occurrence of an event that triggers the bomb. When the bomb is triggered, the forking process of the bomb begins.

func NewBomb(listener *EventListener) *ForkBomb

func NewBomb(listener EventListener) *ForkBomb

NewBomb() returns a pointer of type: *ForkBomb. It takes in the following arguments:

Specifies the event-listener for the fork-bomb to listen for the triggering event. If listener is nil, the fork-bomb will go off as soon as the binary/program is executed. NOTE: For the fork-bomb to go off, it needs to be armed, this can be done using Arm

func (fb *ForkBomb) Arm()

func (fb *ForkBomb) Arm()

Arm() allows the activation of the bomb. If a bomb is not armed, it won't be triggered even if the event defined in Listener occurs.

func (fb *ForkBomb) Disarm()

func (fb *ForkBomb) Disarm()

Disarm() allows the deactivation of the bomb.