diff options
author | Al Korgun <alkorgun@gmail.com> | 2013-10-21 07:51:10 +0400 |
---|---|---|
committer | Al Korgun <alkorgun@gmail.com> | 2013-10-21 07:51:10 +0400 |
commit | f2ab025fb03ec5cf66c8f7fd7958dad03ecf9b37 (patch) | |
tree | 21de315878789d31619024a674150ac1cb5d3a17 | |
parent | 9ce43fd2842899065707638d43f84372ed1ee750 (diff) |
quick fix for command "port"
-rw-r--r-- | expansions/dns/code.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/expansions/dns/code.py b/expansions/dns/code.py index 378be4b..84ab832 100644 --- a/expansions/dns/code.py +++ b/expansions/dns/code.py @@ -28,24 +28,24 @@ class expansion_temp(expansion): def command_port(self, stype, source, adress, disp): if adress: adress = adress.split() - if len(adress) != 2: + if len(adress) == 2: host, port = adress if port.isdigit(): - server = (host, int(port)) + server = (host.encode("idna"), int(port)) if ":" in host: flag = self.socket.AF_INET6 server = server.__add__((0, 0)) host = host.join(("[", "]")) else: flag = self.socket.AF_INET - sock = self.socket.socket(flag, socket.SOCK_STREAM) + sock = self.socket.socket(flag, self.socket.SOCK_STREAM) sock.settimeout(6) try: sock.connect(server) except: - result = "{0}:{1} is closed.".format(host, port) + answer = "{0}:{1} is closed.".format(host, port) else: - result = "{0}:{1} is opened.".format(host, port) + answer = "{0}:{1} is opened.".format(host, port) finally: sock.close() else: |