2018-03-15 13:22:08 +00:00
|
|
|
From 3c4c7340e455b7256c0786759422f34ec3e2d440 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
|
Date: Thu, 15 Mar 2018 14:49:56 +0100
|
2018-10-31 09:49:24 +00:00
|
|
|
Subject: [PATCH] tests/{negtelnet,smb}server.py: migrate to Python 3
|
2018-03-15 13:22:08 +00:00
|
|
|
|
|
|
|
Unfortunately, smbserver.py does not work with Python 3 because
|
|
|
|
there is no 'impacket' module available for Python 3:
|
|
|
|
|
|
|
|
https://github.com/CoreSecurity/impacket/issues/61
|
|
|
|
---
|
2018-10-31 09:49:24 +00:00
|
|
|
tests/negtelnetserver.py | 4 ++--
|
|
|
|
tests/smbserver.py | 4 ++--
|
|
|
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
2018-03-15 13:22:08 +00:00
|
|
|
|
|
|
|
diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py
|
|
|
|
index 8cfd409..72ee771 100755
|
|
|
|
--- a/tests/negtelnetserver.py
|
|
|
|
+++ b/tests/negtelnetserver.py
|
|
|
|
@@ -73,11 +73,11 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler):
|
2018-10-31 09:49:24 +00:00
|
|
|
response_data = response.encode('ascii')
|
2018-03-15 13:22:08 +00:00
|
|
|
else:
|
|
|
|
log.debug("Received normal request - echoing back")
|
|
|
|
- response_data = data.strip()
|
|
|
|
+ response_data = data.decode('utf8').strip()
|
|
|
|
|
|
|
|
if response_data:
|
|
|
|
log.debug("Sending %r", response_data)
|
|
|
|
- self.request.sendall(response_data)
|
|
|
|
+ self.request.sendall(response_data.encode('utf8'))
|
|
|
|
|
|
|
|
except IOError:
|
|
|
|
log.exception("IOError hit during request")
|
|
|
|
diff --git a/tests/smbserver.py b/tests/smbserver.py
|
|
|
|
index 195ae39..b09cd44 100755
|
|
|
|
--- a/tests/smbserver.py
|
|
|
|
+++ b/tests/smbserver.py
|
|
|
|
@@ -24,7 +24,7 @@
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
# unicode_literals)
|
|
|
|
import argparse
|
|
|
|
-import ConfigParser
|
|
|
|
+import configparser
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
@@ -58,7 +58,7 @@ def smbserver(options):
|
|
|
|
f.write("{0}".format(pid))
|
|
|
|
|
|
|
|
# Here we write a mini config for the server
|
|
|
|
- smb_config = ConfigParser.ConfigParser()
|
|
|
|
+ smb_config = configparser.ConfigParser()
|
|
|
|
smb_config.add_section("global")
|
|
|
|
smb_config.set("global", "server_name", "SERVICE")
|
|
|
|
smb_config.set("global", "server_os", "UNIX")
|
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|