This commit is contained in:
Blackwhitebear8 2025-06-22 16:33:28 +02:00
commit 5e31dd0214
37 changed files with 2082 additions and 0 deletions

21
modules/neighbors.py Normal file
View file

@ -0,0 +1,21 @@
def parse_neighbors_data(data):
neighbors_table = []
if "data" in data:
raw_data = data["data"]
for line in raw_data.split("\n"):
if line.strip() and not line.startswith("Address") and "---" not in line:
neighbors_info = line.split()
if len(neighbors_info) >= 4:
neighbors_table.append({
"address": neighbors_info[0],
"interface": neighbors_info[1],
"link_layer_address": neighbors_info[2],
"state": neighbors_info[3]
})
return neighbors_table
def generate_neighbors_json(neighbors_table):
return {"neighbors_table": neighbors_table}