{"id":27968501,"url":"https://github.com/thegreydiamond/pynetgearswitchcontroller","last_synced_at":"2025-05-07T21:03:44.874Z","repository":{"id":46520567,"uuid":"270334797","full_name":"TheGreyDiamond/PyNetgearSwitchController","owner":"TheGreyDiamond","description":"A Python library to control Netgear ProSafe Switches.","archived":false,"fork":false,"pushed_at":"2023-11-15T19:03:15.000Z","size":65,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T21:03:36.031Z","etag":null,"topics":["hacktoberfest","netgear","networking-in-python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheGreyDiamond.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-07T14:41:36.000Z","updated_at":"2024-03-22T20:26:51.000Z","dependencies_parsed_at":"2022-07-22T11:02:27.489Z","dependency_job_id":null,"html_url":"https://github.com/TheGreyDiamond/PyNetgearSwitchController","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheGreyDiamond%2FPyNetgearSwitchController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheGreyDiamond%2FPyNetgearSwitchController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheGreyDiamond%2FPyNetgearSwitchController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheGreyDiamond%2FPyNetgearSwitchController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheGreyDiamond","download_url":"https://codeload.github.com/TheGreyDiamond/PyNetgearSwitchController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954409,"owners_count":21830902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","netgear","networking-in-python"],"created_at":"2025-05-07T21:03:44.348Z","updated_at":"2025-05-07T21:03:44.857Z","avatar_url":"https://github.com/TheGreyDiamond.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyNetgearSwitchController\n \nA Python library to control Netgear ProSafe Switches.\n This is still under heavy development and should not be used in a production envoriment.\n \n# Documentation\nFirst of all you need to create a switch object:\n```py\nsw = switch.NetgearSwitch(ip = \"\u003cyour switch ip\u003e\", SID=\"\", cookieName=\"SID\", hashN = 27016, passwordHash=\"\u003cyour password hash\u003e\", mode=2)\n```\nTo generate the passwordHash use passwordGen.html, just enter your password and retrieve the randomcode.\nYou can retrieve all port info by using `sw.getAllPorts()`, it will return a list of port objects. Taking a look at the port object:\n```python\nclass port():\n    def __init__(self):\n        self.name = \"\"\n        self.state = \"unset\"\n        self.speed = \"unset\"\n        self.realSpeed = \"unset\"\n        self.flow = \"unset\"\n        self.maxMTU = \"unset\"\n```\nYou can see which atributes can be retrieved. You can also retrieve device information with `sw.getDeviceInfo()`, this will return a dictonary with info about the switch.\nHere is an full example:\n```python\nimport switch\n\nsw = switch.NetgearSwitch(ip = \"\u003cyour switch ip\u003e\", SID=\"\", cookieName=\"SID\", hashN = 27016, passwordHash=\"\u003cyour password hash\u003e\", mode=2)\n\nports = sw.getAllPorts()\nsw.updatePorts()             # Forces a port state update\nprint(sw.getDeviceInfo())    # Prints out info about the switch\nfor mP in ports:\n    print(mP.realSpeed)\nsw.logout()\n\n```\nIt will output all linked speeds.\n\n---\n**Warning**\n\nAlways use sw.logout() or the next login might fail!\n\n---\n\n# Troubleshooting\nIf you get an error try using another mode:\n| Mode | Devices         |\n|------|-----------------|\n| 1    |  Unknown        |\n| 2    | GS108Ev3[Works] GS105Ev2[Works] |\n\nIf that dosn't change the cookieName. You can retrieve it easily, here's a quick guide:\n1. Open Firefox and navigate to your switch's login page. Then login.\n2. RightClick, then select \"Inspect Element\"\n3. Now click on the tab \"Storage\" and open the \"Cookie\" dropdown\n4. Note down the Name of the cookie, and set cookieName to it\n![Guide](https://github.com/TheGreyDiamond/PyNetgearSwitchController/blob/master/netgearSwitch.png)\n\n# All functions\n## Switch\n`updatePorts()`\n   Forces an update of all ports\n   \n`updateDeviceInfo()`\n   Forces an update of device info atributes\n   \n`getAllPorts()`\n   Returns all ports of the switch\n   \n`getPortByNo(num)`\n   Gets one ports by its number\n   \n`getDeviceInfo()`\n   Returns all device information\n   \n`getDevicePropByName(name)`\n   Returns device information by property name\n   \n`setPortState(portName, speed, flow)`\n   Sets the port properties\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthegreydiamond%2Fpynetgearswitchcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthegreydiamond%2Fpynetgearswitchcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthegreydiamond%2Fpynetgearswitchcontroller/lists"}