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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
from packets import SMBHeader, SMBNegoData, SMBSessionData, SMBTreeConnectData, RAPNetServerEnum3Data, SMBTransRAPData
|
from packets import SMBHeader, SMBNegoData, SMBSessionData, SMBTreeConnectData, RAPNetServerEnum3Data, SMBTransRAPData
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
from packets import DNS_Ans
|
from packets import DNS_Ans
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import struct
|
import struct
|
||||||
import codecs
|
import codecs
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler, StreamRequestHandler
|
from socketserver import BaseRequestHandler, StreamRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import http.server as BaseHTTPServer
|
import http.server as BaseHTTPServer
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import codecs
|
import codecs
|
||||||
import struct
|
import struct
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -18,7 +18,7 @@ import random
|
||||||
import struct
|
import struct
|
||||||
import codecs
|
import codecs
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler, StreamRequestHandler
|
from socketserver import BaseRequestHandler, StreamRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
from SocketServer import BaseRequestHandler, StreamRequestHandler
|
||||||
|
|
|
@ -19,7 +19,7 @@ import struct
|
||||||
import re
|
import re
|
||||||
import ssl
|
import ssl
|
||||||
import codecs
|
import codecs
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import struct, re
|
import struct, re
|
||||||
import codecs
|
import codecs
|
||||||
from utils import *
|
from utils import *
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from utils import *
|
from utils import *
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
from socketserver import BaseRequestHandler
|
from socketserver import BaseRequestHandler
|
||||||
else:
|
else:
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -26,7 +26,7 @@ import codecs
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
def RandomChallenge():
|
def RandomChallenge():
|
||||||
if settings.Config.PY2OR3 is "PY3":
|
if settings.Config.PY2OR3 == "PY3":
|
||||||
if settings.Config.NumChal == "random":
|
if settings.Config.NumChal == "random":
|
||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
NumChal = b'%016x' % getrandbits(16 * 4)
|
NumChal = b'%016x' % getrandbits(16 * 4)
|
||||||
|
@ -107,7 +107,7 @@ def RespondToThisHost(ClientIp, Name):
|
||||||
return RespondToThisIP(ClientIp) and RespondToThisName(Name)
|
return RespondToThisIP(ClientIp) and RespondToThisName(Name)
|
||||||
|
|
||||||
def RespondWithIPAton():
|
def RespondWithIPAton():
|
||||||
if settings.Config.PY2OR3 is "PY2":
|
if settings.Config.PY2OR3 == "PY2":
|
||||||
if settings.Config.ExternalIP:
|
if settings.Config.ExternalIP:
|
||||||
return settings.Config.ExternalIPAton
|
return settings.Config.ExternalIPAton
|
||||||
else:
|
else:
|
||||||
|
@ -167,7 +167,7 @@ def DumpConfig(outfile, data):
|
||||||
|
|
||||||
def StructPython2or3(endian,data):
|
def StructPython2or3(endian,data):
|
||||||
#Python2...
|
#Python2...
|
||||||
if settings.Config.PY2OR3 is "PY2":
|
if settings.Config.PY2OR3 == "PY2":
|
||||||
return struct.pack(endian, len(data))
|
return struct.pack(endian, len(data))
|
||||||
#Python3...
|
#Python3...
|
||||||
else:
|
else:
|
||||||
|
@ -175,20 +175,20 @@ def StructPython2or3(endian,data):
|
||||||
|
|
||||||
def StructWithLenPython2or3(endian,data):
|
def StructWithLenPython2or3(endian,data):
|
||||||
#Python2...
|
#Python2...
|
||||||
if settings.Config.PY2OR3 is "PY2":
|
if settings.Config.PY2OR3 == "PY2":
|
||||||
return struct.pack(endian, data)
|
return struct.pack(endian, data)
|
||||||
#Python3...
|
#Python3...
|
||||||
else:
|
else:
|
||||||
return struct.pack(endian, data).decode('latin-1')
|
return struct.pack(endian, data).decode('latin-1')
|
||||||
|
|
||||||
def NetworkSendBufferPython2or3(data):
|
def NetworkSendBufferPython2or3(data):
|
||||||
if settings.Config.PY2OR3 is "PY2":
|
if settings.Config.PY2OR3 == "PY2":
|
||||||
return str(data)
|
return str(data)
|
||||||
else:
|
else:
|
||||||
return bytes(str(data), 'latin-1')
|
return bytes(str(data), 'latin-1')
|
||||||
|
|
||||||
def NetworkRecvBufferPython2or3(data):
|
def NetworkRecvBufferPython2or3(data):
|
||||||
if settings.Config.PY2OR3 is "PY2":
|
if settings.Config.PY2OR3 == "PY2":
|
||||||
return str(data)
|
return str(data)
|
||||||
else:
|
else:
|
||||||
return str(data.decode('latin-1'))
|
return str(data.decode('latin-1'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue