Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6fee63

Browse files
committed
Neutralizing time of cookie expiration (in case of --load-cookies)
1 parent ed5599f commit b6fee63

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/core/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3504,10 +3504,15 @@ def resetCookieJar(cookieJar):
35043504
handle, filename = tempfile.mkstemp(prefix="sqlmapcj-")
35053505
os.close(handle)
35063506

3507+
# Reference: http://www.hashbangcode.com/blog/netscape-http-cooke-file-parser-php-584.html
35073508
with open(filename, "w+b") as f:
35083509
f.write("%s\n" % NETSCAPE_FORMAT_HEADER_COOKIES)
35093510
for line in lines:
3510-
f.write("\n%s" % "\t".join(line.split()))
3511+
_ = line.split()
3512+
if len(_) == 7:
3513+
_[1]= "TRUE" # MozillaCookieJar expects TRUE here
3514+
_[4] = "9999999999" # The UNIX time that the variable will expire on
3515+
f.write("\n%s" % "\t".join(_))
35113516

35123517
cookieJar.filename = filename
35133518

0 commit comments

Comments
 (0)