bash
#!/bin/bash # Get current timestamp timestamp=$(date "+%Y-%m-%d %H:%M:%S") # Path to airport utility (used to scan Wi-Fi info) airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport" # Get Wi-Fi interface name (usually en0 or en1) wifi_interface=$(networksetup -listallhardwareports | \ awk '/Wi-Fi|AirPort/{getline; print $2}') # Get SSID and BSSID from airport utility wifi_info=$("$airport" -I) ssid=$(echo "$wifi_info" | awk -F': ' '/ SSID/ {print $2}') bssid=$(echo "$wifi_info" | awk -F': ' '/ BSSID/ {print $2}') # Get Wi-Fi adapter MAC address adapter_mac=$(ifconfig "$wifi_interface" | awk '/ether/ {print $2}') # Print results echo "Timestamp: $timestamp" echo "SSID: $ssid" echo "Access Point BSSID (MAC): $bssid" echo "Wi-Fi Adapter MAC: $adapter_mac"

📌 How to Use

  1. Save the script to a file, e.g., wifi_info.sh

  2. Make it executable:

    bash
    chmod +x wifi_info.sh
  3. Run it:

    bash
    ./wifi_info.sh

Privacy Preference Center