Skip to content

Commit

Permalink
Merged etingof#146 from etingof snmpsim
Browse files Browse the repository at this point in the history
  • Loading branch information
Lostboi committed Dec 21, 2020
1 parent 32bfd42 commit 66bf723
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions snmpsim/grammar/walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ def _hex_string_filter(value):
match = re.match(r'^([0-9a-fA-F]{2}(\s+[0-9a-fA-F]{2})*)\s+\[', value)
if match:
return [int(y, 16) for y in match.group(1).split(' ')]
elif ' ' in value:
return [int(y, 16) for y in value.split(' ')]
else:
# This could be the format returned by some unknown windows snmpwalk tool:
# .1.3.6.1.2.1.2.2.1.6.1 = HEX-STRING: 00029929AE3C
return [int(value[i:i+2], 16) for i in range(0, len(value), 2)]

return [int(y, 16) for y in value.split(' ')]

@staticmethod
def _gauge_filter(value):
try:
Expand Down

0 comments on commit 66bf723

Please sign in to comment.