2019-08-14 07:44:49 +00:00
<!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" >
2021-06-18 13:23:18 +00:00
< link href = "{{ url_for('static', filename='css/tags.css') }}" rel = "stylesheet" >
2019-08-14 07:44:49 +00:00
<!-- 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 >
2021-06-18 13:23:18 +00:00
< script src = "{{ url_for('static', filename='js/tags.js') }}" > < / script >
2019-08-14 07:44:49 +00:00
< / head >
< body >
{% include 'nav_bar.html' %}
< div class = "container-fluid" >
< div class = "row" >
2019-09-11 13:33:04 +00:00
{% include 'hunter/menu_sidebar.html' %}
2019-08-14 07:44:49 +00:00
< div class = "col-12 col-lg-10" id = "core_content" >
2020-12-08 15:47:55 +00:00
< div class = "card my-3" >
< div class = "card-header bg-dark text-white" >
2021-09-29 14:17:08 +00:00
< h5 class = "card-title" > {%if dict_tracker%}Edit a{%else%}Create a new{%endif%} Tracker< / h5 >
2019-08-14 07:44:49 +00:00
< / div >
< div class = "card-body" >
2019-09-11 13:33:04 +00:00
< form action = "{{ url_for('hunter.add_tracked_menu') }}" method = 'post' >
2020-12-08 15:47:55 +00:00
{%if dict_tracker%}
< input id = "tracker_uuid" name = "tracker_uuid" class = "form-control" type = "text" value = "{{dict_tracker['uuid']}}" hidden >
{%endif%}
2019-08-14 07:44:49 +00:00
< div class = "row" >
< div class = "col-12 col-xl-9" >
< div class = "input-group mb-2 mr-sm-2" >
2021-09-28 18:31:19 +00:00
< div class = "input-group-prepend" -- >
2020-12-08 15:47:55 +00:00
< div class = "input-group-text bg-danger text-white" > < i class = "fas fa-tag" > < / i > < / div >
2019-08-14 07:44:49 +00:00
< / div >
2020-12-08 15:47:55 +00:00
< 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 % } >
2019-08-14 07:44:49 +00:00
< / div >
< div class = "input-group mb-2 mr-sm-2" >
< div class = "input-group-prepend" >
2020-12-08 15:47:55 +00:00
< div class = "input-group-text bg-secondary text-white" > < i class = "fas fa-at" > < / i > < / div >
2019-08-14 07:44:49 +00:00
< / div >
2020-12-08 15:47:55 +00:00
< 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 % } >
2021-09-28 18:31:19 +00:00
< / div >
< div class = "input-group mb-2 mr-sm-2" >
< div class = "input-group-prepend" >
2021-09-28 18:48:47 +00:00
< div class = "input-group-text bg-info text-white" > < i class = "fas fa-anchor" > < / i > < / div >
2021-09-28 18:31:19 +00:00
< / div >
< input id = "webhook" name = "webhook" class = "form-control" placeholder = "Webhook URL" type = "text" { % if dict_tracker % } { % if dict_tracker [ ' webhook ' ] % } value = "{{dict_tracker['webhook']}}" { % endif % } { % endif % } >
2019-09-13 14:33:34 +00:00
< / div >
< div class = "input-group mb-2 mr-sm-2" >
< div class = "input-group-prepend" >
2020-12-08 15:47:55 +00:00
< div class = "input-group-text bg-info text-white" > < i class = "fas fa-pencil-alt" > < / i > < / div >
2019-09-13 14:33:34 +00:00
< / div >
2020-12-08 15:47:55 +00:00
< 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 % } >
2019-08-14 07:44:49 +00:00
< / div >
2021-06-18 13:23:18 +00:00
2021-06-21 15:25:12 +00:00
< 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 >
2019-08-14 07:44:49 +00:00
< / div >
< div class = "col-12 col-xl-3" >
< div class = "custom-control custom-switch mt-1" >
2020-12-08 15:47:55 +00:00
< 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 % } >
2019-08-14 07:44:49 +00:00
< label class = "custom-control-label" for = "id_level" >
< i class = "fas fa-users" > < / i > Show tracker to all Users
< / label >
< / div >
< / div >
< / div >
< hr >
2020-12-08 15:47:55 +00:00
< h4 > Tracker Type:< / h4 >
2019-08-14 07:44:49 +00:00
< 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 >
2020-08-12 07:28:36 +00:00
< option value = "yara" > YARA rule< / option >
2019-08-14 07:44:49 +00:00
< / select >
< p id = "tracker_desc" > Terms to track (space separated)< / p >
2020-08-12 07:28:36 +00:00
< div class = "row" id = "simple_input" >
2019-08-14 07:44:49 +00:00
< div class = "col-12 col-lg-10" >
2020-12-08 15:47:55 +00:00
< 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 % } >
2019-08-14 07:44:49 +00:00
< / div >
< div class = "col-12 col-lg-2" >
2020-12-08 15:47:55 +00:00
< 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 % } >
2019-08-14 07:44:49 +00:00
< / div >
< / div >
2020-09-03 14:33:10 +00:00
< div class = "mb-2" id = "yara_rule" >
2020-08-12 07:28:36 +00:00
< div class = "" id = "yara_default_rules" >
2020-12-08 15:47:55 +00:00
< 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);" >
2020-08-12 07:28:36 +00:00
< option selected > Select a default rule< / option >
{% for yara_types in all_yara_files %}
2020-12-08 15:47:55 +00:00
{% for yara_file_name in all_yara_files[yara_types] %}
< option value = "{{yara_types}}/{{yara_file_name}}" > {{yara_types}} - {{yara_file_name}}< / option >
2020-08-12 07:28:36 +00:00
{% endfor %}
{% endfor %}
< / select >
2020-09-03 14:33:10 +00:00
< pre class = "border bg-light" id = "default_yara_rule_content" > < / pre >
2020-08-12 07:28:36 +00:00
< / div >
2020-09-03 14:33:10 +00:00
< hr >
2020-12-08 15:47:55 +00:00
< h6 > Custom YARA rules:< / h6 >
2020-09-03 14:33:10 +00:00
< div class = "row" id = "textarea" >
2020-12-08 15:47:55 +00:00
< 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 >
2020-09-03 14:33:10 +00:00
< / div >
2020-08-12 07:28:36 +00:00
< / div >
2019-08-14 07:44:49 +00:00
< br >
< button class = "btn btn-success mt-2" >
2020-12-08 15:47:55 +00:00
< i class = "fas fa-plus" > < / i > {%if dict_tracker%}Edit{%else%}Create{%endif%} Tracker
2019-08-14 07:44:49 +00:00
< / button >
< / form >
< / div >
< / div >
< / div >
< / div >
< / div >
< / body >
< script >
2021-06-18 13:23:18 +00:00
var ltags;
2019-08-14 07:44:49 +00:00
var chart = {};
$(document).ready(function(){
2019-09-13 09:06:41 +00:00
$("#page-Tracker").addClass("active");
2019-08-14 07:44:49 +00:00
$("#nav_manual_crawler").addClass("active");
$("#tracker_desc").hide();
2020-12-08 15:47:55 +00:00
$("#tracker").hide();
2019-08-14 07:44:49 +00:00
$("#nb_word").hide();
2020-08-13 13:15:08 +00:00
$("#yara_rule").hide();
2019-08-14 07:44:49 +00:00
2021-06-18 13:23:18 +00:00
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)',
});
2019-08-14 07:44:49 +00:00
$('#tracker_type').on('change', function() {
var tracker_type = this.value;
if (tracker_type=="word") {
2019-09-13 09:06:41 +00:00
$("#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]/\\ ");
2019-08-14 07:44:49 +00:00
$("#tracker_desc").show();
2020-12-08 15:47:55 +00:00
$("#tracker").show();
2019-08-14 07:44:49 +00:00
$("#nb_word").hide();
2020-08-13 13:15:08 +00:00
$("#yara_rule").hide();
2019-08-14 07:44:49 +00:00
} else if (tracker_type=="set") {
2019-09-13 09:06:41 +00:00
$("#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]/\\ ");
2019-08-14 07:44:49 +00:00
$("#tracker_desc").show();
2020-12-08 15:47:55 +00:00
$("#tracker").show();
2019-08-14 07:44:49 +00:00
$("#nb_word").show();
2020-08-13 13:15:08 +00:00
$("#yara_rule").hide();
} else if (tracker_type=="regex") {
2019-09-12 12:00:44 +00:00
$("#tracker_desc").text("Enter a valid Python regex");
2019-08-14 07:44:49 +00:00
$("#tracker_desc").show();
2020-12-08 15:47:55 +00:00
$("#tracker").show();
2019-08-14 07:44:49 +00:00
$("#nb_word").hide();
2020-08-13 13:15:08 +00:00
$("#yara_rule").hide();
} else if (tracker_type=="yara") {
$("#tracker_desc").text("Select a default yara rule or create your own rule:");
$("#tracker_desc").show();
2020-12-08 15:47:55 +00:00
$("#tracker").hide();
2020-08-13 13:15:08 +00:00
$("#nb_word").hide();
$("#yara_rule").show();
2019-08-14 07:44:49 +00:00
}
});
2020-12-08 15:47:55 +00:00
{%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%}
2019-08-14 07:44:49 +00:00
});
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')
}
}
2020-09-03 14:33:10 +00:00
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'])
});
}
}
2019-08-14 07:44:49 +00:00
< / script >