Network Dependencies Discovery Tool
This tool automates the discovery of network dependencies between hosts within specified subnets. It leverages netstat output parsed from each host to identify and log connections, categorizing them as either incoming or outgoing. The tool supports Linux and BSD systems and requires SSH access to remote hosts.
- Python 3.x: Ensure Python 3 is installed on the system where the script will be executed.
- External Libraries: Required Python libraries are listed in requirements.txt. Install them using pip install -r requirements.txt.
- SSH Access: The script requires SSH access to remote hosts. Ensure SSH keys are set up or passwords are available.
- SQLite Database: The script uses an SQLite database to store discovered connections.
After processing, the script generates a Mermaid diagram representing network connections, outputting to diagram_%date%.md. This diagram visualizes hosts, connections, and involved ports.
- Clone the Repository: Clone or download the script files to your local system.
- Install Dependencies: Install the required Python libraries with pip install -r requirements.txt.
- Configure SSH Access: Ensure SSH keys are configured for Linux hosts and passwords are available for Windows hosts.
- Database Initialization: The script automatically sets up the SQLite database on the first run.
Create a config.yaml file in the same directory as the script with the following structure:
database:
path: "network_dependencies.db"
network_scan:
subnets:
- "192.168.1.0/24"
- "10.0.0.0/24"
credentials:
linux:
ssh_key_path: "/path/to/ssh/key"
windows:
username: "admin"
password: "password"
- Linux Hosts: Store SSH private keys at the location specified in config.yaml, or using a known_hosts_credentials.txt file configured as ip_address:username:password per line
- Windows Hosts: using winRM - TBD.
Run the script with Python, optionally specifying a subnet to scan:
python network_oracle.py [subnet]
If no subnet is provided, the script scans the subnets listed in config.yaml.