{"id":45758988,"url":"https://github.com/aconaway-rens/neighbor-mapper","last_synced_at":"2026-02-25T22:05:50.988Z","repository":{"id":336537713,"uuid":"1150083879","full_name":"aconaway-rens/neighbor-mapper","owner":"aconaway-rens","description":"L2 Network Mapper","archived":false,"fork":false,"pushed_at":"2026-02-20T16:36:46.000Z","size":3961,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-20T19:57:31.394Z","etag":null,"topics":["ai","ai-generated","claude","vibecoding"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aconaway-rens.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-04T21:32:31.000Z","updated_at":"2026-02-20T16:07:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aconaway-rens/neighbor-mapper","commit_stats":null,"previous_names":["aconaway-rens/neighbor-mapper"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aconaway-rens/neighbor-mapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aconaway-rens%2Fneighbor-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aconaway-rens%2Fneighbor-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aconaway-rens%2Fneighbor-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aconaway-rens%2Fneighbor-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aconaway-rens","download_url":"https://codeload.github.com/aconaway-rens/neighbor-mapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aconaway-rens%2Fneighbor-mapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29842945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-generated","claude","vibecoding"],"created_at":"2026-02-25T22:05:50.015Z","updated_at":"2026-02-25T22:05:50.980Z","avatar_url":"https://github.com/aconaway-rens.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Network Neighbor Mapper\n\nA Flask-based web application that discovers network topology using CDP and LLDP protocols. Automatically detects device types and recursively maps network neighbors.\n\n## 🎯 Features\n\n- **Web Interface** - Easy-to-use HTML form for discovery\n- **Interactive Network Diagrams** - Beautiful, interactive visualizations with color-coded nodes and interface labels\n- **Multi-Protocol** - Discovers neighbors via both CDP and LLDP\n- **Multi-Vendor Support** - Cisco, Arista, Juniper, Palo Alto, MikroTik, Fortinet, HPE, Dell, Extreme, Ubiquiti, Barracuda\n- **Smart Detection** - YAML-based device type detection\n- **Recursive Discovery** - Automatically crawls neighbors (routers/switches only)\n- **Device Type Filtering** - Choose which devices to include (routers, switches, phones, servers, APs)\n- **Interface Mapping** - Shows local and remote interface connections\n- **Management IPs** - Displays IP addresses for discovered devices\n- **Text-Based Map** - Clean ASCII tree visualization\n- **Docker Ready** - Containerized for easy deployment\n\n## 📋 Prerequisites\n\n- Docker and Docker Compose\n- Network access to devices\n- SSH credentials with appropriate privileges\n- Devices with CDP and/or LLDP enabled\n\n## 🚀 Quick Start\n\n### Option 1: Docker Compose (Recommended)\n\n```bash\n# Clone or extract the project\ncd neighbor-mapper-v2\n\n# Start the application\ndocker-compose up -d\n\n# View logs\ndocker-compose logs -f\n\n# Stop the application\ndocker-compose down\n```\n\nAccess the web interface at: **http://localhost:8000**\n\n### Option 2: Docker Build\n\n```bash\n# Build the image\ndocker build -t neighbor-mapper .\n\n# Run the container\ndocker run -d -p 8000:8000 --name neighbor-mapper neighbor-mapper\n\n# View logs\ndocker logs -f neighbor-mapper\n```\n\n### Option 3: Local Development\n\n```bash\n# Install dependencies\npip install -r requirements.txt\n\n# Run the application\ncd app\npython app.py\n```\n\n## 🎮 Usage\n\n1. **Open Web Interface** - Navigate to http://localhost:8000\n2. **Enter Seed Device** - Provide IP address of starting device\n3. **Select Device Type** - Choose the Netmiko device type from dropdown\n4. **Enter Credentials** - SSH username and password\n5. **Set Depth** - Choose how many hops to discover (1-5)\n6. **Start Discovery** - Click \"Start Discovery\" button\n7. **View Results** - See topology map with devices, interfaces, and IPs\n\n## 📊 Example Output\n\n```\nCORE-SW-01 (192.168.1.1)\n├─[CDP+LLDP] Gi1/0/1 ↔ Gi1/0/48 (192.168.1.10)\n│   DIST-SW-01 (192.168.1.10)\n│   └─[CDP+LLDP] Gi1/0/10 ↔ Gi0/1 (192.168.1.20)\n│      ACCESS-SW-01 (192.168.1.20)\n└─[CDP+LLDP] Gi1/0/2 ↔ Gi1/0/48 (192.168.1.11)\n   DIST-SW-02 (192.168.1.11)\n```\n\n## ⚙️ Configuration\n\n### Device Type Detection\n\nEdit `config/device_type_patterns.yaml` to add or modify device type patterns:\n\n```yaml\ndevice_types:\n  cisco_ios:\n    platforms:\n      - catalyst\n      - c3750\n      - c2960\n    system_descriptions:\n      - \"Cisco IOS Software\"\n    priority: 50\n```\n\n**Pattern Matching:**\n- `platforms`: Match against CDP platform string\n- `system_descriptions`: Match against LLDP system description\n- `priority`: Higher priority patterns are preferred (0-100)\n\n**Add New Patterns:**\n1. Edit `config/device_type_patterns.yaml`\n2. Add platform or description patterns\n3. Restart the container: `docker-compose restart`\n\n### Discovery Settings\n\nIn `config/device_type_patterns.yaml`:\n\n```yaml\ndiscovery:\n  max_depth: 3              # Default maximum hops\n  connection_timeout: 15    # SSH connection timeout (seconds)\n  command_timeout: 30       # Command execution timeout (seconds)\n```\n\n### Capability Filtering\n\nControl which devices are crawled:\n\n```yaml\nallowed_capabilities:\n  - Router    # Full word\n  - Switch\n  - R         # Abbreviated\n  - S\n  - B         # Bridge (switch)\n```\n\nDevices without these capabilities (like phones, access points) are ignored.\n\n## 🗂️ Project Structure\n\n```\nneighbor-mapper-v2/\n├── app/\n│   ├── app.py              # Flask application\n│   ├── discovery.py        # Topology discovery engine\n│   ├── parsers.py          # CDP/LLDP parsers\n│   └── device_detector.py  # Device type detection\n├── config/\n│   └── device_type_patterns.yaml  # Detection patterns\n├── templates/\n│   └── index.html          # Web interface\n├── logs/                   # Application logs\n├── Dockerfile              # Container definition\n├── docker-compose.yml      # Docker Compose config\n├── requirements.txt        # Python dependencies\n└── README.md              # This file\n```\n\n## 🔍 How It Works\n\n1. **Initial Connection**\n   - SSH to seed device using provided credentials\n   - Extract hostname from prompt\n\n2. **Neighbor Discovery**\n   - Run `show cdp neighbors detail`\n   - Run `show lldp neighbors detail`\n   - Parse outputs to extract neighbor information\n\n3. **Device Type Detection**\n   - Match platform strings against YAML patterns\n   - Determine appropriate Netmiko device type\n   - Check capabilities (Router/Switch only)\n\n4. **Recursive Crawl**\n   - Queue neighbors for discovery\n   - Repeat process for each neighbor\n   - Track visited devices to avoid loops\n   - Respect maximum depth setting\n\n5. **Topology Rendering**\n   - Build adjacency graph\n   - Generate ASCII tree visualization\n   - Show interface mappings and IPs\n\n## 📝 Logs\n\nLogs are written to `logs/app.log` and displayed in the container output.\n\n**View logs:**\n```bash\n# Docker Compose\ndocker-compose logs -f\n\n# Docker\ndocker logs -f neighbor-mapper\n\n# Local file\ntail -f logs/app.log\n```\n\n**Log Levels:**\n- INFO: Discovery progress, device connections\n- WARNING: Failed CDP/LLDP queries, skipped devices\n- ERROR: Connection failures, authentication errors\n\n## 🐛 Troubleshooting\n\n### No neighbors found\n- **Check:** CDP/LLDP enabled on devices\n- **Command:** `show cdp neighbors` / `show lldp neighbors`\n- **Fix:** `cdp run` / `lldp run` in global config\n\n### Authentication failed\n- **Check:** Username/password correct\n- **Check:** Account has privilege level 15 or appropriate access\n- **Fix:** Test SSH manually: `ssh user@device-ip`\n\n### Connection timeout\n- **Check:** Network connectivity to device\n- **Check:** SSH enabled and accessible\n- **Fix:** Verify firewall rules, ping device\n\n### Wrong device type detected\n- **Check:** Pattern matching in YAML config\n- **Fix:** Add specific platform pattern for your device\n- **Example:** Add `c9300-24p` to cisco_xe platforms\n\n### Device skipped during crawl\n- **Check:** Device capabilities\n- **Reason:** Only Router/Switch devices are crawled\n- **Fix:** Verify device is reporting R or S capability\n\n## 🔒 Security Considerations\n\n- **Credentials:** Passwords are not stored, only used during discovery\n- **Network Access:** Ensure container can reach network devices\n- **SSH Keys:** Currently uses password auth (key auth can be added)\n- **HTTPS:** Consider adding TLS/SSL for production use\n- **Authentication:** Add web app authentication for production\n\n## 🚧 Limitations\n\n- **SSH Only:** Telnet not supported\n- **Cisco Focus:** Best tested on Cisco devices\n- **Single Credential:** Uses same credentials for all devices\n- **No Persistence:** Discovery results not saved (add database for this)\n- **Text Output:** No graphical topology (can add vis.js, D3, etc.)\n\n## 🔮 Future Enhancements\n\n- [ ] Save topologies to database\n- [ ] Export to formats (JSON, GraphML, CSV)\n- [ ] Graphical topology visualization\n- [ ] Multiple credential sets\n- [ ] SSH key authentication\n- [ ] Web authentication/authorization\n- [ ] REST API endpoints\n- [ ] Scheduled discoveries\n- [ ] Change detection\n- [ ] More vendor support\n\n## 📄 License\n\nOpen source - feel free to modify and extend!\n\n## 🤝 Contributing\n\nTo add support for new device types:\n\n1. Edit `config/device_type_patterns.yaml`\n2. Add platform/description patterns\n3. Set appropriate priority\n4. Test and submit PR\n\n## 💡 Tips\n\n- **Start small:** Use depth=1 for initial testing\n- **Check logs:** Monitor logs during discovery\n- **Update patterns:** Add patterns as you discover new device types\n- **Test credentials:** Verify SSH access before running discovery\n- **Network segments:** May need to run from jump host if devices are isolated\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faconaway-rens%2Fneighbor-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faconaway-rens%2Fneighbor-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faconaway-rens%2Fneighbor-mapper/lists"}