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.
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.