diff --git a/packets.py b/packets.py index ba6ce68..0aa86d2 100644 --- a/packets.py +++ b/packets.py @@ -19,6 +19,7 @@ import settings from base64 import b64decode, b64encode from odict import OrderedDict +from utils import HTTPCurrentDate # Packet class handling all packet generation (see odict.py). class Packet(): @@ -205,7 +206,7 @@ class IIS_Auth_401_Ans(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 401 Unauthorized\r\n"), ("ServerType", "Server: Microsoft-IIS/6.0\r\n"), - ("Date", "Date: Wed, 12 Sep 2012 13:06:55 GMT\r\n"), + ("Date", "Date: "+HTTPCurrentDate()+"\r\n"), ("Type", "Content-Type: text/html\r\n"), ("WWW-Auth", "WWW-Authenticate: NTLM\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), @@ -217,7 +218,7 @@ class IIS_Auth_Granted(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 200 OK\r\n"), ("ServerType", "Server: Microsoft-IIS/6.0\r\n"), - ("Date", "Date: Wed, 12 Sep 2012 13:06:55 GMT\r\n"), + ("Date", "Date: "+HTTPCurrentDate()+"\r\n"), ("Type", "Content-Type: text/html\r\n"), ("WWW-Auth", "WWW-Authenticate: NTLM\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), @@ -233,12 +234,11 @@ class IIS_NTLM_Challenge_Ans(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 401 Unauthorized\r\n"), ("ServerType", "Server: Microsoft-IIS/6.0\r\n"), - ("Date", "Date: Wed, 12 Sep 2012 13:06:55 GMT\r\n"), + ("Date", "Date: "+HTTPCurrentDate()+"\r\n"), ("Type", "Content-Type: text/html\r\n"), ("WWWAuth", "WWW-Authenticate: NTLM "), ("Payload", ""), ("Payload-CRLF", "\r\n"), - ("PoweredBy", "X-Powered-By: ASP.NC0CD7B7802C76736E9B26FB19BEB2D36290B9FF9A46EDDA5ET\r\n"), ("Len", "Content-Length: 0\r\n"), ("CRLF", "\r\n"), ]) @@ -250,7 +250,7 @@ class IIS_Basic_401_Ans(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 401 Unauthorized\r\n"), ("ServerType", "Server: Microsoft-IIS/6.0\r\n"), - ("Date", "Date: Wed, 12 Sep 2012 13:06:55 GMT\r\n"), + ("Date", "Date: "+HTTPCurrentDate()+"\r\n"), ("Type", "Content-Type: text/html\r\n"), ("WWW-Auth", "WWW-Authenticate: Basic realm=\"Authentication Required\"\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), @@ -265,7 +265,7 @@ class WPADScript(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 200 OK\r\n"), ("ServerTlype", "Server: Microsoft-IIS/6.0\r\n"), - ("Date", "Date: Wed, 12 Sep 2012 13:06:55 GMT\r\n"), + ("Date", "Date: "+HTTPCurrentDate()+"\r\n"), ("Type", "Content-Type: application/x-ns-proxy-autoconfig\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), ("ContentLen", "Content-Length: "), @@ -280,7 +280,7 @@ class ServeExeFile(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 200 OK\r\n"), ("ContentType", "Content-Type: application/octet-stream\r\n"), - ("LastModified", "Last-Modified: Wed, 24 Nov 2010 00:39:06 GMT\r\n"), + ("LastModified", "Last-Modified: "+HTTPCurrentDate()+"\r\n"), ("AcceptRanges", "Accept-Ranges: bytes\r\n"), ("Server", "Server: Microsoft-IIS/7.5\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), @@ -289,7 +289,7 @@ class ServeExeFile(Packet): ("FileCRLF", ";\r\n"), ("ContentLen", "Content-Length: "), ("ActualLen", "76"), - ("Date", "\r\nDate: Thu, 24 Oct 2013 22:35:46 GMT\r\n"), + ("Date", "\r\nDate: "+HTTPCurrentDate()+"\r\n"), ("Connection", "Connection: keep-alive\r\n"), ("X-CCC", "US\r\n"), ("X-CID", "2\r\n"), @@ -303,13 +303,13 @@ class ServeHtmlFile(Packet): fields = OrderedDict([ ("Code", "HTTP/1.1 200 OK\r\n"), ("ContentType", "Content-Type: text/html\r\n"), - ("LastModified", "Last-Modified: Wed, 24 Nov 2010 00:39:06 GMT\r\n"), + ("LastModified", "Last-Modified: "+HTTPCurrentDate()+"\r\n"), ("AcceptRanges", "Accept-Ranges: bytes\r\n"), ("Server", "Server: Microsoft-IIS/7.5\r\n"), ("PoweredBy", "X-Powered-By: ASP.NET\r\n"), ("ContentLen", "Content-Length: "), ("ActualLen", "76"), - ("Date", "\r\nDate: Thu, 24 Oct 2013 22:35:46 GMT\r\n"), + ("Date", "\r\nDate: "+HTTPCurrentDate()+"\r\n"), ("Connection", "Connection: keep-alive\r\n"), ("CRLF", "\r\n"), ("Payload", "jj"), diff --git a/utils.py b/utils.py index 1930a4e..e124a16 100644 --- a/utils.py +++ b/utils.py @@ -21,7 +21,11 @@ import logging import socket import time import settings +import datetime +def HTTPCurrentDate(): + Date = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT') + return Date try: import sqlite3 except: