Verified Commit 54f35b4a authored by Martin Petráček's avatar Martin Petráček
Browse files

make all scripts python3 compatible

parent 0446dcb6
#!/usr/bin/env python2 #!/usr/bin/env python3
import fileinput import fileinput
import os, os.path import os, os.path
......
#!/usr/bin/env python2 #!/usr/bin/env python3
import os import os
import sys import sys
......
#!/usr/bin/env python2 #!/usr/bin/env python3
import os import os
import sys import sys
......
#!/usr/bin/env python2 #!/usr/bin/env python3
import fileinput import fileinput
import json import json
...@@ -130,17 +130,17 @@ logging.debug("Listening...") ...@@ -130,17 +130,17 @@ logging.debug("Listening...")
while True: while True:
try: try:
logging.debug('Getting data...') logging.debug('Getting data...')
line = conntrack.stdout.readline() line = conntrack.stdout.readline().decode()
if not line: if not line:
break break
line = string.strip(line) line = line.strip()
logging.debug(line) logging.debug(line)
if not line: if not line:
continue continue
skip = False
try: try:
data = json.loads(line) data = json.loads(line)
except: except ValueError:
logging.warn("Error decoding json")
continue continue
if 'ether' not in data.keys() or 'src' not in data['ether'].keys(): if 'ether' not in data.keys() or 'src' not in data['ether'].keys():
data['ether']={} data['ether']={}
......
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