Skip to content

Instantly share code, notes, and snippets.

@KyGuy2002
Created June 12, 2024 04:42
Show Gist options
  • Save KyGuy2002/7167cd99ba778909946900057be3a38e to your computer and use it in GitHub Desktop.
Save KyGuy2002/7167cd99ba778909946900057be3a38e to your computer and use it in GitHub Desktop.
Prints a table of macs, reported ips, and real ips of wyze devices
import os
from wyze_sdk import Client
access_token = "INSERT WYZE ACCESS TOKEN (FOUND IN DEV TOOLS WHEN ACCESSING MY.WYZE.COM/LIVE)"
print("Network Scan...")
scan_res = os.popen(f'arp -a').readlines()
print("Scan Complete.")
def getRealIp(mac):
for line in scan_res:
if (mac in line): return str(line[2:15])
return ""
print("")
print("Loading Wyze API...")
client = Client(token=access_token)
all = client.devices_list()
print("API Loaded.")
print("")
print("")
print('{:30} | {:15} | {:25} | {:35} | {:20} | {:20} | {:20}'.format(*["Name", "Type", "Mac", "Mac (Dashed)", "Enr", "Ip (Reported)", "Ip (Actual)"]))
print("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")
for device in all:
# if (device.type != "MeshLight"): continue
# if (device.type != "Plug"): continue
dashedMac = '-'.join(device.mac.lower()[i:i+2] for i in range(0, len(device.mac), 2))
print('{:30} | {:15} | {:25} | {:35} | {:20} | {:20} | {:20}'.format(*[
device.nickname,
(device.type if device.type != None else ""),
device.mac,
dashedMac,
device.enr,
(device.ip if (hasattr(device, 'ip') and device.ip != None) else ""),
getRealIp(dashedMac)
]))
print("")
print("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment