diff options
author | Papoteur <papoteur@mageialinux-online.org> | 2015-09-13 15:23:56 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageialinux-online.org> | 2015-09-13 15:23:56 +0200 |
commit | 92abba143d2b026a73e387aae49894890d6e685b (patch) | |
tree | db64e04c42b2a6be9a4190b671345d9c5b39252d /src | |
parent | 1df93215d22705cd15bf5bac930f703b32469929 (diff) | |
download | net_monitor-92abba143d2b026a73e387aae49894890d6e685b.tar net_monitor-92abba143d2b026a73e387aae49894890d6e685b.tar.gz net_monitor-92abba143d2b026a73e387aae49894890d6e685b.tar.bz2 net_monitor-92abba143d2b026a73e387aae49894890d6e685b.tar.xz net_monitor-92abba143d2b026a73e387aae49894890d6e685b.zip |
Adapt wifi interface monitoring to bytes.
Diffstat (limited to 'src')
-rw-r--r-- | src/monitor.py | 8 |
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""" |