Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 support out of the box, identifier 3? #117

Open
srdjus opened this issue Jun 13, 2024 · 0 comments
Open

V3 support out of the box, identifier 3? #117

srdjus opened this issue Jun 13, 2024 · 0 comments

Comments

@srdjus
Copy link

srdjus commented Jun 13, 2024

I'm using Python 3.12 and I Installed puresnmp w/ puresnmp-crypto package. I already have V2 implementation and puresnmp is working as expected.

This is what I get when I try to run a get command on my SNMP v3 agent:

Got an exception: Namespace 'puresnmp_plugins.security' did not contain a plugin with identifier 3. Known identifiers: [0, 1, 2]. See the 'puresnmp' documentation on plugins.

I tried snmpwalk/snmpget from CLI, and it works. I am not sure if there is something else I have to configure in order to use V3? How do I include this identifier and where?

import asyncio
from puresnmp import PyWrapper, Client, V3
from puresnmp.credentials import Auth, Priv
 
credentials = V3(
    username="bootstrap",
    auth=Auth(b"temp_password", "md5"),
    priv=Priv(b"myprivphrase", "aes")
)

# Create a new client
client = PyWrapper(
    Client(
        ip="127.0.0.1",
        port=161,
        credentials=credentials
    )
)

try:
     output = await client.get("1.3.6.1.2.1.1.5.0")
     print(f"Sys name is: {output}")
except Exception as e:
     print(f"Got an exception: {e}")

UPDATE:
I solved it. I had to install typing-extensions package.

In puresnmp/plugins/pluginbase.py discover_plugins function 'puresnmp_plugins.security' module couldn't be found, ImportError was caught telling me I'm missing this package.

UPDATE 2:
Now I got like 10 new errors like
puresnmp_plugins.security.usm.EncryptionError: Unable to encrypt message (string argument without an encoding)
not sure if this is related, but I guess it has something to do with python/packages version/dependencies...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant