Message ID | 1457083241-7492-18-git-send-email-janusz.dziedzic@tieto.com |
---|---|
State | Changes Requested |
Headers | show |
On Fri, Mar 04, 2016 at 10:20:33AM +0100, Janusz Dziedzic wrote: > Add debug support for Ctrl class. This is > useful for debuging purpose for UDP connection. While this may be useful for some debugging purposes, this would also unconditionally add logger.debug() calls for private information that may include passwords. I don't think this is appropriate since wpaspy.py can be used outside testing environment.
On 5 March 2016 at 15:50, Jouni Malinen <j@w1.fi> wrote: > On Fri, Mar 04, 2016 at 10:20:33AM +0100, Janusz Dziedzic wrote: >> Add debug support for Ctrl class. This is >> useful for debuging purpose for UDP connection. > > While this may be useful for some debugging purposes, this would also > unconditionally add logger.debug() calls for private information that > may include passwords. I don't think this is appropriate since wpaspy.py > can be used outside testing environment. > Yes, but added only for UDP path. While UDP CTRL (no encryption) should be used only for test purpose, will that be a problem? BR Janusz > -- > Jouni Malinen PGP id EFC895FA
On Sun, Mar 06, 2016 at 12:01:07PM +0100, Janusz Dziedzic wrote: > On 5 March 2016 at 15:50, Jouni Malinen <j@w1.fi> wrote: > > On Fri, Mar 04, 2016 at 10:20:33AM +0100, Janusz Dziedzic wrote: > >> Add debug support for Ctrl class. This is > >> useful for debuging purpose for UDP connection. > > > > While this may be useful for some debugging purposes, this would also > > unconditionally add logger.debug() calls for private information that > > may include passwords. I don't think this is appropriate since wpaspy.py > > can be used outside testing environment. > > > Yes, but added only for UDP path. While UDP CTRL (no encryption) > should be used only for test purpose, will that be a problem? One could claim so, but I'm not sure I really see the point of wpaspy having these debug prints with the contents of the messages for one of the mechanisms. Those debug prints are already in place in run-tests.py anyway.
On 7 March 2016 at 09:58, Jouni Malinen <j@w1.fi> wrote: > On Sun, Mar 06, 2016 at 12:01:07PM +0100, Janusz Dziedzic wrote: >> On 5 March 2016 at 15:50, Jouni Malinen <j@w1.fi> wrote: >> > On Fri, Mar 04, 2016 at 10:20:33AM +0100, Janusz Dziedzic wrote: >> >> Add debug support for Ctrl class. This is >> >> useful for debuging purpose for UDP connection. >> > >> > While this may be useful for some debugging purposes, this would also >> > unconditionally add logger.debug() calls for private information that >> > may include passwords. I don't think this is appropriate since wpaspy.py >> > can be used outside testing environment. >> > >> Yes, but added only for UDP path. While UDP CTRL (no encryption) >> should be used only for test purpose, will that be a problem? > > One could claim so, but I'm not sure I really see the point of wpaspy > having these debug prints with the contents of the messages for one of > the mechanisms. Those debug prints are already in place in run-tests.py > anyway. > Yes, I see they are in wpa_supplicant.py/hostapd.py. So, we don't need them in wpaspy.py > -- > Jouni Malinen PGP id EFC895FA
diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 30bb652..76ac785 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -10,7 +10,9 @@ import os import stat import socket import select +import logging +logger = logging.getLogger() counter = 0 class Ctrl: @@ -54,7 +56,7 @@ class Ctrl: self.cookie = reply self.port = port except: - print "connect exception ", path, str(port) + logger.debug("connect exception " + str(path) + "/" + str(port)) if self.s != None: self.s.close() raise @@ -79,12 +81,13 @@ class Ctrl: def request(self, cmd, timeout=10): if self.udp == True: + logger.debug(self.path + "/" + str(self.port) + " request: " + cmd) self.s.sendto(self.cookie + cmd, self.sockaddr) else: self.s.send(cmd) [r, w, e] = select.select([self.s], [], [], timeout) if r: - return self.s.recv(4096) + return self.recv() raise Exception("Timeout on waiting response") def attach(self): @@ -115,4 +118,6 @@ class Ctrl: def recv(self): res = self.s.recv(4096) + if self.udp == True: + logger.debug(self.path + "/" + str(self.port) + " recv: " + res) return res
Add debug support for Ctrl class. This is useful for debuging purpose for UDP connection. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- wpaspy/wpaspy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)