Managing and organizing wireless networks in and out of Ekahau efficiently often involves associating relevant information, like MAC addresses, with access points. To streamline this process, we’ve developed a Python script that reads MAC addresses from a CSV file and adds them as tags to their corresponding access points within an Ekahau project file. Let’s break down how this script operates and its key functionalities.

Understanding the Ekahau Script

The script is designed to be run from the command line, utilizing Python’s argparse library for parsing arguments. Users need to prepare a CSV file with two columns: “Name” for access point names and “MAC” for the respective MAC addresses. Here’s a breakdown of the core functionalities:

  1. Argument Parsing: The script utilizes argparse to receive an input Ekahau project file (esx_file) as an argument.
  2. File Operations: It opens the specified CSV file (AP-to-MAC.csv) and the provided Ekahau project file (args.file). The Ekahau project file is unpacked to a temporary directory for modification.
  3. Accessing JSON Files: The script accesses two crucial JSON files within the Ekahau project—accessPoints.json and tagKeys.json.
  4. Matching MAC Addresses: For each line in the CSV file, the script matches the access point name to the Name column in the CSV with the name field in the accessPoints.json.
  5. Assigning Tags: When a match is found, it appends a new tag consisting of the MAC address to the access point in the accessPoints.json file under the appropriate key.
  6. Updating the Project File: The updated accessPoints.json file is written back to the project directory. The modified directory is then archived and renamed with a _modified suffix before deleting the temporary directory.
  7. Runtime Information: Finally, the script displays the time taken for execution.

How to Use the Script

  1. Prepare the CSV File: Create a CSV file with two columns—’Name’ and ‘MAC’. Populate it with the necessary access point names and their respective MAC addresses.
  2. Run the Script: Execute the script from the command line, providing the Ekahau project file as an argument:bashCopy codepython main.py project_file.esx Replace project_file.esx with the name of your Ekahau project file.
  3. Review the Modified File: Locate the generated project_file_modified.esx, which contains the updated tags with MAC addresses associated with the access points.

Access the script here: https://github.com/benea11/Ekahau-MAC-Importer/blob/main/main.py

Want more information about 5G? Read more of our articles by visiting our 5G category.

Categorized in: