mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
galaxies synonyms
This commit is contained in:
parent
f3f6b76428
commit
dbe67e094b
12 changed files with 313 additions and 126 deletions
|
@ -58,7 +58,18 @@ def get_all_tags():
|
|||
|
||||
list_tags = []
|
||||
for tag in all_tags:
|
||||
list_tags.append( tag )
|
||||
t = tag.split(':')[0]
|
||||
# add synonym
|
||||
str_synonyms = ' - synonyms: '
|
||||
if t == 'misp-galaxy':
|
||||
synonyms = r_serv_tags.smembers('synonym_tag_' + tag)
|
||||
for synonym in synonyms:
|
||||
str_synonyms = str_synonyms + synonym + ', '
|
||||
# add real tag
|
||||
if str_synonyms != ' - synonyms: ':
|
||||
list_tags.append({'name':tag + str_synonyms,'id':tag})
|
||||
else:
|
||||
list_tags.append({'name':tag,'id':tag})
|
||||
|
||||
return jsonify(list_tags)
|
||||
|
||||
|
@ -79,6 +90,28 @@ def get_all_tags_taxonomies():
|
|||
|
||||
return jsonify(list_tags)
|
||||
|
||||
@Tags.route("/Tags/get_all_tags_galaxies")
|
||||
def get_all_tags_galaxy():
|
||||
|
||||
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
||||
|
||||
list_tags = []
|
||||
for galaxy in active_galaxies:
|
||||
l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy)
|
||||
for tag in l_tags:
|
||||
str_synonyms = ' - synonyms: '
|
||||
synonyms = r_serv_tags.smembers('synonym_tag_' + tag)
|
||||
# synonyms to display
|
||||
for synonym in synonyms:
|
||||
str_synonyms = str_synonyms + synonym + ', '
|
||||
# add real tag
|
||||
if str_synonyms != ' - synonyms: ':
|
||||
list_tags.append({'name':tag + str_synonyms,'id':tag})
|
||||
else:
|
||||
list_tags.append({'name':tag,'id':tag})
|
||||
|
||||
return jsonify(list_tags)
|
||||
|
||||
@Tags.route("/Tags/get_tags_taxonomie")
|
||||
def get_tags_taxonomie():
|
||||
|
||||
|
@ -102,10 +135,38 @@ def get_tags_taxonomie():
|
|||
return jsonify(list_tags)
|
||||
|
||||
else:
|
||||
return 'this taxinomie is disable'
|
||||
return 'this taxonomie is disable'
|
||||
else:
|
||||
return 'INCORRECT INPUT'
|
||||
|
||||
@Tags.route("/Tags/get_tags_galaxy")
|
||||
def get_tags_galaxy():
|
||||
|
||||
galaxy = request.args.get('galaxy')
|
||||
|
||||
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
||||
|
||||
#verify input
|
||||
if galaxy in active_galaxies:
|
||||
|
||||
list_tags = []
|
||||
l_tags = r_serv_tags.smembers('active_tag_galaxies_' + galaxy)
|
||||
for tag in l_tags:
|
||||
synonyms = r_serv_tags.smembers('synonym_tag_' + tag)
|
||||
str_synonyms = ' - synonyms: '
|
||||
for synonym in synonyms:
|
||||
str_synonyms = str_synonyms + synonym + ', '
|
||||
# add real tag
|
||||
if str_synonyms != ' - synonyms: ':
|
||||
list_tags.append({'name':tag + str_synonyms,'id':tag})
|
||||
else:
|
||||
list_tags.append({'name':tag,'id':tag})
|
||||
|
||||
return jsonify(list_tags)
|
||||
|
||||
else:
|
||||
return 'this galaxy is disable'
|
||||
|
||||
|
||||
@Tags.route("/Tags/get_tagged_paste")
|
||||
def get_tagged_paste():
|
||||
|
@ -140,7 +201,6 @@ def get_tagged_paste():
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
all_content = []
|
||||
paste_date = []
|
||||
|
@ -209,6 +269,9 @@ def remove_tag():
|
|||
r_serv_metadata.srem('tag:'+path, tag)
|
||||
r_serv_tags.srem(tag, path)
|
||||
|
||||
if r_serv_tags.scard(tag) == 0:
|
||||
r_serv_tags.srem('list_tags', tag)
|
||||
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
|
||||
@Tags.route("/Tags/confirm_tag")
|
||||
|
@ -239,80 +302,60 @@ def confirm_tag():
|
|||
def addTags():
|
||||
|
||||
tags = request.args.get('tags')
|
||||
tagsgalaxies = request.args.get('tagsgalaxies')
|
||||
path = request.args.get('path')
|
||||
|
||||
list_tag = tags.split(',')
|
||||
list_tag_galaxies = tagsgalaxies.split(',')
|
||||
|
||||
taxonomies = Taxonomies()
|
||||
active_taxonomies = r_serv_tags.smembers('active_taxonomies')
|
||||
|
||||
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
||||
|
||||
if not path:
|
||||
return 'INCORRECT INPUT'
|
||||
return 'INCORRECT INPUT0'
|
||||
|
||||
for tag in list_tag:
|
||||
# verify input
|
||||
tax = tag.split(':')[0]
|
||||
if tax in active_taxonomies:
|
||||
if tag in r_serv_tags.smembers('active_tag_' + tax):
|
||||
if list_tag != ['']:
|
||||
for tag in list_tag:
|
||||
# verify input
|
||||
tax = tag.split(':')[0]
|
||||
if tax in active_taxonomies:
|
||||
if tag in r_serv_tags.smembers('active_tag_' + tax):
|
||||
|
||||
#add tag
|
||||
r_serv_metadata.sadd('tag:'+path, tag)
|
||||
r_serv_tags.sadd(tag, path)
|
||||
#add new tag in list of all used tags
|
||||
r_serv_tags.sadd('list_tags', tag)
|
||||
#add tag
|
||||
r_serv_metadata.sadd('tag:'+path, tag)
|
||||
r_serv_tags.sadd(tag, path)
|
||||
#add new tag in list of all used tags
|
||||
r_serv_tags.sadd('list_tags', tag)
|
||||
|
||||
else:
|
||||
return 'INCORRECT INPUT1'
|
||||
else:
|
||||
return 'INCORRECT INPUT'
|
||||
else:
|
||||
return 'INCORRECT INPUT'
|
||||
return 'INCORRECT INPUT2'
|
||||
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
if list_tag_galaxies != ['']:
|
||||
for tag in list_tag_galaxies:
|
||||
# verify input
|
||||
gal = tag.split(':')[1]
|
||||
gal = gal.split('=')[0]
|
||||
print(tag)
|
||||
print(gal)
|
||||
print(active_galaxies)
|
||||
if gal in active_galaxies:
|
||||
if tag in r_serv_tags.smembers('active_tag_galaxies_' + gal):
|
||||
|
||||
@Tags.route("/Tags/thumbs_up_paste")
|
||||
def thumbs_up_paste():
|
||||
print('adding ...')
|
||||
#add tag
|
||||
r_serv_metadata.sadd('tag:'+path, tag)
|
||||
r_serv_tags.sadd(tag, path)
|
||||
#add new tag in list of all used tags
|
||||
r_serv_tags.sadd('list_tags', tag)
|
||||
|
||||
#TODO verify input
|
||||
path = request.args.get('paste')
|
||||
|
||||
'''positive_t = 'infoleak:confirmed="true-positive"'
|
||||
positive_f = 'infoleak:confirmed="false-positive"'
|
||||
|
||||
negative_t = 'infoleak:confirmed="true-negative"'
|
||||
|
||||
list_tags = r_serv_metadata.smembers('tag:'+path)
|
||||
|
||||
if(list_tags > 0):
|
||||
|
||||
if positive_f in list_tags:
|
||||
r_serv_metadata.srem('tag:'+path, positive_f)
|
||||
r_serv_metadata.sadd('tag:'+path, positive_t)
|
||||
|
||||
r_serv_tags.srem(positive_f, path)
|
||||
r_serv_tags.sadd(positive_t, path)
|
||||
#add new tag in list of all used tags
|
||||
r_serv_tags.sadd('list_tags', positive_t)
|
||||
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
|
||||
|
||||
|
||||
if positive_t in list_tags:
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
else:
|
||||
r_serv_metadata.sadd('tag:'+path, negative_t)
|
||||
r_serv_tags.sadd(negative_t, path)
|
||||
#add new tag in list of all used tags
|
||||
r_serv_tags.sadd('list_tags', negative_t)'''
|
||||
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
|
||||
@Tags.route("/Tags/thumbs_down_paste")
|
||||
def thumbs_down_paste():
|
||||
|
||||
#TODO verify input
|
||||
path = request.args.get('paste')
|
||||
|
||||
'''list_tags = r_serv_metadata.smembers('tag:'+path)'''
|
||||
else:
|
||||
return 'INCORRECT INPUT3'
|
||||
else:
|
||||
return 'INCORRECT INPUT4'
|
||||
|
||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
||||
|
||||
|
@ -397,10 +440,6 @@ def edit_taxonomie():
|
|||
else:
|
||||
return 'INVALID TAXONOMIE'
|
||||
|
||||
@Tags.route("/Tags/test")
|
||||
def test():
|
||||
return 'test',
|
||||
|
||||
@Tags.route("/Tags/disable_taxonomie")
|
||||
def disable_taxonomie():
|
||||
|
||||
|
@ -615,6 +654,32 @@ def active_galaxy():
|
|||
for tag in l_tags:
|
||||
r_serv_tags.sadd('active_tag_galaxies_' + id, 'misp-galaxy:{}="{}"'.format(id, tag))
|
||||
|
||||
#save synonyms
|
||||
for clusters_json in list_clusters:
|
||||
|
||||
#get clusters
|
||||
cluster = json.loads(clusters_json)
|
||||
|
||||
if cluster['type'] == id:
|
||||
|
||||
val = cluster['values']
|
||||
|
||||
tags = []
|
||||
for data in val:
|
||||
try:
|
||||
meta = data['meta']
|
||||
synonyms = meta['synonyms']
|
||||
tag_name = data['value']
|
||||
tag_name = 'misp-galaxy:{}="{}"'.format(id, tag_name)
|
||||
#save synonyms
|
||||
for synonym in synonyms:
|
||||
r_serv_tags.sadd('synonym_tag_' + tag_name, synonym)
|
||||
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
break
|
||||
|
||||
return redirect(url_for('Tags.galaxies'))
|
||||
|
||||
|
||||
|
@ -631,7 +696,9 @@ def disable_galaxy():
|
|||
|
||||
r_serv_tags.srem('active_galaxies', id)
|
||||
for tag in l_tags:
|
||||
r_serv_tags.srem('active_tag_galaxies_' + id, 'misp-galaxy:{}="{}"'.format(id, tag))
|
||||
tag_name = 'misp-galaxy:{}="{}"'.format(id, tag)
|
||||
r_serv_tags.srem('active_tag_galaxies_' + id, tag_name)
|
||||
r_serv_tags.delete('synonym_tag_' + tag_name)
|
||||
|
||||
return redirect(url_for('Tags.galaxies'))
|
||||
|
||||
|
@ -666,6 +733,7 @@ def edit_galaxy_tag():
|
|||
#remove tags
|
||||
for tag in diff:
|
||||
r_serv_tags.srem('active_tag_galaxies_' + id, tag)
|
||||
r_serv_tags.delete('synonym_tag_' + tag)
|
||||
|
||||
#all tags unchecked
|
||||
if len(arg1) == 0 and len(arg2) == 0:
|
||||
|
@ -676,10 +744,42 @@ def edit_galaxy_tag():
|
|||
r_serv_tags.sadd('active_galaxies', id)
|
||||
r_serv_tags.sadd('active_tag_galaxies_' + id, tag)
|
||||
|
||||
#get tags synonyms
|
||||
for clusters_json in list_clusters:
|
||||
|
||||
#get clusters
|
||||
cluster = json.loads(clusters_json)
|
||||
|
||||
if cluster['type'] == id:
|
||||
|
||||
val = cluster['values']
|
||||
|
||||
tags = []
|
||||
for data in val:
|
||||
try:
|
||||
meta = data['meta']
|
||||
synonyms = meta['synonyms']
|
||||
tag_name = data['value']
|
||||
tag_name = 'misp-galaxy:{}="{}"'.format(id, tag_name)
|
||||
if tag_name in arg2:
|
||||
#save synonyms
|
||||
for synonym in synonyms:
|
||||
r_serv_tags.sadd('synonym_tag_' + tag_name, synonym)
|
||||
|
||||
except KeyError:
|
||||
pass
|
||||
break
|
||||
|
||||
return redirect(url_for('Tags.galaxies'))
|
||||
|
||||
else:
|
||||
return "INCORRECT INPUT"
|
||||
|
||||
@Tags.route("/Tags/test")
|
||||
def test():
|
||||
|
||||
return render_template("test.html",
|
||||
id = '1')
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(Tags)
|
||||
|
|
|
@ -38,20 +38,31 @@
|
|||
<input id="ltags" style="width:100%;" type="text" name="ltags" autocomplete="off">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-search btn-primary btn-tags" onclick="searchTags()">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
<span class="label-icon">Search</span>
|
||||
<button type="button" class="btn btn-search btn-primary btn-tags" onclick="searchTags()"<button class="btn btn-primary" onclick="emptyTags()">
|
||||
<span class="glyphicon glyphicon-search "></span>
|
||||
<span class="label-icon">Search Tags</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary" style="margin-bottom: 30px;" data-target="#filter-panel">
|
||||
<span class="glyphicon glyphicon-cog "></span> Advanced Search
|
||||
<button class="btn btn-primary" onclick="emptyTags()" style="margin-bottom: 30px;">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<span class="label-icon">Clear Tags</span>
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<a href="{{ url_for('Tags.taxonomies') }}"> [Taxonomies list] </a>
|
||||
<br></br>
|
||||
<a class="btn btn-tags" href="{{ url_for('Tags.taxonomies') }}" target="_blank">
|
||||
<i class="fa fa-wrench fa-2x"></i>
|
||||
<br></br>
|
||||
<span class="label-icon">Edit Taxonomies List </span>
|
||||
</a>
|
||||
<a class="btn btn-tags" href="{{ url_for('Tags.galaxies') }}" target="_blank">
|
||||
<i class="fa fa-rocket fa-2x"></i>
|
||||
<br></br>
|
||||
<span class="label-icon">Edit Galaxies List</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -79,9 +90,12 @@
|
|||
<script>
|
||||
function searchTags() {
|
||||
var data = ltags.getValue();
|
||||
console.log(data);
|
||||
window.location.replace("{{ url_for('Tags.get_tagged_paste') }}?ltags=" + data);
|
||||
}
|
||||
function emptyTags() {
|
||||
console.log('b');
|
||||
ltags.clear();
|
||||
}
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
||||
</body>
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-primary btn-lg">
|
||||
<button class="btn btn-primary btn-lg" onclick="submitActiveTags()">
|
||||
<i class="fa fa-check-square-o fa"></i>
|
||||
Update Tags
|
||||
</button>
|
||||
|
@ -142,13 +142,14 @@
|
|||
</body>
|
||||
|
||||
<script>
|
||||
var table
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#myTable_').DataTable(
|
||||
table = $('#myTable_').DataTable(
|
||||
{
|
||||
"aLengthMenu": [[5, 10, 15, 20, -1], [5, 10, 15, 20, "All"]],
|
||||
"iDisplayLength": 10,
|
||||
//"order": [[ 1, "asc" ]]
|
||||
"order": [[ 3, "desc" ]]
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -157,7 +158,12 @@ $(document).ready(function(){
|
|||
|
||||
<script>
|
||||
function submitActiveTags(){
|
||||
document.getElementById("checkboxForm").submit();
|
||||
table.destroy()
|
||||
table = $('#myTable_').DataTable(
|
||||
{
|
||||
"iDisplayLength": -1,
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-primary btn-lg">
|
||||
<button class="btn btn-primary btn-lg" onclick="submitActiveTags()">
|
||||
<i class="fa fa-check-square-o fa"></i>
|
||||
Update Tags
|
||||
</button>
|
||||
|
@ -142,20 +142,14 @@
|
|||
</body>
|
||||
|
||||
<script>
|
||||
var table
|
||||
$(document).ready(function(){
|
||||
/*$('[data-toggle="tooltip"]').tooltip();
|
||||
$("[data-toggle='modal']").off('click.openmodal').on("click.openmodal", function (event) {
|
||||
//get_html_and_update_modal(event);
|
||||
get_html_and_update_modal(event, $(this));
|
||||
});
|
||||
|
||||
search_table = $('#myTable_').DataTable({ "order": [[ 2, "desc" ]] });*/
|
||||
|
||||
$('#myTable_').DataTable(
|
||||
table = $('#myTable_').DataTable(
|
||||
{
|
||||
"aLengthMenu": [[5, 10, 15, 20, -1], [5, 10, 15, 20, "All"]],
|
||||
"iDisplayLength": 10,
|
||||
//"order": [[ 1, "asc" ]]
|
||||
"order": [[ 3, "desc" ]]
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -164,7 +158,12 @@ $(document).ready(function(){
|
|||
|
||||
<script>
|
||||
function submitActiveTags(){
|
||||
document.getElementById("checkboxForm").submit();
|
||||
table.destroy()
|
||||
table = $('#myTable_').DataTable(
|
||||
{
|
||||
"iDisplayLength": -1,
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -74,17 +74,18 @@
|
|||
<input id="ltags" style="width:100%;" type="text" name="ltags" autocomplete="off">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-search btn-primary btn-tags" onclick="searchTags()">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
<span class="label-icon">Search</span>
|
||||
<button type="button" class="btn btn-search btn-primary btn-tags" onclick="searchTags()">
|
||||
<span class="glyphicon glyphicon-search "></span>
|
||||
<span class="label-icon">Search Tags</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary" style="margin-bottom: 30px;" data-target="#filter-panel">
|
||||
<span class="glyphicon glyphicon-cog "></span> Advanced Search
|
||||
</button>
|
||||
<button class="btn btn-primary" onclick="emptyTags()" style="margin-bottom: 30px;">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
<span class="label-icon">Clear Tags</span>
|
||||
</button>
|
||||
|
||||
<table class="test table table-striped table-bordered table-hover table-responsive " id="myTable_">
|
||||
<thead>
|
||||
|
@ -105,7 +106,7 @@
|
|||
<div>
|
||||
{% for tag in paste_tags[loop.index0] %}
|
||||
<a href="{{ url_for('Tags.get_tagged_paste') }}?ltags={{ tag[1] }}">
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 6] }} pull-left">{{ tag[0] }}</span>
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag[0] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -129,7 +130,19 @@
|
|||
<img id="loading_gif_browse" src="/static//image/loading.gif" heigt="20" width="20" style="margin: 2px;"></div>
|
||||
</br>
|
||||
|
||||
<a href="{{ url_for('Tags.taxonomies') }}"> [Taxonomies list] </a>
|
||||
<div>
|
||||
<br></br>
|
||||
<a class="btn btn-tags" href="{{ url_for('Tags.taxonomies') }}" target="_blank">
|
||||
<i class="fa fa-wrench fa-2x"></i>
|
||||
<br></br>
|
||||
<span class="label-icon">Edit Taxonomies List </span>
|
||||
</a>
|
||||
<a class="btn btn-tags" href="{{ url_for('Tags.galaxies') }}" target="_blank">
|
||||
<i class="fa fa-rocket fa-2x"></i>
|
||||
<br></br>
|
||||
<span class="label-icon">Edit Galaxies List</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -186,6 +199,10 @@ $(document).ready(function(){
|
|||
var data = ltags.getValue();
|
||||
window.location.replace("{{ url_for('Tags.get_tagged_paste') }}?ltags=" + data);
|
||||
}
|
||||
function emptyTags() {
|
||||
console.log('b');
|
||||
ltags.clear();
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Dynamically update the modal -->
|
||||
|
|
|
@ -64,7 +64,6 @@ def event_stream_getImportantPasteByModule(module_name, year):
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
for path in all_pastes_list:
|
||||
index += 1
|
||||
|
@ -135,7 +134,6 @@ def importantPasteByModule():
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
for path in allPastes[0:10]:
|
||||
all_path.append(path)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div>
|
||||
{% for tag in paste_tags[loop.index0] %}
|
||||
<a href="{{ url_for('Tags.get_tagged_paste') }}?ltags={{ tag[1] }}">
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 6] }} pull-left">{{ tag[0] }}</span>
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag[0] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -101,7 +101,7 @@ function add_entries_X(to_add) {
|
|||
for(j=0; j<feed.l_tags.length; j++) {
|
||||
console.log(feed.l_tags[j][1])
|
||||
tag = tag + "<a href=\"{{ url_for('Tags.get_tagged_paste') }}?ltags=" + feed.l_tags[j][1] + "\">"
|
||||
+ "<span class=\"label label-" + feed.bootstrap_label[j % 6] + " pull-left\">" + feed.l_tags[j][0] + "</span>" + "</a>";
|
||||
+ "<span class=\"label label-" + feed.bootstrap_label[j % 5] + " pull-left\">" + feed.l_tags[j][0] + "</span>" + "</a>";
|
||||
}
|
||||
search_table.row.add( [
|
||||
feed.index,
|
||||
|
|
|
@ -164,7 +164,6 @@ def search():
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
index_min = 1
|
||||
index_max = len(get_index_list())
|
||||
|
@ -205,7 +204,6 @@ def get_more_search_result():
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<div>
|
||||
{% for tag in paste_tags[loop.index0] %}
|
||||
<a href="{{ url_for('Tags.get_tagged_paste') }}?ltags={{ tag[1] }}">
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 6] }} pull-left">{{ tag[0] }}</span>
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag[0] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -200,7 +200,7 @@
|
|||
var curr_preview = data.preview_array[i].replace(/\"/g, "\'");
|
||||
var tag = ""
|
||||
for(j=0; j<data.list_tags[i].length; j++) {
|
||||
tag = tag + "<span class=\"label label-" + data.bootstrap_label[j % 6] + " pull-left\">" + data.list_tags[j] + "</span>"
|
||||
tag = tag + "<span class=\"label label-" + data.bootstrap_label[j % 5] + " pull-left\">" + data.list_tags[j] + "</span>"
|
||||
}
|
||||
search_table.row.add( [
|
||||
init_num_of_elements_in_table+((offset))+i+1,
|
||||
|
|
|
@ -104,13 +104,15 @@ def showpaste(content_range):
|
|||
bootstrap_label.append('danger')
|
||||
bootstrap_label.append('warning')
|
||||
bootstrap_label.append('info')
|
||||
bootstrap_label.append('dark')
|
||||
|
||||
#active taxonomies
|
||||
active_taxonomies = r_serv_tags.smembers('active_taxonomies')
|
||||
|
||||
l_tags = r_serv_metadata.smembers('tag:'+requested_path)
|
||||
|
||||
#active galaxies
|
||||
active_galaxies = r_serv_tags.smembers('active_galaxies')
|
||||
|
||||
list_tags = []
|
||||
|
||||
for tag in l_tags:
|
||||
|
@ -119,7 +121,7 @@ def showpaste(content_range):
|
|||
else:
|
||||
list_tags.append( (tag, False) )
|
||||
|
||||
return render_template("show_saved_paste.html", date=p_date, bootstrap_label=bootstrap_label, active_taxonomies=active_taxonomies, list_tags=list_tags, source=p_source, encoding=p_encoding, language=p_language, size=p_size, mime=p_mime, lineinfo=p_lineinfo, content=p_content, initsize=len(p_content), duplicate_list = p_duplicate_list, simil_list = p_simil_list, hashtype_list = p_hashtype_list, date_list=p_date_list)
|
||||
return render_template("show_saved_paste.html", date=p_date, bootstrap_label=bootstrap_label, active_taxonomies=active_taxonomies, active_galaxies=active_galaxies, list_tags=list_tags, source=p_source, encoding=p_encoding, language=p_language, size=p_size, mime=p_mime, lineinfo=p_lineinfo, content=p_content, initsize=len(p_content), duplicate_list = p_duplicate_list, simil_list = p_simil_list, hashtype_list = p_hashtype_list, date_list=p_date_list)
|
||||
|
||||
# ============ ROUTES ============
|
||||
|
||||
|
|
|
@ -49,26 +49,51 @@
|
|||
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group input-group" >
|
||||
<input id="ltags" style="width:850%;" type="text" name="ltags">
|
||||
|
||||
</div>
|
||||
<div class="form-group input-group" >
|
||||
<input id="ltags" style="width:850%;" type="text" name="ltags">
|
||||
</div>
|
||||
|
||||
<div class="btn-group btn-block">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle btn-block" data-toggle="dropdown">Taxonomie Selection
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu scrollable-menu" role="menu">
|
||||
<li><a href="#" id="all-tags">All Tags <i class="fa fa-tags"></i></a></li>
|
||||
<li><a href="#" id="all-tags-taxonomies">All Tags <i class="fa fa-tags"></i></a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
{% for taxo in active_taxonomies %}
|
||||
<li><a href="#" id="{{ taxo }}-id{{ loop.index0 }}">{{ taxo }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<br/><br/>
|
||||
|
||||
<div class="form-group input-group" >
|
||||
<input id="ltagsgalaxies" style="width:850%;" type="text" name="ltagsgalaxies">
|
||||
</div>
|
||||
|
||||
<div class="btn-group btn-block">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle btn-block" data-toggle="dropdown">Galaxy Selection
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu scrollable-menu" role="menu">
|
||||
<li><a href="#" id="all-tags-galaxies">All Tags <i class="fa fa-tags"></i></a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
{% for galaxy in active_galaxies %}
|
||||
<li><a href="#" id="{{ galaxy }}-idgalax{{ loop.index0 }}">{{ galaxy }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-tags pull-left" href="{{ url_for('Tags.taxonomies') }}" target="_blank">
|
||||
<span class="label-icon">Edit Taxonomies List </span>
|
||||
<i class="fa fa-wrench fa-2x"></i>
|
||||
</a>
|
||||
<a class="btn btn-tags pull-left" href="{{ url_for('Tags.galaxies') }}" target="_blank">
|
||||
<span class="label-icon">Edit Galaxies List</span>
|
||||
<i class="fa fa-rocket fa-2x"></i>
|
||||
</a>
|
||||
<button class="btn btn-primary btn-tags" onclick="addTags()">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="label-icon">Add Tags</span>
|
||||
|
@ -82,7 +107,7 @@
|
|||
|
||||
|
||||
{% for tag in list_tags %}
|
||||
<span class="btn btn-{{ bootstrap_label[loop.index0 % 6] }} btn-lg pull-left" data-toggle="modal" data-target="#myModal_{{ loop.index0 }}">{{ tag[0] }}</span>
|
||||
<span class="btn btn-{{ bootstrap_label[loop.index0 % 5] }} btn-lg pull-left" data-toggle="modal" data-target="#myModal_{{ loop.index0 }}">{{ tag[0] }}</span>
|
||||
|
||||
<!-- Modal edit this tag -->
|
||||
<div class="modal fade" id="myModal_{{ loop.index0 }}" role="dialog">
|
||||
|
@ -94,7 +119,7 @@
|
|||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 6] }}" >{{ tag[0] }}</span>
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 5] }}" >{{ tag[0] }}</span>
|
||||
</div>
|
||||
<div class="modal-footer center">
|
||||
{% if tag[1] %}
|
||||
|
@ -145,12 +170,6 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ url_for('Tags.thumbs_up_paste') }}?paste={{ request.args.get('paste') }}" class="btn btn-success btn-lg" data-toggle="tooltip" title="Good Detection">
|
||||
<span class="glyphicon glyphicon-thumbs-up "></span>
|
||||
</a>
|
||||
<a href="{{ url_for('Tags.thumbs_down_paste') }}?paste={{ request.args.get('paste') }}" class="btn btn-danger btn-lg" data-toggle="tooltip" title="Bad Detection">
|
||||
<span class="glyphicon glyphicon-thumbs-down "></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="panel-body" id="panel-body">
|
||||
{% if duplicate_list|length == 0 %}
|
||||
|
@ -191,6 +210,7 @@
|
|||
|
||||
<script>
|
||||
var ltags
|
||||
var ltagsgalaxies
|
||||
$(document).ready(function(){
|
||||
|
||||
$.getJSON('/Tags/get_all_tags_taxonomies',
|
||||
|
@ -201,15 +221,26 @@
|
|||
//sortOrder: 'name',
|
||||
maxDropHeight: 200,
|
||||
name: 'ltags'
|
||||
});
|
||||
});
|
||||
|
||||
$.getJSON('/Tags/get_all_tags_galaxies',
|
||||
function(data) {
|
||||
|
||||
ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({
|
||||
data: data,
|
||||
//sortOrder: 'name',
|
||||
maxDropHeight: 200,
|
||||
name: 'ltagsgalaxies'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#tableDup').DataTable();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
jQuery("#all-tags").click(function(e){
|
||||
jQuery("#all-tags-taxonomies").click(function(e){
|
||||
//change input tags list /Tags/get_tags_taxonomie?taxonomie=infoleak
|
||||
$.getJSON('/Tags/get_all_tags_taxonomies',
|
||||
function(data) {
|
||||
|
@ -217,14 +248,25 @@
|
|||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
jQuery("#all-tags-galaxies").click(function(e){
|
||||
$.getJSON('/Tags/get_all_tags_galaxies',
|
||||
function(data) {
|
||||
ltagsgalaxies.setData(data)
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function addTags() {
|
||||
var data = ltags.getValue()
|
||||
var tags = ltags.getValue()
|
||||
var tagsgalaxy = ltagsgalaxies.getValue()
|
||||
var path = '{{ request.args.get('paste') }}'
|
||||
window.location.replace("{{ url_for('Tags.addTags') }}?tags=" + data + "&path=" + path);
|
||||
window.location.replace("{{ url_for('Tags.addTags') }}?tags=" + tags + "&tagsgalaxies=" + tagsgalaxy + "&path=" + path);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
@ -237,5 +279,16 @@
|
|||
});
|
||||
{% endfor %}
|
||||
</script>
|
||||
<script>
|
||||
{% for galaxy in active_galaxies %}
|
||||
jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){
|
||||
$.getJSON('/Tags/get_tags_galaxy?galaxy={{ galaxy }}',
|
||||
function(data) {
|
||||
ltagsgalaxies.setData(data)
|
||||
});
|
||||
});
|
||||
{% endfor %}
|
||||
</script>
|
||||
|
||||
|
||||
</html>
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
* Defaults to <code>'Type or click here'</code> or just <code>'Click here'</code> if not editable.
|
||||
*/
|
||||
emptyText: function() {
|
||||
return cfg.editable ? '' : '';
|
||||
return cfg.editable ? 'Select Tags' : '';
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@
|
|||
* Defaults to <code>false</code>.
|
||||
*/
|
||||
expandOnFocus: function() {
|
||||
return cfg.editable ? false : true;
|
||||
return cfg.editable ? true : true;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue