aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/monitor.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 2bd72e6..83732e7 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -82,9 +82,9 @@ class Monitor:
def wifi_ioctl(self, iface, func, arg=None):
"""Prepares some variables for wifi and runs ioctl"""
if not arg:
- data = (iface + '\0' * 32)[:32]
+ data = (iface.encode() + b'\0' * 32)[:32]
else:
- data = (iface + '\0' * 16)[:16] + arg
+ data = (iface.encode() + b'\0' * 16)[:16] + arg
try:
res = self.ioctl(func, data)
return res
@@ -113,11 +113,11 @@ class Monitor:
def wifi_get_essid(self, iface):
"""Get current essid for an interface"""
- buffer = array.array('c', '\0' * 16)
+ buffer = array.array('b', b'\0' * 16)
addr, length = buffer.buffer_info()
arg = struct.pack('Pi', addr, length)
self.wifi_ioctl(iface, self.SIOCGIWESSID, arg)
- return buffer.tostring().strip('\0')
+ return buffer.tobytes().strip(b'\0')
def wifi_get_mode(self, iface):
"""Get current mode from an interface"""