on 01-24-2014 09:42 AM
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/1.0">
<soapenv:Header/>
<soapenv:Body>
<ns:listPhoneByName sequence="1">
<searchString>%</searchString>
</ns:listPhoneByName>
</soapenv:Body>
</soapenv:Envelope>
@dstaudt Thanks, David, for the detailed solution.
Am I correct to assume the webaccess for device would need to be enabled for the DeviceInformationX to work?
Regards
Correct
All links here are not working. I need to find a serial number from a known MAC address.
As part of a project, I wrote this Python script to retrieve the following information:
If anyone would like to test it, here is the script:
---------------------------------------------------------
import requests
from bs4 import BeautifulSoup
import ipaddress
from datetime import datetime
def recorrer_red(red_str):
"""
Recorre una red dada en notación CIDR (ej: '192.168.1.0/24')
y devuelve una lista con todas las direcciones de host.
"""
red = ipaddress.ip_network(red_str)
return [str(ip) for ip in red.hosts()]
def guardar_log(texto, archivo="registro_de_logs.txt"):
"""
Guarda un texto en un archivo de logs con fecha y hora.
"""
fecha_hora = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
with open(archivo, "a", encoding="utf-8") as file:
file.write(f"[{fecha_hora}] {texto}\n")
# Ejemplo de uso
ips = recorrer_red("192.168.100.32/28")
for ip in ips:
url = f"http://{ip}/"
try:
response = requests.get(url, timeout=2)
if response.status_code == 200:
html = response.text
soup = BeautifulSoup(html, "html.parser")
filas = soup.find_all("tr")
version = None
serial = None
model = None
for fila in filas:
celdas = fila.find_all("td")
if len(celdas) >= 3:
campo = celdas[0].get_text(strip=True)
valor = celdas[2].get_text(strip=True)
if campo == "Version":
version = valor
elif campo == "Serial Number":
serial = valor
elif campo == "Model Number":
model = valor
resultado = f"IP: {ip} | Version: {version} | Serial: {serial} | Model: {model}"
print(resultado)
guardar_log(resultado)
else:
error_msg = f"{url} -> Error HTTP {response.status_code}"
print(error_msg)
guardar_log(error_msg)
except requests.exceptions.RequestException as e:
error_msg = f"{url} -> Error: {e}"
print(error_msg)
guardar_log(error_msg)
---------------------------------------------------------
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: