diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b48b709..4dd506d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,10 @@ Changelog The change history, in order from newest to oldest. +1.13 +==== ++ Added support for parsing of "long pairs" sent by Cisco ASR devices. + 1.12 ==== diff --git a/README.rst b/README.rst index f0cd034..e8e09ca 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,10 @@ do_auth.py Versions ======== +1.13 +---- ++ Added support for parsing of "long pairs" sent by Cisco ASR devices. + 1.12 ---- diff --git a/do_auth.py b/do_auth.py index 1a457c3..921a9d3 100755 --- a/do_auth.py +++ b/do_auth.py @@ -243,7 +243,7 @@ __email__ = 'daniel.schmidt@wyo.gov' __copyright__ = 'Dan Schmidt' __license__ = 'GPL-3.0' -__version__ = '1.12' +__version__ = '1.13' try: import configparser @@ -583,13 +583,24 @@ def main(): i = 2 our_command = av_pairs[i].split("=") - while not (our_command[1] == "\n"): - the_command = the_command + " " + our_command[1].strip('\n') - i = i + 1 - if i == len(av_pairs): # Firewalls don't give a !! - break + if len(our_command[1]) > 1: + while not (our_command[1] == "\n"): + the_command = the_command + " " + our_command[1].strip('\n') + i = i + 1 + if i == len(av_pairs): # Firewalls don't give a !! + break - our_command = av_pairs[i].split("=") + our_command = av_pairs[i].split("=") + while our_command[0] == '\n': + i = i +1 + if i == len(av_pairs): + our_command = ['break_loop', "\n"] + break + + our_command = av_pairs[i].split("=") + + if len(our_command) == 1: + our_command = ['cmd-arg'] + our_command # DEBUG - We got the command log.debug('Got command: %r' % the_command)