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

Skip to content

Commit b4cf8b0

Browse files
committed
added switch --load-cookies
1 parent 4cfea96 commit b4cf8b0

5 files changed

Lines changed: 14 additions & 2 deletions

File tree

lib/core/option.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ def __urllib2Opener():
148148
handlers = [proxyHandler, authHandler, redirectHandler, rangeHandler]
149149

150150
if not conf.dropSetCookie:
151-
conf.cj = cookielib.LWPCookieJar()
151+
if not conf.loC:
152+
conf.cj = cookielib.CookieJar()
153+
else:
154+
conf.cj = cookielib.MozillaCookieJar()
155+
conf.cj.load(conf.loC)
156+
152157
handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
153158

154159
# Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"data": "string",
2727
"pDel": "string",
2828
"cookie": "string",
29+
"loC": "string",
2930
"cookieUrlencode": "boolean",
3031
"dropSetCookie": "boolean",
3132
"agent": "string",

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def cmdLineParser():
7373
request.add_option("--cookie", dest="cookie",
7474
help="HTTP Cookie header")
7575

76+
request.add_option("--load-cookies", dest="loC",
77+
help="File containing cookies in Netscape/wget format")
78+
7679
request.add_option("--cookie-urlencode", dest="cookieUrlencode",
7780
action="store_true",
7881
help="URL Encode generated cookie injections")

lib/utils/google.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Google:
3535

3636
def __init__(self, handlers):
3737
self._matches = []
38-
self._cj = cookielib.LWPCookieJar()
38+
self._cj = cookielib.CookieJar()
3939

4040
handlers.append(urllib2.HTTPCookieProcessor(self._cj))
4141

sqlmap.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ pDel =
4242
# HTTP Cookie header.
4343
cookie =
4444

45+
# File containing cookies in Netscape/wget format
46+
loC =
47+
4548
# URL-encode generated cookie injections.
4649
# Valid: True or False
4750
cookieUrlencode = False

0 commit comments

Comments
 (0)