#!/usr/bin/env python # This file is part of Responder, a network take-over set of tools # created and maintained by Laurent Gaffie. # email: laurent.gaffie@gmail.com # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import os import sys import re import logging import socket import time import settings import datetime import codecs import struct from calendar import timegm def RandomChallenge(): if settings.Config.PY2OR3 == "PY3": if settings.Config.NumChal == "random": from random import getrandbits NumChal = b'%016x' % getrandbits(16 * 4) Challenge = b'' for i in range(0, len(NumChal),2): Challenge += NumChal[i:i+2] return codecs.decode(Challenge, 'hex') else: return settings.Config.Challenge else: if settings.Config.NumChal == "random": from random import getrandbits NumChal = '%016x' % getrandbits(16 * 4) Challenge = '' for i in range(0, len(NumChal),2): Challenge += NumChal[i:i+2].decode("hex") return Challenge else: return settings.Config.Challenge def HTTPCurrentDate(): Date = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT') return Date def SMBTime(): dt = datetime.datetime.now() dt = dt.replace(tzinfo=None) if settings.Config.PY2OR3 == "PY3": return struct.pack("