This tool searches for a MAC address across multiple Cisco IOS switches and can optionally resolve the matching IP address from Windows DHCP servers. It queries the switches concurrently and presents the results (switch IP, VLAN, and port) in a table.
- Search MAC addresses on network switches: Connects to every switch in
ip_list.txtconcurrently and reports where the MAC address is learned, including the switch IP, VLAN, and port. - Retrieve IP address from DHCP servers: Optionally searches the Windows
DHCP servers listed in
dhcp_servers.txtfor the lease matching the MAC. - Input validation: Accepts MAC addresses in any common notation
(
aa:bb:cc:dd:ee:ff,aa-bb-...,aabb.ccdd.eeff, oraabbccddeeff) and normalizes them automatically. - Robust connectivity: Bounded concurrency, per-connection timeouts, and clear logging instead of silently swallowed errors.
- Python 3.9+
- Required Python libraries (see
requirements.txt):netmikotqdmtabulatecolorama
- For the optional DHCP lookup: a Windows environment (or a host with
pwsh) where theDhcpServerPowerShell module is available.
-
Clone the repository:
git clone https://github.com/saeed205/Cisco_mac_address_finder.git cd Cisco_mac_address_finder -
Install the required Python libraries:
pip install -r requirements.txt
-
Create the inventory files from the provided templates:
cp ip_list.txt.example ip_list.txt cp dhcp_servers.txt.example dhcp_servers.txt
Then edit
ip_list.txt(switch IPs, one per line) anddhcp_servers.txt(DHCP server hostnames/IPs, one per line). These files are git-ignored so your real addresses are never committed.
python main.pyOptional arguments:
--ip-list PATH Switch IP list file (default: ip_list.txt)
--dhcp-list PATH DHCP server list file (default: dhcp_servers.txt)
--username NAME Switch username (prompted if omitted)
--workers N Concurrent switch connections (default: 10)
--no-color Disable colored output
-v, --verbose Enable debug logging
Follow the prompts to enter your credentials and the MAC address to search for. If you choose to resolve the IP, the tool searches the configured DHCP servers.
main.py: The main script.ip_list.txt: Switch IP addresses to query (created from the template).dhcp_servers.txt: DHCP servers to query (created from the template).*.example: Templates for the inventory files.
- Ensure you have permission to access the switches and DHCP servers.
- The DHCP lookup uses PowerShell (
pwshorpowershell) and theDhcpServermodule; it only works where those are available. - The tool assumes Cisco IOS switches. Adjust the
device_typeinfind_mac_on_switchfor other platforms.
This project is licensed under the MIT License.
Happy networking!