{"id":43310033,"url":"https://github.com/delimitry/snmp-server","last_synced_at":"2026-02-01T21:03:31.740Z","repository":{"id":46580721,"uuid":"155453549","full_name":"delimitry/snmp-server","owner":"delimitry","description":"SNMP server in pure Python","archived":false,"fork":false,"pushed_at":"2024-08-10T17:55:09.000Z","size":106,"stargazers_count":42,"open_issues_count":3,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-10T18:57:38.215Z","etag":null,"topics":["asn1","echo","python","python3","server","snmp","snmp-echo-server","snmpv1","snmpv2"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/delimitry.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T20:42:10.000Z","updated_at":"2024-08-05T13:03:34.000Z","dependencies_parsed_at":"2024-08-11T04:47:39.446Z","dependency_job_id":null,"html_url":"https://github.com/delimitry/snmp-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/delimitry/snmp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delimitry%2Fsnmp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delimitry%2Fsnmp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delimitry%2Fsnmp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delimitry%2Fsnmp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delimitry","download_url":"https://codeload.github.com/delimitry/snmp-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delimitry%2Fsnmp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28990707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T20:57:35.821Z","status":"ssl_error","status_checked_at":"2026-02-01T20:57:29.580Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["asn1","echo","python","python3","server","snmp","snmp-echo-server","snmpv1","snmpv2"],"created_at":"2026-02-01T21:03:31.092Z","updated_at":"2026-02-01T21:03:31.735Z","avatar_url":"https://github.com/delimitry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"SNMP server\n===========\n\n|MIT license badge|\n\nDescription:\n------------\nSimple SNMP server in pure Python  \n\nUsage with pytest:\n------------------\n\nIt is possible to use snmpserver as pytest plugin. This option requires Python \u003e=3.6.\n\nThe fixture ``snmpserver`` has the ``host`` and ``port`` attributes (which can be set via environment variables ``PYTEST_SNMPSERVER_HOST`` and ``PYTEST_SNMPSERVER_PORT``), along with the ``expect_request`` method:\n\n::\n\n  def test_request_replies_correctly(snmpserver):\n      snmpserver.expect_request(\"1.3.6.1.2.1.2.2.1.2\", \"some description\")\n      command = shlex.split(f'{snmpget_command} {snmpserver.host}:{snmpserver.port} IF-MIB::ifDescr')\n      p = subprocess.Popen(command, stdout=subprocess.PIPE)\n      p.wait()\n      assert 'IF-MIB::ifDescr some description' == p.stdout.read().decode('utf-8').strip()\n\n\nStandalone usage:\n-----------------\n\nIt is also possible to use standalone version of SNMP server, which works as an echo server if no config is passed. This version supports Python 2 and 3.\n\n::\n\n  Standalone usage: snmp-server.py [-h] [-p PORT] [-c CONFIG] [-d] [-v]\n\n  SNMP server\n\n  optional arguments:\n    -h, --help            show this help message and exit\n    -p PORT, --port PORT  port (by default 161 - requires root privileges)\n    -c CONFIG, --config CONFIG\n                          OIDs config file\n    -d, --debug           run in debug mode\n    -v, --version         show program's version number and exit\n\n**Examples:**\n\n::\n\n  # ./snmp-server.py -p 12345\n  SNMP server listening on 0.0.0.0:12345\n  # ./snmp-server.py\n  SNMP server listening on 0.0.0.0:161\n\nWithout config file SNMP server works as a simple SNMP echo server:\n\n::\n\n  # snmpget -v 2c -c public 0.0.0.0:161 1.2.3.4.5.6.7.8.9.10.11\n  iso.2.3.4.5.6.7.8.9.10.11 = STRING: \"1.2.3.4.5.6.7.8.9.10.11\"\n\nIt is possible to create a config file with values for specific OIDs.  \n\nConfig file - is a Python script and must have DATA dictionary with string OID keys and values.  \n\nValues can be either ASN.1 types (e.g. :code:`integer(...)`, :code:`octet_string(...)`, etc) or any Python lambda/functions (with single argument - OID string), returning ASN.1 type.  \n\n::\n\n  DATA = {\n    '1.3.6.1.4.1.1.1.0': integer(12345),\n    '1.3.6.1.4.1.1.2.0': bit_string('\\x12\\x34\\x56\\x78'),\n    '1.3.6.1.4.1.1.3.0': octet_string('test'),\n    '1.3.6.1.4.1.1.4.0': null(),\n    '1.3.6.1.4.1.1.5.0': object_identifier('1.3.6.7.8.9'),\n    # notice the wildcards:\n    '1.3.6.1.4.1.1.6.*': lambda oid: octet_string('* {}'.format(oid)),\n    '1.3.6.1.4.1.1.?.0': lambda oid: octet_string('? {}'.format(oid)),\n    '1.3.6.1.4.1.2.1.0': real(1.2345),\n    '1.3.6.1.4.1.3.1.0': double(12345.2345),\n  }\n\n::\n\n  # ./snmp-server.py -c config.py\n  SNMP server listening on 0.0.0.0:161\n\nWith config file :code:`snmpwalk` command as well as :code:`snmpget` can be used:\n\n::\n\n  # snmpwalk -v 2c -c public 0.0.0.0:161 .1.3.6.1.4.1\n  iso.3.6.1.4.1.1.1.0 = INTEGER: 12345\n  iso.3.6.1.4.1.1.2.0 = BITS: 12 34 56 78 3 6 10 11 13 17 19 21 22 25 26 27 28\n  iso.3.6.1.4.1.1.3.0 = STRING: \"test\"\n  iso.3.6.1.4.1.1.4.0 = NULL\n  iso.3.6.1.4.1.1.5.0 = OID: iso.3.6.7.8.9\n  iso.3.6.1.4.1.1.6.4294967295 = STRING: \"* 1.3.6.1.4.1.1.6.4294967295\"\n  iso.3.6.1.4.1.1.9.0 = STRING: \"? 1.3.6.1.4.1.1.9.0\"\n  iso.3.6.1.4.1.2.1.0 = Opaque: Float: 1.234500\n  iso.3.6.1.4.1.3.1.0 = Opaque: Float: 12345.234500\n  iso.3.6.1.4.1.4.1.0 = No more variables left in this MIB View (It is past the end of the MIB tree)\n\nAlso :code:`snmpset` command can be used:\n\n::\n\n  # snmpset -v2c -c public 0.0.0.0:161 .1.3.6.1.4.1.1.3.0 s \"new value\"\n  iso.3.6.1.4.1.1.3.0 = STRING: \"new value\"\n  #\n  # snmpget -v2c -c public 0.0.0.0:161 .1.3.6.1.4.1.1.3.0 \n  iso.3.6.1.4.1.1.3.0 = STRING: \"new value\"\n\nLicense:\n--------\nReleased under `The MIT License`_.\n\n.. |MIT license badge| image:: http://img.shields.io/badge/license-MIT-brightgreen.svg\n.. _The MIT License: https://github.com/delimitry/snmp-server/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelimitry%2Fsnmp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelimitry%2Fsnmp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelimitry%2Fsnmp-server/lists"}