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

snmpset doesn't accept negative integer values #17

Open
e107steved opened this issue Jul 5, 2021 · 0 comments
Open

snmpset doesn't accept negative integer values #17

e107steved opened this issue Jul 5, 2021 · 0 comments

Comments

@e107steved
Copy link

Example:
snmpset.py -v1 -c public 127.0.0.1:161 1.3.6.1.4.1.40989.10.16.1.5.8.0 i -583
Error: Command-line parser error at token whitespace

(but snmpset.py -v1 -c public 127.0.0.1:161 1.3.6.1.4.1.40989.10.16.1.5.8.0 i 583
is OK)

Traced the error to the fact that the parser expects a string for the value, but '-' is not a valid first character for the string.
Fixed by adding '-' as a valid start character in the regular expression for strings - file cli/base.py around line 101:
class FirstLevelScanner(ScannerTemplate):
def t_string(self, s):
""" [!#$%&'()*+-,.//0-9<=>?@a-z\^
a-z\{\|\}~][!#\$%&\'\(\)\*\+,\-\.//0-9<=>\?@A-Z\\\^_a-z{|}~]* """
##""" [!#$%&'()*+,.//0-9<=>?@a-z\^
a-z\{\|\}~][!#\$%&\'\(\)\*\+,\-\.//0-9<=>\?@A-Z\\\^_a-z{|}~]* """
self.rv.append(ConfigToken('string', s))

Obviously a possible risk that breaks something else - I'm only using the tools in a very basic way.

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