This SNMP Proxy listens for SNMPv3 requests and either responds with locally handled OIDs or proxies the request to a target SNMP device.
- Python 3.6+ (3.11 preferred)
pysnmplibrarypyasn1library
Does not work with python >= 3.12 due to incompatibility with pysnmp library.
-
Clone the repository:
git clone https://github.com/koenhandekyn/snmpproxy.git cd snmpproxy -
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Ensure the
snmpproxy.pyscript is executable:chmod +x snmpproxy.py
-
Run the SNMP proxy:
python snmpproxy.py
The SNMP Proxy will start listening on UDP port 161 for SNMPv3 requests.
- SNMPv3 credentials and target device settings can be modified in the
snmpproxy.pyfile. - Local OID mappings are defined in the
LOCAL_OIDSdictionary within thesnmpproxy.pyfile.
Logs are written to snmp_proxy.log in the same directory as the script.
To stop the SNMP Proxy, press Ctrl+C in the terminal where the proxy is running.
sudo python snmpproxy.py
client (1)
sudo python snmpclient.py
client (2)
snmpget -v3 -l authPriv -u proxyUser -a SHA -A "authPassword123" -x AES -X "privPassword123" localhost 1.3.6.1.4.1.6302.2.1.2.28.6.0