Event Listeners: package fuzzinator.listener

class fuzzinator.listener.EmailListener(config, event, param_name, from_address, to_address, smtp_host, smtp_port, smtp_timeout=5)

EventListener subclass that can be used to send e-mail notification about various events.

Parameters:
  • config – ConfigParser object containing information about the fuzz session.

  • event – The name of the event to send notification about.

  • param_name – The name of the event’s parameter containing the information to send.

  • from_address – E-mail address to send notifications from.

  • to_address – Target e-mail address to send the notification to.

  • smtp_host – Host of the smtp server to send e-mails from.

  • smtp_port – Port of the smtp server to send e-mails from.

  • smtp_timeout – Timeout in seconds for blocking SMTP operations like the connection attempt. (Optional, default: 5)

send_mail(data)

Send e-mail with the provided data.

Parameters:

data – Information to fill subject and content fields with.

class fuzzinator.listener.EventListener(config)

A no-op base class for listeners that can get notified by fuzzinator.Controller on various events of a fuzz sessions.

Note

Subclasses should be aware that some notification methods may be called from subprocesses.

Parameters:

config (configparser.ConfigParser) – Fuzzinator settings.

on_fuzz_job_added(job_id, cost, sut, fuzzer, batch)

Invoked when a new (still inactive) fuzz job is instantiated.

Parameters:
  • job_id (int) – a unique identifier of the new fuzz job.

  • cost (int) – cost associated with the new fuzz job.

  • sut (str) – short name of the SUT of the new fuzz job (name of the corresponding config section without the “sut.” prefix).

  • fuzzer (str) – short name of the new fuzz job (name of the corresponding config section without the “fuzz.” prefix).

  • batch (int, float) – batch size of the new fuzz job, i.e., number of test cases requested from the fuzzer (may be inf).

on_issue_added(job_id, issue)

Invoked when a new issue is found.

Parameters:
  • job_id (int) – identifier of the job that has found the issue.

  • issue (dict) – the issue that was found (all relevant information - e.g., the SUT that reported the issue, the test case that triggered the issue, the fuzzer that generated the test case, the ID of the issue - is stored in appropriate properties of the issue).

on_issue_invalidated(job_id, issue)

Invoked when an issue seems invalid.

Parameters:
  • job_id (int) – identifier of the job that has invalidated the issue.

  • issue (dict) – the issue object that did not pass re-validation (listener is free to decide how to react, an option is to remove the issue from the database).

on_issue_reduced(job_id, issue)

Invoked when an issue got reduced.

Parameters:
  • job_id (int) – identifier of the job that has reduced the issue.

  • issue (dict) – the issue object that got reduced.

on_issue_updated(job_id, issue)

Invoked when the status of an issue changed.

Parameters:
  • job_id (int) – identifier of the job that has updated the issue.

  • issue (dict) – the issue object that has changed.

on_job_activated(job_id)

Invoked when a previously instantiated job is activated (started).

Parameters:

job_id (int) – unique identifier of the activated job.

on_job_progressed(job_id, progress)

Invoked when an activated job makes progress.

Parameters:
  • job_id (int) – unique identifier of the progressing job.

  • progress (int) – for fuzz jobs, this is the number of already generated tests (number between 0 and the job’s batch size); for reduce jobs, this is the current size of the test case being reduced (number between the original test size and 0).

on_job_removed(job_id)

Invoked when an active job has finished.

Parameters:

job_id (int) – unique identifier of the finished job.

on_load_updated(load)

Invoked when the framework’s load changes.

Parameters:

load (int) – number between 0 and controller’s capacity.

on_reduce_job_added(job_id, cost, sut, issue_oid, issue_id, size)

Invoked when a new (still inactive) reduce job is instantiated.

Parameters:
  • job_id (int) – a unique identifier of the new reduce job.

  • cost (int) – cost associated with the new reduce job.

  • sut (str) – short name of the SUT used in the new reduce job (name of the corresponding config section without the “sut.” prefix).

  • issue_oid (str) – '_id' property of the issue to be reduced.

  • issue_id (Any) – 'id' property of the issue to be reduced.

  • size (int) – size of the test case associated with the issue to be reduced.

on_stats_updated()

Invoked when statistics about fuzzers, SUTs, and issues (e.g., execution counts, issue counts, unique issue counts) are updated in the framework’s database.

on_update_job_added(job_id, cost, sut)

Invoked when a new (still inactive) update job is instantiated.

Parameters:
  • job_id (int) – a unique identifier of the new update job.

  • cost (int) – cost associated with the new update job.

  • sut (str) – short name of the SUT to be updated (name of the corresponding config section without the “sut.” prefix).

on_validate_job_added(job_id, cost, sut, issue_oid, issue_id)

Invoked when a new (still inactive) validate job is instantiated.

Parameters:
  • job_id (int) – a unique identifier of the new validate job.

  • cost (int) – cost associated with the new validate job.

  • sut (str) – short name of the SUT used in the new validate job (name of the corresponding config section without the “sut.” prefix).

  • issue_oid (str) – '_id' property of the issue to be validated.

  • issue_id (Any) – 'id' property of the issue to be validated.

warning(job_id, msg)

Invoked on unexpected events.

Parameters:
  • job_id (int) – identifier of the job that has signalled the warning (may be None if the warning was not signalled by a job but by the core).

  • msg (str) – description of the problem.

class fuzzinator.listener.ListenerManager(listeners=None)

Class that registers listeners to various events and executes all of them when the event has triggered.

Parameters:

listeners – List of listener objects.

add(listener)

Register a new listener in the manager.

Parameters:

listener – The new listener to register.