MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / get_cookie

Method get_cookie

thirdparty/bottle/bottle.py:1599–1615  ·  view source on GitHub ↗

Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), return a default value.

(self, key, default=None, secret=None, digestmod=hashlib.sha256)

Source from the content-addressed store, hash-verified

1597 return FormsDict((c.key, c.value) for c in cookies)
1598
1599 def get_cookie(self, key, default=None, secret=None, digestmod=hashlib.sha256):
1600 """ Return the content of a cookie. To read a `Signed Cookie`, the
1601 `secret` must match the one used to create the cookie (see
1602 :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing
1603 cookie or wrong signature), return a default value. """
1604 value = self.cookies.get(key)
1605 if secret:
1606 # See BaseResponse.set_cookie for details on signed cookies.
1607 if value and value.startswith('!') and '?' in value:
1608 sig, msg = map(tob, value[1:].split('?', 1))
1609 hash = hmac.new(tob(secret), msg, digestmod=digestmod).digest()
1610 if _lscmp(sig, base64.b64encode(hash)):
1611 dst = pickle.loads(base64.b64decode(msg))
1612 if dst and dst[0] == key:
1613 return dst[1]
1614 return default
1615 return value or default
1616
1617 @DictProperty('environ', 'bottle.request.query', read_only=True)
1618 def query(self):

Callers

nothing calls this directly

Calls 3

tobFunction · 0.85
_lscmpFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected