Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Make header names and values extractable #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions explo/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def http_request(block, scope):

if cookies_path != '':
try:
cookie_module = cookies_path.split('.', 1)[0]
cookies = scope[cookie_module]['response']['cookies']
for cookie_module_path in cookies_path.split(',', -1):
cookie_module = cookie_module_path.split('.', 1)[0]
for k, v in scope[cookie_module]['response']['cookies'].items():
cookies[k] = v
except KeyError:
Message.log(
level='warning',
Expand All @@ -59,6 +61,9 @@ def http_request(block, scope):
for key, val in headers.items():
headers[key] = pystache.render(str(val), scope)

opts['url'] = pystache.render(str(opts['url']), scope)
opts['method'] = pystache.render(str(opts['method']), scope)

req = requests.Request(opts['method'], opts['url'], headers=headers, data=data, cookies=cookies)
request = req.prepare()

Expand Down
3 changes: 2 additions & 1 deletion explo/modules/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def execute(block, scope):
message="==> Found in HEADERS: '%s'" % color.cyan(keyword))

if 'extract' in opts:
scope[name]['extracted'] = extract(response.text, opts['extract'])
headers = '\r\n'.join([a+":"+b for a, b in response.headers.items()])
scope[name]['extracted'] = extract(headers+"\r\n\r\n"+response.text, opts['extract'])

if 'find' in opts:
keyword = opts['find']
Expand Down