diff --git a/main.py b/main.py index b03405f..7369aab 100755 --- a/main.py +++ b/main.py @@ -80,38 +80,10 @@ def get_cmd(host: str, xssid: str, cmd: int, **params) -> str: ).text -def get_vlans(response: str) -> dict: - soup = BeautifulSoup(response, "html.parser") - - data = {} - table_body = soup.find("table", attrs={"width": "560"}) - - rows = table_body.find_all("tr") - for row in rows[1:]: - cols = row.find_all("td") - cols = [ele.text.strip() for ele in cols] - - try: - _, vlan_id, vlan_name, vlan_type, _, _ = cols - data.update( - { - vlan_id: { - "name": vlan_name, - "type": vlan_type, - } - } - ) - except ValueError: - continue - - return data - - def parse_vlan_ports(response: str) -> dict: soup = BeautifulSoup(response, "html.parser") data = {} - # port_settings = soup.find_all( "input", attrs={"type": "hidden", "id": re.compile(r"vlanMode_\d+")} ) @@ -168,10 +140,6 @@ if __name__ == "__main__": cookie = get_login_cookie(IP, "admin", os.environ.get("ADMIN_PW")) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1283)), "VLAN ID")) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1290)), "Port")) print(parse_vlan_ports(get_cmd(IP, cookie, 1293, vid=2))) - - # print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1283)), "VLAN ID")) - # print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1290)), "Port")) - - # vlans = get_vlans(get_cmd(IP, cookie, 1283)) - # print(vlans)