From b6fee638ef04b69cbc906537e5f7ca6f6c0cec34 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 14 Apr 2013 01:13:08 +0200 Subject: [PATCH] Neutralizing time of cookie expiration (in case of --load-cookies) --- lib/core/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/common.py b/lib/core/common.py index 31bcc2058..935f4d10b 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -3504,10 +3504,15 @@ def resetCookieJar(cookieJar): handle, filename = tempfile.mkstemp(prefix="sqlmapcj-") os.close(handle) + # Reference: http://www.hashbangcode.com/blog/netscape-http-cooke-file-parser-php-584.html with open(filename, "w+b") as f: f.write("%s\n" % NETSCAPE_FORMAT_HEADER_COOKIES) for line in lines: - f.write("\n%s" % "\t".join(line.split())) + _ = line.split() + if len(_) == 7: + _[1]= "TRUE" # MozillaCookieJar expects TRUE here + _[4] = "9999999999" # The UNIX time that the variable will expire on + f.write("\n%s" % "\t".join(_)) cookieJar.filename = filename