mirror of https://github.com/CIRCL/lookyloo
fix: Properly pass the UA to splash
parent
36c856ef9b
commit
346f2d6ec3
|
@ -52,7 +52,8 @@ def submit():
|
||||||
@app.route('/scrape', methods=['GET', 'POST'])
|
@app.route('/scrape', methods=['GET', 'POST'])
|
||||||
def scrape_web():
|
def scrape_web():
|
||||||
if request.form.get('url'):
|
if request.form.get('url'):
|
||||||
perma_uuid = lookyloo.scrape(request.form.get('url'), request.form.get('depth'), request.form.get('listing'))
|
perma_uuid = lookyloo.scrape(url=request.form.get('url'), depth=request.form.get('depth'),
|
||||||
|
listing=request.form.get('listing'), user_agent=request.form.get('user_agent'))
|
||||||
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
||||||
user_agents = get_user_agents()
|
user_agents = get_user_agents()
|
||||||
user_agents.pop('by_frequency')
|
user_agents.pop('by_frequency')
|
||||||
|
|
|
@ -41,10 +41,9 @@
|
||||||
{% set outer_loop = loop %}
|
{% set outer_loop = loop %}
|
||||||
{% for browser, user_agents in browsers.items()%}
|
{% for browser, user_agents in browsers.items()%}
|
||||||
<div id="{{os.replace(' ', '_')}}_{{browser.replace(' ', '_')}}" class="style-sub-2" {% if not loop.first or not outer_loop.first %} style="display: none;"{%endif%}>
|
<div id="{{os.replace(' ', '_')}}_{{browser.replace(' ', '_')}}" class="style-sub-2" {% if not loop.first or not outer_loop.first %} style="display: none;"{%endif%}>
|
||||||
{% set ua_displayed = True %}
|
|
||||||
<select class="form-control" name="user_agent">
|
<select class="form-control" name="user_agent">
|
||||||
{% for user_agent in user_agents %}
|
{% for user_agent in user_agents %}
|
||||||
<option value="{{ user_agent }}">{{ user_agent }}</option>
|
<option value="{{ user_agent }}" >{{ user_agent }}</option>
|
||||||
{% endfor%}
|
{% endfor%}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,16 +60,27 @@
|
||||||
$("#os").change(function(){
|
$("#os").change(function(){
|
||||||
var os_name = $(this).find(":selected").val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
var os_name = $(this).find(":selected").val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
||||||
var first_browser_name = $("[id='" + os_name + "']").find('select option:first-child').val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
var first_browser_name = $("[id='" + os_name + "']").find('select option:first-child').val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
||||||
|
// Hide and disable everything
|
||||||
$(".style-sub-1").hide();
|
$(".style-sub-1").hide();
|
||||||
|
$(".style-sub-1 > select").attr('disabled', true);
|
||||||
$(".style-sub-2").hide();
|
$(".style-sub-2").hide();
|
||||||
|
$(".style-sub-2 > select").attr('disabled', true);
|
||||||
|
|
||||||
$("[id='" + os_name + "']").show();
|
$("[id='" + os_name + "']").show();
|
||||||
|
$("[id='" + os_name + "'] > select").removeAttr('disabled');
|
||||||
$("[id='" + os_name + '_' + first_browser_name + "']").show();
|
$("[id='" + os_name + '_' + first_browser_name + "']").show();
|
||||||
|
$("[id='" + os_name + '_' + first_browser_name + "'] > select").removeAttr('disabled');
|
||||||
});
|
});
|
||||||
$('select[name="browser"]').change(function(){
|
$('select[name="browser"]').change(function(){
|
||||||
var browser_name = $(this).find(":selected").val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
var browser_name = $(this).find(":selected").val().replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
||||||
var os_name = $(this).parent().attr("id").replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
var os_name = $(this).parent().attr("id").replace(/(:|\.|\[|\]|,|=)/g, "\\$1").replace(/ /g,"_");
|
||||||
|
|
||||||
|
// Hide what makes sense
|
||||||
$(".style-sub-2").hide();
|
$(".style-sub-2").hide();
|
||||||
|
$(".style-sub-2 > select").attr('disabled', true);
|
||||||
|
|
||||||
$("[id='" + os_name + '_' + browser_name + "']").show();
|
$("[id='" + os_name + '_' + browser_name + "']").show();
|
||||||
|
$("[id='" + os_name + '_' + browser_name + "'] > select").removeAttr('disabled');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue