mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 09:47:17 +00:00
237 lines
9.1 KiB
HTML
237 lines
9.1 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<title>AIL-Framework</title>
|
|
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png')}}">
|
|
<!-- Core CSS -->
|
|
<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/daterangepicker.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/tags.css') }}" rel="stylesheet">
|
|
|
|
<!-- JS -->
|
|
<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
|
<script src="{{ url_for('static', filename='js/popper.min.js')}}"></script>
|
|
<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
|
|
<script src="{{ url_for('static', filename='js/tags.js') }}"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
{% include 'nav_bar.html' %}
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
|
|
{% include 'hunter/menu_sidebar.html' %}
|
|
|
|
<div class="col-12 col-lg-10" id="core_content">
|
|
|
|
<div class="card my-3">
|
|
<div class="card-header bg-dark text-white">
|
|
<h5 class="card-title">Edit a Tracker</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<form action="{{ url_for('hunter.add_tracked_menu') }}" method='post'>
|
|
{%if dict_tracker%}
|
|
<input id="tracker_uuid" name="tracker_uuid" class="form-control" type="text" value="{{dict_tracker['uuid']}}" hidden>
|
|
{%endif%}
|
|
|
|
<div class="row">
|
|
<div class="col-12 col-xl-9">
|
|
<div class="input-group mb-2 mr-sm-2">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text bg-danger text-white"><i class="fas fa-tag"></i></div>
|
|
</div>
|
|
<input id="tags" name="tags" class="form-control" placeholder="Tags (optional, space separated)" type="text" {%if dict_tracker%}{%if dict_tracker['tags']%}value="{{dict_tracker['tags']}}"{%endif%}{%endif%}>
|
|
</div>
|
|
<div class="input-group mb-2 mr-sm-2">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text bg-secondary text-white"><i class="fas fa-at"></i></div>
|
|
</div>
|
|
<input id="mails" name="mails" class="form-control" placeholder="E-Mails Notification (optional, space separated)" type="text" {%if dict_tracker%}{%if dict_tracker['mails']%}value="{{dict_tracker['mails']}}"{%endif%}{%endif%}>
|
|
</div>
|
|
<div class="input-group mb-2 mr-sm-2">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text bg-info text-white"><i class="fas fa-pencil-alt"></i></div>
|
|
</div>
|
|
<input id="description" name="description" class="form-control" placeholder="Tracker Description (optional)" type="text" {%if dict_tracker%}{%if dict_tracker['description']%}value="{{dict_tracker['description']}}"{%endif%}{%endif%}>
|
|
</div>
|
|
|
|
<div class="input-group mb-2 mr-sm-2">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text bg-dark text-white"><i class="fas fa-folder"></i></div>
|
|
</div>
|
|
<input id="sources" class="form-control" type="text" name="sources" placeholder="Sources to track (ALL IF EMPTY)" autocomplete="off">
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-12 col-xl-3">
|
|
<div class="custom-control custom-switch mt-1">
|
|
<input class="custom-control-input" type="checkbox" name="level" id="id_level" {%if dict_tracker%}{%if dict_tracker['level']==1%}checked{%endif%}{%else%}checked{%endif%}>
|
|
<label class="custom-control-label" for="id_level">
|
|
<i class="fas fa-users"></i> Show tracker to all Users
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr>
|
|
<h4>Tracker Type:</h4>
|
|
|
|
<select id="tracker_type" name="tracker_type" class="custom-select w-25 mb-3">
|
|
<option disabled selected value> -- Select a tracker type -- </option>
|
|
<option value="word">Word</option>
|
|
<option value="set">Set</option>
|
|
<option value="regex">Regex</option>
|
|
<option value="yara">YARA rule</option>
|
|
</select>
|
|
|
|
<p id="tracker_desc">Terms to track (space separated)</p>
|
|
|
|
<div class="row" id="simple_input">
|
|
<div class="col-12 col-lg-10">
|
|
<input id="tracker" name="tracker" class="form-control" placeholder="Terms to track (space separated)" type="text" {%if dict_tracker%}{%if dict_tracker['tracker']!='yara'%}value="{{dict_tracker['tracker']}}"{%endif%}{%endif%}>
|
|
</div>
|
|
<div class="col-12 col-lg-2">
|
|
<input type="number" id="nb_word" name="nb_word" name="quantity" min="1" placeholder="Nb of keywords" {%if dict_tracker%}{%if dict_tracker['nb_words']%}value="{{dict_tracker['nb_words']}}"{%endif%}{%endif%}>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="mb-2" id="yara_rule">
|
|
<div class="" id="yara_default_rules">
|
|
|
|
<h6>Default YARA rules:</h6>
|
|
<select class="custom-select w-100 mb-3" id="yara_default_rule" name="yara_default_rule" onchange="get_default_rule_content(this);">
|
|
<option selected>Select a default rule</option>
|
|
{% for yara_types in all_yara_files %}
|
|
{% for yara_file_name in all_yara_files[yara_types] %}
|
|
<option value="{{yara_types}}/{{yara_file_name}}">{{yara_types}} - {{yara_file_name}}</option>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<pre class="border bg-light" id="default_yara_rule_content"></pre>
|
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<h6>Custom YARA rules:</h6>
|
|
<div class="row" id="textarea">
|
|
<textarea class="form-control mx-3" id="text_input" name="yara_custom_rule" placeholder="Enter your own YARA rule" rows="5">{%if dict_tracker%}{%if dict_tracker['type']=='yara' and dict_tracker['content']%}{{dict_tracker['content']}}{%endif%}{%endif%}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
<button class="btn btn-success mt-2">
|
|
<i class="fas fa-plus"></i> {%if dict_tracker%}Edit{%else%}Create{%endif%} Tracker
|
|
</button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
var ltags;
|
|
var chart = {};
|
|
$(document).ready(function(){
|
|
$("#page-Tracker").addClass("active");
|
|
$("#nav_manual_crawler").addClass("active");
|
|
$("#tracker_desc").hide();
|
|
$("#tracker").hide();
|
|
$("#nb_word").hide();
|
|
$("#yara_rule").hide();
|
|
|
|
sources = $('#sources').tagSuggest({
|
|
data: {{all_sources|safe}},
|
|
{%if dict_tracker%}{%if dict_tracker['sources']%}value: {{dict_tracker['sources']|safe}},{%endif%}{%endif%}
|
|
sortOrder: 'name',
|
|
maxDropHeight: 200,
|
|
name: 'sources',
|
|
emptyText: 'Sources to track (ALL IF EMPTY)',
|
|
});
|
|
|
|
$('#tracker_type').on('change', function() {
|
|
var tracker_type = this.value;
|
|
if (tracker_type=="word") {
|
|
$("#tracker_desc").text("Token to track. You need to use a regex if you want to use one of the following special characters [<>~!?@#$%^&*|()_-+={}\":;,.\'\n\r\t]/\\ ");
|
|
$("#tracker_desc").show();
|
|
$("#tracker").show();
|
|
$("#nb_word").hide();
|
|
$("#yara_rule").hide();
|
|
} else if (tracker_type=="set") {
|
|
$("#tracker_desc").text("Set of Terms to track (space separated). This tracker is used to check if an item contain one or more terms specified in a set. If an item contain NB unique terms (by default NB of unique keywords = 1), this tracker is triggered. You need to use a regex if you want to use one of the following special characters [<>~!?@#$%^&*|()_-+={}\":;,.\'\n\r\t]/\\ ");
|
|
$("#tracker_desc").show();
|
|
$("#tracker").show();
|
|
$("#nb_word").show();
|
|
$("#yara_rule").hide();
|
|
} else if (tracker_type=="regex") {
|
|
$("#tracker_desc").text("Enter a valid Python regex");
|
|
$("#tracker_desc").show();
|
|
$("#tracker").show();
|
|
$("#nb_word").hide();
|
|
$("#yara_rule").hide();
|
|
} else if (tracker_type=="yara") {
|
|
$("#tracker_desc").text("Select a default yara rule or create your own rule:");
|
|
$("#tracker_desc").show();
|
|
$("#tracker").hide();
|
|
$("#nb_word").hide();
|
|
$("#yara_rule").show();
|
|
}
|
|
});
|
|
|
|
{%if dict_tracker%}
|
|
$('#tracker_type').val('{{dict_tracker['type']}}').change();
|
|
|
|
{%if dict_tracker['type']=='yara' and dict_tracker['yara_file']%}
|
|
$('#yara_default_rule').val('{{dict_tracker['yara_file']}}').change();
|
|
{%endif%}
|
|
{%endif%}
|
|
|
|
});
|
|
|
|
function toggle_sidebar(){
|
|
if($('#nav_menu').is(':visible')){
|
|
$('#nav_menu').hide();
|
|
$('#side_menu').removeClass('border-right')
|
|
$('#side_menu').removeClass('col-lg-2')
|
|
$('#core_content').removeClass('col-lg-10')
|
|
}else{
|
|
$('#nav_menu').show();
|
|
$('#side_menu').addClass('border-right')
|
|
$('#side_menu').addClass('col-lg-2')
|
|
$('#core_content').addClass('col-lg-10')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function get_default_rule_content(selector){
|
|
var yara_name = selector.value
|
|
if (yara_name === "Select a default rule") {
|
|
jQuery("#default_yara_rule_content").text("")
|
|
} else {
|
|
$.getJSON("{{ url_for('hunter.get_default_yara_rule_content') }}?rule_name=" + yara_name,
|
|
function(data) {
|
|
jQuery("#default_yara_rule_content").text(data['content'])
|
|
});
|
|
}
|
|
}
|
|
|
|
</script>
|