DiscoNet package¶
DiscoNet scans specified subnets and IPs for SSH servers that can be accessed with the provided credentials and executes an arbitrary list of commands.
The process of scanning networks and collecting command output is built on a multiprocess architecture, so DiscoNet can rapidly scan through management and loopback subnets, populating an xlsx workbook with the output.
- The GUI and command line application take several input parameters:
- workbook: Path to output xlsx file
- subnets: Comma delimited list of networks and IP addresses to scan
- username: SSH username
- password: SSH password
- commands: One per line in the GUI or passed as parameters from the command line
- Examples:
To open the GUI application:
$ python -m DiscoNet
To scan and create a discovery workbook from the command line:
$ python -m DiscoNet.discoveryscan workbook subnets username password commands
A convenience script is included so that the GUI and command line utility can each be run using the following commands accordingly:
$ DiscoNet $ discoveryscan workbook subnets username password commands ...
Use double quotes for each command and include as many as required, e.g.:
$ discoveryscan out.xlsx 172.16.0.0/24 admin password "show ver" "show run"
To use as a module in your own application:
from DiscoNet.discoveryscan import DiscoveryScan d = DiscoveryScan(workbook, subnets, username, password, commands) d.start()
The commands parameter should be an array of command strings to run. The start method will block until the scan is complete. Optionally, the start method can be non-blocking when supplied with a callback function:
from DiscoNet.discoveryscan import DiscoveryScan def cb() #callback function return d = DiscoveryScan(workbook, subnets, username, password, commands) d.start(cb)
Submodules¶
DiscoNet.discoveryscan module¶
discoveryscan module
-
class
DiscoNet.discoveryscan.DiscoveryScan(workbook, subnets, username, password, commands)[source]¶ Bases:
objectReturn
DiscoveryScanParameters: - workbook (str) – path to output xlsx file
- subnets (str) – comma delimited list of networks and IP addresses to scan
- username (str) – SSH username
- password (str) – SSH password
- commands (str) – string listing commands to run, one per line
Returns: an initialized DiscoveryScan object
Return type: -
start(cb=None)[source]¶ Start Discovery
Starts the discovery process and blocks until complete. Optionally, a callback can be specified to make this process non-blocking and the callback will be called when complete.
Parameters: cb (function) – callback method. Defaults to None. Returns: nothing Return type: None