Package Halberd :: Module crew |
[show private | hide private]
[frames | no frames]

## Module Halberd.crew

# Work crew pattern of parallel scanners

## Overview

A work crew is instantiated passing a ScanTask object as a parameter, thus defining the target and the way the scanning should be done. After the initialization of the work crew it can be used to scan the target and get the obtained clues back.

    >>> crew = WorkCrew(scantask)
    >>> clues = crew.scan()

## Requirements

These are the features that the WorkCrew must provide:

1. There are 3 different types of consumers:
   - Controller thread (Performs timing + error-checking).
   - Local scanning thread.
   - Remote scanning thread.
2. We need a way to signal:
   - When a fatal error has happened.
   - When the user has pressed Control-C

## Types of scanning threads

The WorkCrew object spawns different kinds of threads. Here's a brief summary of what they do:

- Manager: Detects when the time for performing the scan has expired and notifies the rest of the threads. This code is executed in the main thread in order to be able to appropriately catch signals, etc.
- Scanner: Performs a load-balancer scan from the current machine.

The following is a diagram showing the way it works:

                                        .--> Manager --.
                                        |              |
                                        +--> Scanner --+
           .----------.   .----------.  |              |   .-------.
    IN --> | ScanTask |->-| WorkCrew |--+--> Scanner --+->-| Clues |--> OUT
           `----------'   `----------'  |              |   `-------'
                                        +--> Scanner --+
                                        |              |
                                        `--> Scanner --'

Classes
`WorkCrew` | Pool of scanners working in parallel.

Generated by Epydoc 2.1 on Wed Jul 18 22:25:57 2007 | http://epydoc.sf.net