mirror of https://github.com/CIRCL/lookyloo
chg: Make categories admin only, use bootstrap5 classes in form
parent
fb50cddc8f
commit
8808e203ce
|
@ -661,6 +661,7 @@ def historical_lookups(tree_uuid: str) -> str | WerkzeugResponse | Response:
|
|||
|
||||
@app.route('/tree/<string:tree_uuid>/categories_capture/', defaults={'query': ''}, methods=['GET', 'POST'])
|
||||
@app.route('/tree/<string:tree_uuid>/categories_capture/<string:query>', methods=['GET'])
|
||||
@flask_login.login_required # type: ignore[misc]
|
||||
def categories_capture(tree_uuid: str, query: str) -> str | WerkzeugResponse | Response:
|
||||
if not enable_categorization:
|
||||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
|
@ -671,8 +672,8 @@ def categories_capture(tree_uuid: str, query: str) -> str | WerkzeugResponse | R
|
|||
categories = []
|
||||
possible_ctgs = {
|
||||
'legitimate': ["parking-page", "default-page", 'institution', 'captcha', 'authentication-form', 'adult-content', 'shop'],
|
||||
'malicious': ['clone', 'phishing', 'captcha', 'authentication-form', 'adult-content', 'shop'],
|
||||
'unclear': ['captcha', 'authentication-form', 'adult-content', 'shop']
|
||||
'malicious': ['clone', 'phishing', 'captcha', 'authentication-form', 'adult-content', 'shop'],
|
||||
'unclear': ['captcha', 'authentication-form', 'adult-content', 'shop']
|
||||
}
|
||||
if status in possible_ctgs.keys():
|
||||
lookyloo.categorize_capture(tree_uuid, status)
|
||||
|
@ -695,6 +696,7 @@ def categories_capture(tree_uuid: str, query: str) -> str | WerkzeugResponse | R
|
|||
|
||||
@app.route('/tree/<string:tree_uuid>/uncategorize/', defaults={'category': ''})
|
||||
@app.route('/tree/<string:tree_uuid>/uncategorize/<string:category>', methods=['GET'])
|
||||
@flask_login.login_required # type: ignore[misc]
|
||||
def uncategorize_capture(tree_uuid: str, category: str) -> str | WerkzeugResponse | Response:
|
||||
if not enable_categorization:
|
||||
return jsonify({'response': 'Categorization not enabled.'})
|
||||
|
@ -704,6 +706,7 @@ def uncategorize_capture(tree_uuid: str, category: str) -> str | WerkzeugRespons
|
|||
|
||||
@app.route('/tree/<string:tree_uuid>/categorize/', defaults={'category': ''})
|
||||
@app.route('/tree/<string:tree_uuid>/categorize/<string:category>', methods=['GET'])
|
||||
@flask_login.login_required # type: ignore[misc]
|
||||
def categorize_capture(tree_uuid: str, category: str) -> str | WerkzeugResponse | Response:
|
||||
if not enable_categorization:
|
||||
return jsonify({'response': 'Categorization not enabled.'})
|
||||
|
|
|
@ -484,7 +484,7 @@
|
|||
<div id="extra-menu" class="dropdown">
|
||||
<button class="dropbtn">Extras</button>
|
||||
<div id="extra-menu-content" class="dropdown-content">
|
||||
{% if enable_categorization %}
|
||||
{% if enable_categorization and current_user.is_authenticated %}
|
||||
<a href="#categoriesModal" data-remote="{{ url_for('categories_capture', tree_uuid=tree_uuid) }}"
|
||||
data-bs-toggle="modal" data-bs-target="#categoriesModal" role="button">Manage categories</a>
|
||||
{% endif %}
|
||||
|
@ -1109,47 +1109,70 @@
|
|||
... loading the categorization options ...
|
||||
</div>
|
||||
<p>
|
||||
<form id="fast-categories" class="fast-categories">
|
||||
<form role="form" id="fast-categories" class="fast-categories">
|
||||
<fieldset id="verification-status">
|
||||
<input type="radio" id="legitimate" name="verification-status" value="legitimate">
|
||||
<label for="legitimate">legitimate</label>
|
||||
<input type="radio" id="malicious" name="verification-status" value="malicious">
|
||||
<label for="malicious">malicious</label>
|
||||
<input type="radio" id="unclear" name="verification-status" value="unclear">
|
||||
<label for="unclear">unclear</label>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" id="legitimate" name="verification-status" value="legitimate">
|
||||
<label class="form-check-label" for="legitimate">legitimate</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" id="malicious" name="verification-status" value="malicious">
|
||||
<label class="form-check-label" for="malicious">malicious</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" id="unclear" name="verification-status" value="unclear" checked>
|
||||
<label class="form-check-label" for="unclear">unclear</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="content-categoies">
|
||||
|
||||
<p>Content Categories (Multiple Choices possible)</p>
|
||||
<fieldset id="legitimate-categories">
|
||||
<fieldset id="legitimate-categories" hidden>
|
||||
<p>Only if legitimate:</p>
|
||||
<input type="checkbox" id="parking-page" name="parking-page" value="parking-page">
|
||||
<label for="parking-page">parking-page</label><br>
|
||||
<input type="checkbox" id="default-page" name="default-page" value="default-page">
|
||||
<label for="default-page">default-page</label><br>
|
||||
<input type="checkbox" id="institution" name="institution" value="institution">
|
||||
<label for="institution">institution / company</label><br>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="parking-page" name="parking-page" value="parking-page">
|
||||
<label class="form-check-label" for="parking-page">parking-page</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="default-page" name="default-page" value="default-page">
|
||||
<label class="form-check-label" for="default-page">default-page</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="institution" name="institution" value="institution">
|
||||
<label class="form-check-label" for="institution">institution / company</label><br>
|
||||
</div>
|
||||
<!-- the name of the institution/company could be added here in the future, maybe with propositions
|
||||
<label for="institution-name">Enter the name of the institution/company:</label><br>
|
||||
<input type="text" id="institution-name" name="institution-name">
|
||||
-->
|
||||
</fieldset>
|
||||
<fieldset id="malicious-categories">
|
||||
<fieldset id="malicious-categories" hidden>
|
||||
<p>Only if malicious:</p>
|
||||
<input type="checkbox" id="clone" name="clone" value="clone">
|
||||
<label for="clone">clone</label><br>
|
||||
<input type="checkbox" id="phishing" name="phishing" value="phishing">
|
||||
<label for="phishing">phishing</label><br>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="clone" name="clone" value="clone">
|
||||
<label class="form-check-label" for="clone">clone</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="phishing" name="phishing" value="phishing">
|
||||
<label class="form-check-label" for="phishing">phishing</label><br>
|
||||
</div>
|
||||
</fieldset>
|
||||
<input type="checkbox" id="captcha" name="captcha" value="captcha">
|
||||
<label for="captcha">captcha</label><br>
|
||||
<input type="checkbox" id="authentication-form" name="authentication-form" value="authentication-form">
|
||||
<label for="authentication-form">authentication-form</label><br>
|
||||
<input type="checkbox" id="adult-content" name="adult-content" value="adult-content">
|
||||
<label for="adult-content">adult-content</label><br>
|
||||
<input type="checkbox" id="shop" name="shop" value="shop">
|
||||
<label for="shop">shop</label><br>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="captcha" name="captcha" value="captcha">
|
||||
<label class="form-check-label" for="captcha">captcha</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="authentication-form" name="authentication-form" value="authentication-form">
|
||||
<label class="form-check-label" for="authentication-form">authentication-form</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="adult-content" name="adult-content" value="adult-content">
|
||||
<label class="form-check-label" for="adult-content">adult-content</label><br>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="shop" name="shop" value="shop">
|
||||
<label class="form-check-label" for="shop">shop</label><br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label for="query" class="form-label">Category to search</label>
|
||||
|
|
Loading…
Reference in New Issue