A comprehensive Python SNMP library supporting v1/v2c/v3 with authentication and privacy protocols
84
Build a command-line tool that validates SNMPv3 credentials against network devices using different authentication and privacy protocols.
Create a Python script credential_validator.py that accepts network device details and SNMPv3 credentials, then attempts to retrieve basic system information to verify the credentials are valid.
The script should accept the following arguments:
--host: Target device hostname or IP address (required)--port: SNMP port (default: 161)--username: SNMPv3 username (required)--auth-protocol: Authentication protocol - choices: "MD5", "SHA", "SHA224", "SHA256", "SHA384", "SHA512", or "none" (required)--auth-key: Authentication passphrase (required if auth-protocol is not "none")--priv-protocol: Privacy/encryption protocol - choices: "DES", "3DES", "AES128", "AES192", "AES256", or "none" (required)--priv-key: Privacy passphrase (required if priv-protocol is not "none")The tool should:
On success, print:
SUCCESS: Credentials validated for <host>
System Description: <retrieved system description>
Security Level: <noAuthNoPriv|authNoPriv|authPriv>On authentication failure, print:
FAILED: Authentication failed - <error details>On connection timeout or other errors, print:
ERROR: <error description>@generates
import argparse
def validate_credentials(host, port, username, auth_protocol, auth_key, priv_protocol, priv_key):
"""
Validate SNMPv3 credentials against a network device.
Args:
host: Target device hostname or IP
port: SNMP port number
username: SNMPv3 username
auth_protocol: Authentication protocol (MD5, SHA, SHA224, SHA256, SHA384, SHA512, or none)
auth_key: Authentication passphrase
priv_protocol: Privacy protocol (DES, 3DES, AES128, AES192, AES256, or none)
priv_key: Privacy passphrase
Returns:
tuple: (success: bool, message: str, sys_description: str or None)
"""
pass
def main():
"""Parse arguments and execute credential validation."""
pass
if __name__ == "__main__":
main()Provides SNMPv3 protocol support with user-based security model.
Install with Tessl CLI
npx tessl i tessl/pypi-pysnmpevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10