new: Allow to use user UA for capture

pull/136/head
Raphaël Vinot 2020-12-10 17:23:37 +01:00
parent 7e1ce67574
commit 0d2edb8ae3
2 changed files with 25 additions and 4 deletions

View File

@ -491,12 +491,16 @@ def capture_web():
else:
cookie_file = None
url = request.form.get('url')
if request.form.get('personal_ua') and request.headers.get('User-Agent'):
user_agent = request.headers.get('User-Agent')
else:
user_agent = request.form.get('user_agent')
if url:
depth: int = request.form.get('depth') if request.form.get('depth') else 1 # type: ignore
listing: bool = request.form.get('listing') if request.form.get('listing') else False # type: ignore
perma_uuid = lookyloo.capture(url=url, cookies_pseudofile=cookie_file,
depth=depth, listing=listing,
user_agent=request.form.get('user_agent'),
user_agent=user_agent,
referer=request.form.get('referer'), # type: ignore
os=request.form.get('os'), browser=request.form.get('browser'))
return redirect(url_for('tree', tree_uuid=perma_uuid))
@ -508,7 +512,8 @@ def capture_web():
if not user_agents:
user_agents = get_user_agents()
user_agents.pop('by_frequency')
return render_template('capture.html', user_agents=user_agents, max_depth=max_depth)
return render_template('capture.html', user_agents=user_agents,
max_depth=max_depth, personal_ua=request.headers.get('User-Agent'))
@app.route('/cookies/<string:cookie_name>', methods=['GET'])

View File

@ -14,7 +14,7 @@
<div class="form-group row">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input"type="checkbox" name="listing" checked="true"></input>
<input class="form-check-input" type="checkbox" name="listing" checked="true"></input>
<label for="listing" class="form-check-label">Display results on public page</label>
</div>
</div>
@ -54,7 +54,23 @@
</div>
<div class="dropdown-divider"></div>
<p><h5>Browser Configuration</h5></p>
<p style="font-size: x-large"><b>Browser Configuration</b> (Lookyloo uses an emulated browser for all captures)</p>
{% if personal_ua %}
<div class="form-group row">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="personal_ua"></input>
<label for="personal_ua" class="form-check-label">Tick the box to use the current user-agent of your own browser:</br>
{{ personal_ua }}
</label>
</div>
</div>
</div>
</br>
<div>Or pick the user agent of your choice:</div>
</br>
{% endif %}
<div class="form-group row">
<label for="os" class="col-sm-2 col-form-label">Operating System:</label>
<div class="col-sm-10">