Commit 8a388f4b authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): for old versions of python3, pyshark live-capture is buggy

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 00ef792d
...@@ -1185,12 +1185,22 @@ class Containerize(): ...@@ -1185,12 +1185,22 @@ class Containerize():
else: else:
return return
interfaces = [] interfaces = []
iInterfaces = ''
for name in networkNames.stdout.split('\n'): for name in networkNames.stdout.split('\n'):
if re.search('rfsim', name) is not None or re.search('l2sim', name) is not None: if re.search('rfsim', name) is not None or re.search('l2sim', name) is not None:
interfaces.append(name) interfaces.append(name)
iInterfaces += f'-i {name} '
ymlPath = self.yamlPath[0].split('/') ymlPath = self.yamlPath[0].split('/')
output_file = f'/tmp/capture_{ymlPath[1]}.pcap' output_file = f'/tmp/capture_{ymlPath[1]}.pcap'
self.tsharkStarted = True self.tsharkStarted = True
# On old systems (ubuntu 18), pyshark live-capture is buggy.
# Going back to old method
if sys.version_info < (3, 7):
cmd = f'nohup tshark -f "{capture_filter}" {iInterfaces} -w {output_file} > /tmp/tshark.log 2>&1 &'
myCmd = cls_cmd.LocalCmd()
myCmd.run(cmd, timeout=5, reportNonZero=False)
myCmd.close()
return
x = threading.Thread(target = self.LaunchPySharkCapture, args = (interfaces,capture_filter,output_file,)) x = threading.Thread(target = self.LaunchPySharkCapture, args = (interfaces,capture_filter,output_file,))
x.daemon = True x.daemon = True
x.start() x.start()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment