mirror of https://github.com/CIRCL/lookyloo
new: Re-capture a URL and change parameters.
parent
51ae62f257
commit
dcfd9cc6a9
|
@ -754,6 +754,32 @@ def search():
|
||||||
return render_template('search.html')
|
return render_template('search.html')
|
||||||
|
|
||||||
|
|
||||||
|
def _prepare_capture_template(user_ua: str, predefined_url: Optional[str]=None):
|
||||||
|
user_agents: Dict[str, Any] = {}
|
||||||
|
if use_own_ua:
|
||||||
|
user_agents = get_user_agents('own_user_agents')
|
||||||
|
if not user_agents:
|
||||||
|
user_agents = get_user_agents()
|
||||||
|
# get most frequest UA that isn't a bot (yes, it is dirty.)
|
||||||
|
for ua in user_agents.pop('by_frequency'):
|
||||||
|
if 'bot' not in ua['useragent'].lower():
|
||||||
|
default_ua = ua
|
||||||
|
break
|
||||||
|
splash_up, message = splash_status()
|
||||||
|
if not splash_up:
|
||||||
|
flash(f'The capture module is not reachable ({message}).', 'error')
|
||||||
|
flash('The request will be enqueued, but capturing may take a while and require the administrator to wake up.', 'error')
|
||||||
|
return render_template('capture.html', user_agents=user_agents, default=default_ua,
|
||||||
|
max_depth=max_depth, personal_ua=user_ua,
|
||||||
|
predefined_url_to_capture=predefined_url)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/recapture/<string:tree_uuid>', methods=['GET'])
|
||||||
|
def recapture(tree_uuid: str):
|
||||||
|
cache = lookyloo.capture_cache(tree_uuid)
|
||||||
|
return _prepare_capture_template(user_ua=request.headers.get('User-Agent'), predefined_url=cache.url)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/capture', methods=['GET', 'POST'])
|
@app.route('/capture', methods=['GET', 'POST'])
|
||||||
def capture_web():
|
def capture_web():
|
||||||
if flask_login.current_user.is_authenticated:
|
if flask_login.current_user.is_authenticated:
|
||||||
|
@ -803,22 +829,8 @@ def capture_web():
|
||||||
perma_uuid = lookyloo.enqueue_capture(capture_query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
perma_uuid = lookyloo.enqueue_capture(capture_query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
||||||
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
||||||
|
|
||||||
user_agents: Dict[str, Any] = {}
|
# render template
|
||||||
if use_own_ua:
|
return _prepare_capture_template(user_ua=request.headers.get('User-Agent'))
|
||||||
user_agents = get_user_agents('own_user_agents')
|
|
||||||
if not user_agents:
|
|
||||||
user_agents = get_user_agents()
|
|
||||||
# get most frequest UA that isn't a bot (yes, it is dirty.)
|
|
||||||
for ua in user_agents.pop('by_frequency'):
|
|
||||||
if 'bot' not in ua['useragent'].lower():
|
|
||||||
default_ua = ua
|
|
||||||
break
|
|
||||||
splash_up, message = splash_status()
|
|
||||||
if not splash_up:
|
|
||||||
flash(f'The capture module is not reachable ({message}).', 'error')
|
|
||||||
flash('The request will be enqueued, but capturing may take a while and require the administrator to wake up.', 'error')
|
|
||||||
return render_template('capture.html', user_agents=user_agents, default=default_ua,
|
|
||||||
max_depth=max_depth, personal_ua=request.headers.get('User-Agent'))
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/cookies/<string:cookie_name>', methods=['GET'])
|
@app.route('/cookies/<string:cookie_name>', methods=['GET'])
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="url" class="col-sm-2 col-form-label">URL:</label>
|
<label for="url" class="col-sm-2 col-form-label">URL:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" class="form-control" name="url" id=url placeholder="URL to capture" required>
|
<input type="text" class="form-control" name="url" id=url
|
||||||
|
placeholder="URL to capture" value="{{predefined_url_to_capture}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,9 @@
|
||||||
<a href="#urlsInPageModal" data-remote="{{ url_for('urls_rendered_page', tree_uuid=tree_uuid) }}"
|
<a href="#urlsInPageModal" data-remote="{{ url_for('urls_rendered_page', tree_uuid=tree_uuid) }}"
|
||||||
data-toggle="modal" data-target="#urlsInPageModal" role="button">Run Subsequent Captures</a>
|
data-toggle="modal" data-target="#urlsInPageModal" role="button">Run Subsequent Captures</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ url_for('recapture', tree_uuid=tree_uuid) }}" role="button">Re-Capture URL</a>
|
||||||
|
</li>
|
||||||
{% if has_redirects %}
|
{% if has_redirects %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ url_for('redirects', tree_uuid=tree_uuid) }}" role="button">Download Redirects list</a>
|
<a href="{{ url_for('redirects', tree_uuid=tree_uuid) }}" role="button">Download Redirects list</a>
|
||||||
|
|
Loading…
Reference in New Issue