mirror of
https://github.com/lgandx/Responder.git
synced 2025-07-06 04:51:23 -07:00
python3.8 compability fix
This commit is contained in:
parent
691c44138c
commit
d6f4911eb4
13 changed files with 18 additions and 18 deletions
|
@ -16,7 +16,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
from packets import SMBHeader, SMBNegoData, SMBSessionData, SMBTreeConnectData, RAPNetServerEnum3Data, SMBTransRAPData
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
from packets import DNS_Ans
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import struct
|
||||
import codecs
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler, StreamRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
import urllib.parse as urlparse
|
||||
import http.server as BaseHTTPServer
|
||||
else:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import codecs
|
||||
import struct
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -18,7 +18,7 @@ import random
|
|||
import struct
|
||||
import codecs
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler, StreamRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
||||
|
|
|
@ -19,7 +19,7 @@ import struct
|
|||
import re
|
||||
import ssl
|
||||
import codecs
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import struct, re
|
||||
import codecs
|
||||
from utils import *
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from utils import *
|
||||
from base64 import b64decode
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
from socketserver import BaseRequestHandler
|
||||
else:
|
||||
from SocketServer import BaseRequestHandler
|
||||
|
|
12
utils.py
12
utils.py
|
@ -26,7 +26,7 @@ import codecs
|
|||
import struct
|
||||
|
||||
def RandomChallenge():
|
||||
if settings.Config.PY2OR3 is "PY3":
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
if settings.Config.NumChal == "random":
|
||||
from random import getrandbits
|
||||
NumChal = b'%016x' % getrandbits(16 * 4)
|
||||
|
@ -107,7 +107,7 @@ def RespondToThisHost(ClientIp, Name):
|
|||
return RespondToThisIP(ClientIp) and RespondToThisName(Name)
|
||||
|
||||
def RespondWithIPAton():
|
||||
if settings.Config.PY2OR3 is "PY2":
|
||||
if settings.Config.PY2OR3 == "PY2":
|
||||
if settings.Config.ExternalIP:
|
||||
return settings.Config.ExternalIPAton
|
||||
else:
|
||||
|
@ -167,7 +167,7 @@ def DumpConfig(outfile, data):
|
|||
|
||||
def StructPython2or3(endian,data):
|
||||
#Python2...
|
||||
if settings.Config.PY2OR3 is "PY2":
|
||||
if settings.Config.PY2OR3 == "PY2":
|
||||
return struct.pack(endian, len(data))
|
||||
#Python3...
|
||||
else:
|
||||
|
@ -175,20 +175,20 @@ def StructPython2or3(endian,data):
|
|||
|
||||
def StructWithLenPython2or3(endian,data):
|
||||
#Python2...
|
||||
if settings.Config.PY2OR3 is "PY2":
|
||||
if settings.Config.PY2OR3 == "PY2":
|
||||
return struct.pack(endian, data)
|
||||
#Python3...
|
||||
else:
|
||||
return struct.pack(endian, data).decode('latin-1')
|
||||
|
||||
def NetworkSendBufferPython2or3(data):
|
||||
if settings.Config.PY2OR3 is "PY2":
|
||||
if settings.Config.PY2OR3 == "PY2":
|
||||
return str(data)
|
||||
else:
|
||||
return bytes(str(data), 'latin-1')
|
||||
|
||||
def NetworkRecvBufferPython2or3(data):
|
||||
if settings.Config.PY2OR3 is "PY2":
|
||||
if settings.Config.PY2OR3 == "PY2":
|
||||
return str(data)
|
||||
else:
|
||||
return str(data.decode('latin-1'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue