From 92abba143d2b026a73e387aae49894890d6e685b Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sun, 13 Sep 2015 15:23:56 +0200 Subject: Adapt wifi interface monitoring to bytes. --- src/monitor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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""" -- cgit v1.2.1