aboutsummaryrefslogtreecommitdiffstats
path: root/osmopy/osmo_interact
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-25 20:01:36 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-25 20:01:48 +0700
commit6dea9111b5d83c9c7b8be381ef76ff4e3bdd983a (patch)
tree39ac0f2656d320d967bf69efd89890fa05a2470e /osmopy/osmo_interact
parent95edea9fa7cba66b29fbf0b9dbbedcd3223597f4 (diff)
InteractVty: re.escape() the VTY prompt in connect()
The VTY prompt may contain regular expression metacharacters in it, so the self.re_prompt will not match as expected. One example is the modem app in osmocom-bb.git using promot 'OsmocomBB(modem)'. Change-Id: I47b1f1c1765acb1b935dcbcc54bbb5eb539db4f0
Diffstat (limited to 'osmopy/osmo_interact')
-rwxr-xr-xosmopy/osmo_interact/vty.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/osmopy/osmo_interact/vty.py b/osmopy/osmo_interact/vty.py
index f4b9aff..1cc299c 100755
--- a/osmopy/osmo_interact/vty.py
+++ b/osmopy/osmo_interact/vty.py
@@ -95,7 +95,7 @@ class InteractVty(Interact):
if not self.prompt:
raise Exception('Could not find application name; needed to decode prompts.'
' Initial data was: %r' % data)
- self.re_prompt = re.compile('^%s(?:\(([\w-]*)\))?([#>]) (.*)$' % self.prompt)
+ self.re_prompt = re.compile('^%s(?:\(([\w-]*)\))?([#>]) (.*)$' % re.escape(self.prompt))
def _command(self, command_str, timeout=10):
self.socket.send(command_str.encode())