mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
chg: [fontawesome] v6.6.0 migration
This commit is contained in:
parent
055bc1a1b2
commit
721b076559
23 changed files with 3 additions and 2632 deletions
|
@ -1 +0,0 @@
|
|||
<li id='page-index'><a href="{{ url_for('dashboard.index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a></li>
|
|
@ -1,17 +0,0 @@
|
|||
<div class="input-group custom-search-form">
|
||||
<form action="{{ url_for('searches.search') }}" id="form-search" method=POST>
|
||||
<input type="text" name="query" class="form-control" placeholder="Search Paste">
|
||||
<input type="hidden" name="index_name" class="form-control" value="0" placeholder="Index Name">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
<img id="loading-gif" src="{{url_for('static', filename='image/loading.gif') }}" height="26" width="26" style="margin: 4px; visibility: hidden;">
|
||||
</form>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
$("#form-search").submit(function( event ) {
|
||||
$("#loading-gif").css("visibility", "visible");
|
||||
});
|
||||
</script>
|
|
@ -1,528 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*-coding:UTF-8 -*
|
||||
|
||||
"""
|
||||
Flask functions and routes for the rest api
|
||||
"""
|
||||
|
||||
# import os
|
||||
# import re
|
||||
# import sys
|
||||
# import uuid
|
||||
# import json
|
||||
|
||||
# sys.path.append(os.environ['AIL_BIN'])
|
||||
# ##################################
|
||||
# # Import Project packages
|
||||
# ##################################
|
||||
# from lib.ConfigLoader import ConfigLoader
|
||||
# from lib import Users
|
||||
# from lib.objects import Items
|
||||
# from lib import Tag
|
||||
#
|
||||
# from packages import Import_helper
|
||||
#
|
||||
# from importer.FeederImporter import api_add_json_feeder_to_queue
|
||||
#
|
||||
#
|
||||
# from flask import jsonify, request, Blueprint, redirect, url_for, Response
|
||||
#
|
||||
# from functools import wraps
|
||||
|
||||
# ============ VARIABLES ============
|
||||
|
||||
|
||||
|
||||
# ============ DECORATOR ============
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ============= ROUTES ==============
|
||||
|
||||
# @restApi.route("/api", methods=['GET'])
|
||||
# @login_required
|
||||
# def api():
|
||||
# return 'api doc'
|
||||
|
||||
|
||||
'''
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# POST
|
||||
#
|
||||
# {
|
||||
# "id": item_id, mandatory
|
||||
# "content": true,
|
||||
#
|
||||
#
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "id": "item_id",
|
||||
# "tags": [],
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_item_id():
|
||||
data = request.get_json()
|
||||
res = Items.api_get_item(data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# GET
|
||||
#
|
||||
# {
|
||||
# "id": item_id, mandatory
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "id": "item_id",
|
||||
# "date": "date",
|
||||
# "tags": [],
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/item/tag", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_item_tag():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id, 'date': False, 'tags': True}
|
||||
res = Item.get_item(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# POST
|
||||
#
|
||||
# {
|
||||
# "id": item_id, mandatory
|
||||
# "tags": [tags to add],
|
||||
# "galaxy": [galaxy to add],
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "id": "item_id",
|
||||
# "tags": [tags added],
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/add/item/tag", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def add_item_tags():
|
||||
|
||||
data = request.get_json()
|
||||
if not data:
|
||||
return Response(json.dumps({'status': 'error', 'reason': 'Malformed JSON'}, indent=2, sort_keys=True), mimetype='application/json'), 400
|
||||
|
||||
object_id = data.get('id', None)
|
||||
tags = data.get('tags', [])
|
||||
galaxy = data.get('galaxy', [])
|
||||
|
||||
# res = Tag.api_add_obj_tags(tags=tags, galaxy_tags=galaxy, object_id=object_id, object_type="item")
|
||||
res = {'error': 'disabled endpoint'}, 500
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# DELETE
|
||||
#
|
||||
# {
|
||||
# "id": item_id, mandatory
|
||||
# "tags": [tags to delete],
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "id": "item_id",
|
||||
# "tags": [tags deleted],
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/delete/item/tag", methods=['DELETE'])
|
||||
@token_required('analyst')
|
||||
def delete_item_tags():
|
||||
|
||||
data = request.get_json()
|
||||
if not data:
|
||||
return Response(json.dumps({'status': 'error', 'reason': 'Malformed JSON'}, indent=2, sort_keys=True), mimetype='application/json'), 400
|
||||
|
||||
object_id = data.get('id', None)
|
||||
tags = data.get('tags', [])
|
||||
|
||||
res = Tag.api_delete_obj_tags(tags=tags, object_id=object_id, object_type="item")
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# GET
|
||||
#
|
||||
# {
|
||||
# "id": item_id, mandatory
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "id": "item_id",
|
||||
# "content": "item content"
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/item/content", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_item_content():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id, 'date': False, 'content': True, 'tags': False}
|
||||
res = Item.get_item(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
|
||||
@restApi.route("api/v1/get/item/content/utf8/base64", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_item_content_encoded_text():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id}
|
||||
res = Item.api_get_item_content_base64_utf8(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
|
||||
@restApi.route("api/v1/get/items/sources", methods=['GET'])
|
||||
@token_required('read_only')
|
||||
def get_item_sources():
|
||||
res = Item.api_get_items_sources()
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
'''
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # TAGS # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
'''
|
||||
@restApi.route("api/v1/get/tag/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_tag_metadata():
|
||||
data = request.get_json()
|
||||
tag = data.get('tag', None)
|
||||
if not Tag.is_tag_in_all_tag(tag):
|
||||
return Response(json.dumps({'status': 'error', 'reason':'Tag not found'}, indent=2, sort_keys=True), mimetype='application/json'), 404
|
||||
metadata = Tag.get_tag_metadata(tag)
|
||||
return Response(json.dumps(metadata, indent=2, sort_keys=True), mimetype='application/json'), 200
|
||||
|
||||
@restApi.route("api/v1/get/tag/all", methods=['GET'])
|
||||
@token_required('read_only')
|
||||
def get_all_tags():
|
||||
res = {'tags': Tag.get_all_tags()}
|
||||
return Response(json.dumps(res, indent=2, sort_keys=True), mimetype='application/json'), 200
|
||||
'''
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TODO
|
||||
# # # # # # # # # # # # # # TRACKER # # # # # # # # # # # # # # # # # TODO
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TODO
|
||||
'''
|
||||
@restApi.route("api/v1/add/tracker", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def add_tracker_term():
|
||||
data = request.get_json()
|
||||
user_token = get_auth_from_header()
|
||||
user_id = Users.get_token_user(user_token)
|
||||
res = Tracker.api_add_tracker(data, user_id)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/delete/tracker", methods=['DELETE'])
|
||||
@token_required('analyst')
|
||||
def delete_tracker_term():
|
||||
data = request.get_json()
|
||||
user_token = get_auth_from_header()
|
||||
user_id = Users.get_token_user(user_token)
|
||||
res = Term.parse_tracked_term_to_delete(data, user_id)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/tracker/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_tracker_term_item():
|
||||
data = request.get_json()
|
||||
user_token = get_auth_from_header()
|
||||
user_id = Users.get_token_user(user_token)
|
||||
res = Term.parse_get_tracker_term_item(data, user_id)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
|
||||
@restApi.route("api/v1/get/tracker/yara/content", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_default_yara_rule_content():
|
||||
data = request.get_json()
|
||||
rule_name = data.get('rule_name', None)
|
||||
rule_name = escape(rule_name)
|
||||
req_data = {'rule_name': rule_name}
|
||||
res = Tracker.get_yara_rule_content_restapi(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/tracker/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_tracker_metadata_api():
|
||||
data = request.get_json()
|
||||
tracker_uuid = data.get('tracker_uuid', None)
|
||||
req_data = {'tracker_uuid': tracker_uuid}
|
||||
|
||||
tracker_uuid = request_dict.get('tracker_uuid', None)
|
||||
if not request_dict:
|
||||
return {'status': 'error', 'reason': 'Malformed JSON'}, 400
|
||||
if not tracker_uuid:
|
||||
return {'status': 'error', 'reason': 'Mandatory parameter(s) not provided'}, 400
|
||||
if not is_valid_uuid_v4(tracker_uuid):
|
||||
return {"status": "error", "reason": "Invalid Tracker UUID"}, 400
|
||||
if not r_serv_tracker.exists(f'tracker:{tracker_uuid}'):
|
||||
return {'status': 'error', 'reason': 'Tracker not found'}, 404
|
||||
|
||||
res = Tracker.get_tracker_metadata_api(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=False), mimetype='application/json'), res[1]
|
||||
|
||||
'''
|
||||
|
||||
'''
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # CRYPTOCURRENCY # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/cryptocurrency/bitcoin/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_cryptocurrency_bitcoin_metadata():
|
||||
data = request.get_json()
|
||||
crypto_address = data.get('bitcoin', None)
|
||||
req_data = {'bitcoin': crypto_address, 'metadata': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/cryptocurrency/bitcoin/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_cryptocurrency_bitcoin_item():
|
||||
data = request.get_json()
|
||||
bitcoin_address = data.get('bitcoin', None)
|
||||
req_data = {'bitcoin': bitcoin_address, 'items': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # PGP # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/pgp/key/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_key_metadata():
|
||||
data = request.get_json()
|
||||
pgp_field = data.get('key', None)
|
||||
req_data = {'key': pgp_field, 'metadata': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/pgp/mail/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_mail_metadata():
|
||||
data = request.get_json()
|
||||
pgp_field = data.get('mail', None)
|
||||
req_data = {'mail': pgp_field, 'metadata': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/pgp/name/metadata", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_name_metadata():
|
||||
data = request.get_json()
|
||||
pgp_field = data.get('name', None)
|
||||
req_data = {'name': pgp_field, 'metadata': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/pgp/key/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_key_item():
|
||||
data = request.get_json()
|
||||
pgp_field = data.get('key', None)
|
||||
req_data = {'key': pgp_field, 'items': True}
|
||||
res = 0
|
||||
raise Exception('TO MIGRATE')
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/pgp/mail/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_mail_item():
|
||||
data = request.get_json()
|
||||
pgp_mail = data.get('mail', None)
|
||||
req_data = {'mail': pgp_mail, 'items': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/pgp/name/item", methods=['POST'])
|
||||
@token_required('read_only')
|
||||
def get_pgp_name_item():
|
||||
data = request.get_json()
|
||||
pgp_name = data.get('name', None)
|
||||
req_data = {'name': pgp_name, 'items': True}
|
||||
raise Exception('TO MIGRATE')
|
||||
res = 0
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
|
||||
|
||||
@restApi.route("api/v1/get/item/cryptocurrency/key", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def get_item_cryptocurrency_bitcoin():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id, 'date': False, 'tags': False, 'pgp': {'key': True}}
|
||||
res = Item.get_item(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/item/pgp/mail", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def get_item_cryptocurrency_bitcoin():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id, 'date': False, 'tags': False, 'pgp': {'mail': True}}
|
||||
res = Item.get_item(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
|
||||
@restApi.route("api/v1/get/item/pgp/name", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def get_item_cryptocurrency_bitcoin():
|
||||
data = request.get_json()
|
||||
item_id = data.get('id', None)
|
||||
req_data = {'id': item_id, 'date': False, 'tags': False, 'pgp': {'name': True}}
|
||||
res = Item.get_item(req_data)
|
||||
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
|
||||
'''
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # DOMAIN # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
'''
|
||||
@restApi.route("api/v1/get/domain/status/minimal", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def get_domain_status_minimal():
|
||||
data = request.get_json()
|
||||
domain = data.get('domain', None)
|
||||
# error handler
|
||||
# TODO TO MIGRATE
|
||||
raise Exception('TO MIGRATE')
|
||||
# res = Domain.api_verify_if_domain_exist(domain)
|
||||
if res:
|
||||
return create_json_response(res[0], res[1])
|
||||
# TODO TO MIGRATE
|
||||
raise Exception('TO MIGRATE')
|
||||
# res = Domain.api_get_domain_up_range(domain)
|
||||
res[0]['domain'] = domain
|
||||
return create_json_response(res[0], res[1])
|
||||
'''
|
||||
|
||||
# @restApi.route("api/v1/get/crawled/domain/list", methods=['POST'])
|
||||
# @token_required('analyst')
|
||||
# def get_crawled_domain_list():
|
||||
# data = request.get_json()
|
||||
# res = get_mandatory_fields(data, ['date_from', 'date_to'])
|
||||
# if res:
|
||||
# return create_json_response(res[0], res[1])
|
||||
#
|
||||
# date_from = data.get('date_from', None)
|
||||
# date_to = data.get('date_to', None)
|
||||
# domain_type = data.get('domain_type', None)
|
||||
# domain_status = 'UP'
|
||||
# # TODO TO MIGRATE
|
||||
# raise Exception('TO MIGRATE')
|
||||
# # res = Domain.api_get_domains_by_status_daterange(date_from, date_to, domain_type)
|
||||
# dict_res = res[0]
|
||||
# dict_res['date_from'] = date_from
|
||||
# dict_res['date_to'] = date_to
|
||||
# dict_res['domain_status'] = domain_status
|
||||
# dict_res['domain_type'] = domain_type
|
||||
# return create_json_response(dict_res, res[1])
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # IMPORT # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
#
|
||||
# POST JSON FORMAT
|
||||
#
|
||||
# {
|
||||
# "type": "text", (default value)
|
||||
# "tags": [], (default value)
|
||||
# "default_tags": True, (default value)
|
||||
# "galaxy" [], (default value)
|
||||
# "text": "", mandatory if type = text
|
||||
# }
|
||||
#
|
||||
# response: {"uuid": "uuid"}
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
'''
|
||||
@restApi.route("api/v1/import/item", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def import_item():
|
||||
|
||||
data = request.get_json()
|
||||
if not data:
|
||||
return create_json_response({'status': 'error', 'reason': 'Malformed JSON'}, 400)
|
||||
|
||||
# unpack json
|
||||
text_to_import = data.get('text', None)
|
||||
if not text_to_import:
|
||||
return create_json_response({'status': 'error', 'reason': 'No text supplied'}, 400)
|
||||
|
||||
tags = data.get('tags', [])
|
||||
if not type(tags) is list:
|
||||
tags = []
|
||||
galaxy = data.get('galaxy', [])
|
||||
if not type(galaxy) is list:
|
||||
galaxy = []
|
||||
|
||||
if not Tag.is_valid_tags_taxonomies_galaxy(tags, galaxy):
|
||||
return create_json_response({'status': 'error', 'reason': 'Tags or Galaxy not enabled'}, 400)
|
||||
|
||||
default_tags = data.get('default_tags', True)
|
||||
if default_tags:
|
||||
tags.append('infoleak:submission="manual"')
|
||||
|
||||
if sys.getsizeof(text_to_import) > 900000:
|
||||
return create_json_response({'status': 'error', 'reason': 'Size exceeds default'}, 413)
|
||||
|
||||
import_uuid = str(uuid.uuid4())
|
||||
Import_helper.create_import_queue(tags, galaxy, text_to_import, import_uuid)
|
||||
|
||||
return Response(json.dumps({'uuid': import_uuid}, indent=2, sort_keys=True), mimetype='application/json')
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# GET
|
||||
#
|
||||
# {
|
||||
# "uuid": "uuid", mandatory
|
||||
# }
|
||||
#
|
||||
# response: {
|
||||
# "status": "in queue"/"in progress"/"imported",
|
||||
# "items": [all item id]
|
||||
# }
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
@restApi.route("api/v1/get/import/item", methods=['POST'])
|
||||
@token_required('analyst')
|
||||
def import_item_uuid():
|
||||
data = request.get_json()
|
||||
import_uuid = data.get('uuid', None)
|
||||
|
||||
# Verify uuid
|
||||
if not is_valid_uuid_v4(import_uuid):
|
||||
return Response(json.dumps({'status': 'error', 'reason': 'Invalid uuid'}), mimetype='application/json'), 400
|
||||
|
||||
data = Import_helper.check_import_status(import_uuid)
|
||||
if data:
|
||||
return Response(json.dumps(data[0]), mimetype='application/json'), data[1]
|
||||
|
||||
return Response(json.dumps({'status': 'error', 'reason': 'Invalid response'}), mimetype='application/json'), 400
|
||||
'''
|
|
@ -1,35 +0,0 @@
|
|||
<!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">
|
||||
|
||||
<!-- JS -->
|
||||
<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{% include 'nav_bar.html' %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
{% include 'crawler/menu_sidebar.html' %}
|
||||
|
||||
<div class="col-12 col-lg-10" id="core_content">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
|
@ -1,249 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*-coding:UTF-8 -*
|
||||
|
||||
|
||||
# import os
|
||||
# import sys
|
||||
# import datetime
|
||||
# import flask
|
||||
# from flask import Flask, render_template, jsonify, request, Blueprint
|
||||
#
|
||||
# from Role_Manager import login_admin, login_user_no_api
|
||||
# from flask_login import login_required
|
||||
#
|
||||
# from whoosh import index
|
||||
# from whoosh.fields import Schema, TEXT, ID
|
||||
# from whoosh.qparser import QueryParser
|
||||
#
|
||||
# sys.path.append(os.environ['AIL_BIN'])
|
||||
# ##################################
|
||||
# # Import Project packages
|
||||
# ##################################
|
||||
# from lib.objects.Items import Item
|
||||
#
|
||||
# import time
|
||||
#
|
||||
# # ============ VARIABLES ============
|
||||
# import Flask_config
|
||||
#
|
||||
# app = Flask_config.app
|
||||
# config_loader = Flask_config.config_loader
|
||||
# baseUrl = Flask_config.baseUrl
|
||||
# max_preview_char = Flask_config.max_preview_char
|
||||
# max_preview_modal = Flask_config.max_preview_modal
|
||||
# bootstrap_label = Flask_config.bootstrap_label
|
||||
# PASTES_FOLDER = Flask_config.PASTES_FOLDER
|
||||
#
|
||||
# baseindexpath = os.path.join(os.environ['AIL_HOME'], config_loader.get_config_str("Indexer", "path"))
|
||||
# indexRegister_path = os.path.join(os.environ['AIL_HOME'], config_loader.get_config_str("Indexer", "register"))
|
||||
#
|
||||
# searches = Blueprint('searches', __name__, template_folder='templates')
|
||||
#
|
||||
# # ============ FUNCTIONS ============
|
||||
# def get_current_index():
|
||||
# with open(indexRegister_path, "r") as f:
|
||||
# allIndex = f.read()
|
||||
# allIndex = allIndex.split() # format [time1\ntime2]
|
||||
# allIndex.sort()
|
||||
# try:
|
||||
# indexname = allIndex[-1].strip('\n\r')
|
||||
# except IndexError as e:
|
||||
# indexname = "no-index"
|
||||
# indexpath = os.path.join(baseindexpath, indexname)
|
||||
# return indexpath
|
||||
#
|
||||
# def get_index_list(selected_index=""):
|
||||
# temp = []
|
||||
# index_list = []
|
||||
# for dirs in os.listdir(baseindexpath):
|
||||
# if os.path.isdir(os.path.join(baseindexpath, dirs)):
|
||||
# value = dirs
|
||||
# name = to_iso_date(dirs) + " - " + \
|
||||
# str(get_dir_size(dirs) / (1000*1000)) + " Mb " #+ \
|
||||
# #"(" + str(get_item_count(dirs))''' + " Items" + ")"
|
||||
# flag = dirs==selected_index.split('/')[-1]
|
||||
# if dirs == "old_index":
|
||||
# temp = [value, name, flag]
|
||||
# else:
|
||||
# index_list.append([value, name, flag])
|
||||
#
|
||||
# index_list.sort(reverse=True, key=lambda x: x[0])
|
||||
# if len(temp) != 0:
|
||||
# index_list.append(temp)
|
||||
#
|
||||
# return index_list
|
||||
#
|
||||
# def get_dir_size(directory):
|
||||
# cur_sum = 0
|
||||
# for directory, subdirs, files in os.walk(os.path.join(baseindexpath,directory)):
|
||||
# try:
|
||||
# cur_sum += sum(os.path.getsize(os.path.join(directory, name)) for name in files)
|
||||
# except OSError as e: #File disappeared
|
||||
# pass
|
||||
# return cur_sum
|
||||
#
|
||||
# def get_item_count(dirs):
|
||||
# ix = index.open_dir(os.path.join(baseindexpath, dirs))
|
||||
# return ix.doc_count_all()
|
||||
#
|
||||
# def to_iso_date(timestamp):
|
||||
# if timestamp == "old_index":
|
||||
# return "old_index"
|
||||
# return str(datetime.datetime.fromtimestamp(int(timestamp))).split()[0]
|
||||
#
|
||||
#
|
||||
# # ============ ROUTES ============
|
||||
#
|
||||
# @searches.route("/search", methods=['POST'])
|
||||
# @login_required
|
||||
# @login_user_no_api
|
||||
# def search():
|
||||
# query = request.form['query']
|
||||
# q = []
|
||||
# q.append(query)
|
||||
# r = [] #complete path
|
||||
# c = [] #preview of the paste content
|
||||
# paste_date = []
|
||||
# paste_size = []
|
||||
# paste_tags = []
|
||||
# index_name = request.form['index_name']
|
||||
# num_elem_to_get = 50
|
||||
#
|
||||
# # select correct index
|
||||
# if index_name is None or index_name == "0":
|
||||
# selected_index = get_current_index()
|
||||
# else:
|
||||
# selected_index = os.path.join(baseindexpath, index_name)
|
||||
#
|
||||
# ''' temporary disabled
|
||||
# # # TODO: search by filename/item id
|
||||
# '''
|
||||
#
|
||||
# # Search full line
|
||||
# schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
||||
#
|
||||
# ix = index.open_dir(selected_index)
|
||||
# with ix.searcher() as searcher:
|
||||
# query = QueryParser("content", ix.schema).parse("".join(q))
|
||||
# results = searcher.search_page(query, 1, pagelen=num_elem_to_get)
|
||||
# for x in results:
|
||||
# r.append(x.items()[0][1].replace(PASTES_FOLDER, '', 1))
|
||||
# path = x.items()[0][1].replace(PASTES_FOLDER, '', 1)
|
||||
# item = Item(path)
|
||||
# content = item.get_content()
|
||||
# content_range = max_preview_char if len(content)>max_preview_char else len(content)-1
|
||||
# c.append(content[0:content_range])
|
||||
# curr_date = item.get_date(separator=True)
|
||||
# paste_date.append(curr_date)
|
||||
# paste_size.append(item.get_size())
|
||||
# p_tags = item.get_tags()
|
||||
# l_tags = []
|
||||
# for tag in p_tags:
|
||||
# complete_tag = tag
|
||||
# tag = tag.split('=')
|
||||
# if len(tag) > 1:
|
||||
# if tag[1] != '':
|
||||
# tag = tag[1][1:-1]
|
||||
# # no value
|
||||
# else:
|
||||
# tag = tag[0][1:-1]
|
||||
# # use for custom tags
|
||||
# else:
|
||||
# tag = tag[0]
|
||||
#
|
||||
# l_tags.append( (tag, complete_tag) )
|
||||
#
|
||||
# paste_tags.append(l_tags)
|
||||
# results = searcher.search(query)
|
||||
# num_res = len(results)
|
||||
#
|
||||
# index_list = get_index_list()
|
||||
#
|
||||
# index_min = 1
|
||||
# index_max = len(index_list)
|
||||
#
|
||||
# return render_template("search.html", r=r, c=c,
|
||||
# query=request.form['query'], paste_date=paste_date,
|
||||
# paste_size=paste_size, char_to_display=max_preview_modal,
|
||||
# num_res=num_res, index_min=index_min, index_max=index_max,
|
||||
# bootstrap_label=bootstrap_label,
|
||||
# paste_tags=paste_tags,
|
||||
# index_list=index_list
|
||||
# )
|
||||
#
|
||||
#
|
||||
# @searches.route("/get_more_search_result", methods=['POST'])
|
||||
# @login_required
|
||||
# @login_user_no_api
|
||||
# def get_more_search_result():
|
||||
# query = request.form['query']
|
||||
# q = []
|
||||
# q.append(query)
|
||||
# page_offset = int(request.form['page_offset'])
|
||||
# index_name = request.form['index_name']
|
||||
# num_elem_to_get = 50
|
||||
#
|
||||
# # select correct index
|
||||
# if index_name is None or index_name == "0":
|
||||
# selected_index = get_current_index()
|
||||
# else:
|
||||
# selected_index = os.path.join(baseindexpath, index_name)
|
||||
#
|
||||
# path_array = []
|
||||
# preview_array = []
|
||||
# date_array = []
|
||||
# size_array = []
|
||||
# list_tags = []
|
||||
#
|
||||
# schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
||||
#
|
||||
# ix = index.open_dir(selected_index)
|
||||
# with ix.searcher() as searcher:
|
||||
# query = QueryParser("content", ix.schema).parse(" ".join(q))
|
||||
# results = searcher.search_page(query, page_offset, num_elem_to_get)
|
||||
# for x in results:
|
||||
# path = x.items()[0][1]
|
||||
# path = path.replace(PASTES_FOLDER, '', 1)
|
||||
# path_array.append(path)
|
||||
# item = Item(path)
|
||||
# content = item.get_content()
|
||||
# content_range = max_preview_char if len(content)>max_preview_char else len(content)-1
|
||||
# preview_array.append(content[0:content_range])
|
||||
# curr_date = item.get_date(separator=True)
|
||||
# date_array.append(curr_date)
|
||||
# size_array.append(item.get_size())
|
||||
# p_tags = item.get_tags()
|
||||
# l_tags = []
|
||||
# for tag in p_tags:
|
||||
# complete_tag = tag
|
||||
# tag = tag.split('=')
|
||||
# if len(tag) > 1:
|
||||
# if tag[1] != '':
|
||||
# tag = tag[1][1:-1]
|
||||
# # no value
|
||||
# else:
|
||||
# tag = tag[0][1:-1]
|
||||
# # use for custom tags
|
||||
# else:
|
||||
# tag = tag[0]
|
||||
#
|
||||
# l_tags.append( (tag, complete_tag) )
|
||||
# list_tags.append(l_tags)
|
||||
#
|
||||
# to_return = {}
|
||||
# to_return["path_array"] = path_array
|
||||
# to_return["preview_array"] = preview_array
|
||||
# to_return["date_array"] = date_array
|
||||
# to_return["size_array"] = size_array
|
||||
# to_return["list_tags"] = list_tags
|
||||
# to_return["bootstrap_label"] = bootstrap_label
|
||||
# if len(path_array) < num_elem_to_get: #pagelength
|
||||
# to_return["moreData"] = False
|
||||
# else:
|
||||
# to_return["moreData"] = True
|
||||
#
|
||||
# return jsonify(to_return)
|
||||
#
|
||||
#
|
||||
# # ========= REGISTRATION =========
|
||||
# app.register_blueprint(searches, url_prefix=baseUrl)
|
|
@ -1,329 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Search - AIL</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/dygraph_gallery.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!-- JS -->
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
|
||||
<!-- Custom style -->
|
||||
<style>
|
||||
.tooltip-inner {
|
||||
text-align: left;
|
||||
height: 200%;
|
||||
max-width: 500px;
|
||||
max-height: 500px;
|
||||
font-size: 13px;
|
||||
}
|
||||
pre {
|
||||
white-space:pre-wrap;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="mymodal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div id="mymodalcontent" class="modal-content">
|
||||
<div id="mymodalbody" class="modal-body" max-width="850px">
|
||||
<p>Loading paste information...</p>
|
||||
<img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" height="26" width="26" style="margin: 4px;">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a id="button_show_path" target="_blank" href=""><button type="button" class="btn btn-info">Show saved paste</button></a>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" >Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="page-wrapper">
|
||||
<!-- /.row -->
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
</br>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="glyphicon glyphicon-search"></i> <b id="numberOfRes">{{ r|length }}</b> Results for "<strong>{{ query }}</strong>"
|
||||
<div class="pull-right">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<strong style="">Index: </strong>
|
||||
<select class="form-control" id="index_name" style="display: inline-block; margin-bottom: 5px; width: 30%">
|
||||
{% for indexElem in index_list %}
|
||||
<option {% if indexElem[2] %} selected="selected" {% endif %} value="{{ indexElem[0] }}" >{{ indexElem[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-hover" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th style="max-width: 800px;">Path</th>
|
||||
<th>Date</th>
|
||||
<th>Size (Kb)</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_body">
|
||||
{% for path in r %}
|
||||
<tr>
|
||||
<td> {{ loop.index0 }}</td>
|
||||
<td><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{path}}">{{ path }}</a>
|
||||
<div>
|
||||
{% for tag in paste_tags[loop.index0] %}
|
||||
<a href="{{ url_for('tags_ui.get_obj_by_tags') }}?object_type=item<ags={{ tag[1] }}">
|
||||
<span class="label label-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag[0] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ paste_date[loop.index0] }}</td>
|
||||
<td>{{ paste_size[loop.index0] }}</td>
|
||||
<td><p><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="left" title="{{ c[loop.index0] }} "></span> <button type="button" class="btn-link" data-num="{{ loop.index0 + 1 }}" data-toggle="modal" data-target="#mymodal" data-url="{{ url_for('objects_item.showItem') }}?id={{ path }}" data-path="{{ path }}"><span class="fa fa-search-plus"></span></button></p></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="div_stil_data">
|
||||
<button id="load_more_json_button1" type="button" class="btn btn-default" onclick="add_entries();" style="display: none">Load 50 entries</button>
|
||||
<strong> Totalling {{ num_res }} results related to paste content </strong>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
</div>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
</br>
|
||||
</body>
|
||||
|
||||
<!-- enable tooltip and dataTable -->
|
||||
<script>
|
||||
var search_table;
|
||||
var last_clicked_paste;
|
||||
var can_change_modal_content = true;
|
||||
var page_offset;
|
||||
var offset;
|
||||
var all_loaded;
|
||||
var init_num_of_elements_in_table;
|
||||
var query;
|
||||
var pagelen = 50;
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
$("#button_show_path").hide();
|
||||
search_table = $('#myTable').DataTable();
|
||||
|
||||
query = "{{ query }}";
|
||||
offset = 0;
|
||||
page_offset = 2; //page 1 already loaded
|
||||
all_loaded = false;
|
||||
init_num_of_elements_in_table = parseInt("{{ r|length }}"); // Comes from the file search
|
||||
|
||||
|
||||
if (init_num_of_elements_in_table == pagelen) {
|
||||
$("#load_more_json_button1").show();
|
||||
}
|
||||
|
||||
$('#index_name').on('change', function() {
|
||||
var form = document.createElement('form');
|
||||
form.setAttribute("method", 'post');
|
||||
form.setAttribute("action", "{{ url_for('searches.search') }}");
|
||||
|
||||
var input1 = document.createElement('input');
|
||||
input1.setAttribute("type", "hidden");
|
||||
input1.setAttribute("name", "index_name");
|
||||
input1.setAttribute("value", this.value);
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement('input');
|
||||
input2.setAttribute("type", "hidden");
|
||||
input2.setAttribute("name", "query");
|
||||
input2.setAttribute("value", "{{ query }}");
|
||||
form.appendChild(input2);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Loop to recover all the data from get_more_search_results
|
||||
// And add it dynamically top the dataTable
|
||||
function add_entries() { //Used to disable the button before going to the big loop
|
||||
$("#load_more_json_button1").attr('disabled','disabled');
|
||||
setTimeout(function() { load_search_50_data();}, 50);
|
||||
}
|
||||
|
||||
function load_search_50_data() {
|
||||
var options = { query: query, page_offset: page_offset, index_name: $("#index_name").val() };
|
||||
$.post( "{{ url_for('searches.get_more_search_result') }}", options).done(function( data ) {
|
||||
|
||||
for(i=0; i<data.path_array.length; i++) {
|
||||
var curr_preview = data.preview_array[i].replace(/\"/g, "\'");
|
||||
var tag = ""
|
||||
for(j=0; j<data.list_tags[i].length; j++) {
|
||||
tag = tag + "<a href=\"{{ url_for('tags_ui.get_obj_by_tags') }}?object_type=item<ags=" + data.list_tags[i][j][1] + ">"
|
||||
+ "<span class=\"label label-" + data.bootstrap_label[j % 5] + " pull-left\">" + data.list_tags[i][j][0]
|
||||
+ "</span>" + "</a>"
|
||||
}
|
||||
search_table.row.add( [
|
||||
init_num_of_elements_in_table+((offset))+i+1,
|
||||
"<a target=\"_blank\" href=\"{{ url_for('objects_item.showItem') }}?id="+data.path_array[i]+"&num="+i+"\"> "+ data.path_array[i] +"</a>"
|
||||
+ "<div>" + tag + "</div>",
|
||||
data.date_array[i],
|
||||
data.size_array[i],
|
||||
"<p><span class=\"glyphicon glyphicon-info-sign\" data-toggle=\"tooltip\" data-placement=\"left\" title=\""+curr_preview+"\"></span> <button type=\"button\" class=\"btn-link\" data-num=\""+i+"\" data-toggle=\"modal\" data-target=\"#mymodal\" data-url=\"{{ url_for('objects_item.showItem') }}?id="+data.path_array[i]+"&num="+i+"\" data-path=\""+data.path_array[i]+"\"><span class=\"fa fa-search-plus\"></span></button></p>"
|
||||
] ).draw( false );
|
||||
}
|
||||
offset = offset + data.path_array.length;
|
||||
page_offset = page_offset+1;
|
||||
$("#numberOfRes").text(parseInt($("#numberOfRes").text()) + data.path_array.length);
|
||||
if (data.moreData == true) {
|
||||
//continue
|
||||
} else {
|
||||
all_loaded = true;
|
||||
$("#load_more_json_button1").hide();
|
||||
}
|
||||
$("#load_more_json_button1").removeAttr('disabled');
|
||||
return data.path_array.length;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Dynamically update the modal -->
|
||||
<script type="text/javascript">
|
||||
// static data
|
||||
var alert_message = '<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>No more data.</strong> Full paste displayed.</div>';
|
||||
var complete_paste = null;
|
||||
var char_to_display = {{ char_to_display }};
|
||||
var start_index = 0;
|
||||
|
||||
// When the modal goes out, refresh it to normal content
|
||||
$("#mymodal").on('hidden.bs.modal', function () {
|
||||
can_change_modal_content = true;
|
||||
$("#mymodalbody").html("<p>Loading paste information...</p>");
|
||||
var loading_gif = "<img id='loading-gif-modal' class='img-center' src=\"{{url_for('static', filename='image/loading.gif') }}\" height='26' width='26' style='margin: 4px;'>";
|
||||
$("#mymodalbody").append(loading_gif); // Show the loading GIF
|
||||
$("#button_show_path").attr('href', '');
|
||||
$("#button_show_path").hide();
|
||||
complete_paste = null;
|
||||
start_index = 0;
|
||||
});
|
||||
|
||||
// Update the paste preview in the modal
|
||||
function update_preview() {
|
||||
if (start_index + char_to_display > complete_paste.length-1){ // end of paste reached
|
||||
var final_index = complete_paste.length-1;
|
||||
var flag_stop = true;
|
||||
} else {
|
||||
var final_index = start_index + char_to_display;
|
||||
}
|
||||
|
||||
if (final_index != start_index){ // still have data to display
|
||||
// Append the new content using text() and not append (XSS)
|
||||
$("#mymodalbody").find("#paste-holder").text($("#mymodalbody").find("#paste-holder").text() + complete_paste.substring(start_index+1, final_index+1));
|
||||
start_index = final_index;
|
||||
if (flag_stop)
|
||||
nothing_to_display();
|
||||
} else {
|
||||
nothing_to_display();
|
||||
}
|
||||
}
|
||||
// Update the modal when there is no more data
|
||||
function nothing_to_display() {
|
||||
var new_content = $(alert_message).hide();
|
||||
$("#mymodalbody").find("#panel-body").append(new_content);
|
||||
new_content.show('fast');
|
||||
$("#load-more-button").hide();
|
||||
}
|
||||
|
||||
|
||||
$('#myTable').on( 'draw.dt', function () {
|
||||
// Bind tooltip each time we draw a new page
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
// On click, get html content from url and update the corresponding modal
|
||||
$("[data-toggle='modal']").off('click.openmodal').on("click.openmodal", function (event) {
|
||||
var modal=$(this);
|
||||
var url = " {{ url_for('objects_item.item_preview') }}?id=" + $(this).attr('data-path');
|
||||
last_clicked_paste = $(this).attr('data-num');
|
||||
$.get(url, function (data) {
|
||||
|
||||
// verify that the reveived data is really the current clicked paste. Otherwise, ignore it.
|
||||
var received_num = parseInt(data.split("|num|")[1]);
|
||||
if (received_num == last_clicked_paste && can_change_modal_content) {
|
||||
can_change_modal_content = false;
|
||||
|
||||
// clear data by removing html, body, head tags. prevent dark modal background stack bug.
|
||||
var cleared_data = data.split("<body>")[1].split("</body>")[0];
|
||||
$("#mymodalbody").html(cleared_data);
|
||||
setTimeout(function() { $('#tableDup').DataTable(); }, 150);
|
||||
|
||||
var button = $('<button type="button" id="load-more-button" class="btn btn-info btn-xs center-block" data-url="' + $(modal).attr('data-path') +'" data-toggle="tooltip" data-placement="bottom" title="Load more content"><span class="glyphicon glyphicon-download"></span></button>');
|
||||
button.tooltip();
|
||||
$("#mymodalbody").children(".panel-default").append(button);
|
||||
|
||||
$("#button_show_path").attr('href', $(modal).attr('data-url'));
|
||||
$("#button_show_path").show('fast');
|
||||
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
|
||||
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
|
||||
nothing_to_display();
|
||||
}
|
||||
// On click, donwload all paste's content
|
||||
$("#load-more-button").off('click.download').on("click.download", function (event) {
|
||||
if (complete_paste == null) { //Donwload only once
|
||||
$.get("{{ url_for('objects_item.item_content_more') }}"+"?id="+$(modal).attr('data-path'), function(data, status){
|
||||
complete_paste = data;
|
||||
update_preview();
|
||||
});
|
||||
} else {
|
||||
update_preview();
|
||||
}
|
||||
});
|
||||
} else if (can_change_modal_content) {
|
||||
$("#mymodalbody").html("Ignoring previous not finished query of paste #" + received_num);
|
||||
}
|
||||
});
|
||||
});
|
||||
} );
|
||||
|
||||
</script>
|
||||
</html>
|
|
@ -1,160 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*-coding:UTF-8 -*
|
||||
|
||||
# '''
|
||||
# Flask functions and routes for the trending modules page
|
||||
# '''
|
||||
# import os
|
||||
# import sys
|
||||
# import datetime
|
||||
# import calendar
|
||||
# import flask
|
||||
# from flask import Flask, render_template, jsonify, request, Blueprint
|
||||
#
|
||||
# from Role_Manager import login_admin, login_read_only
|
||||
# from flask_login import login_required
|
||||
#
|
||||
# sys.path.append(os.environ['AIL_BIN'])
|
||||
# ##################################
|
||||
# # Import Project packages
|
||||
# ##################################
|
||||
# from packages.Date import Date
|
||||
#
|
||||
# # ============ VARIABLES ============
|
||||
# import Flask_config
|
||||
#
|
||||
# app = Flask_config.app
|
||||
# baseUrl = Flask_config.baseUrl
|
||||
# r_serv_charts = Flask_config.r_serv_charts
|
||||
# r_serv_sentiment = Flask_config.r_serv_sentiment
|
||||
#
|
||||
# sentiments = Blueprint('sentiments', __name__, template_folder='templates')
|
||||
#
|
||||
# # ============ FUNCTIONS ============
|
||||
#
|
||||
# def get_date_range(num_day):
|
||||
# curr_date = datetime.date.today()
|
||||
# date = Date(str(curr_date.year)+str(curr_date.month).zfill(2)+str(curr_date.day).zfill(2))
|
||||
# date_list = []
|
||||
#
|
||||
# for i in range(0, num_day+1):
|
||||
# date_list.append(date.substract_day(i))
|
||||
# return date_list
|
||||
#
|
||||
#
|
||||
# # ============ ROUTES ============
|
||||
#
|
||||
# @sentiments.route("/sentiment_analysis_trending/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def sentiment_analysis_trending():
|
||||
# return render_template("sentiment_analysis_trending.html")
|
||||
#
|
||||
#
|
||||
# @sentiments.route("/sentiment_analysis_getplotdata/", methods=['GET'])
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def sentiment_analysis_getplotdata():
|
||||
# # Get the top providers based on number of pastes
|
||||
# oneHour = 60*60
|
||||
# sevenDays = oneHour*24*7
|
||||
# dateStart = datetime.datetime.now()
|
||||
# dateStart = dateStart.replace(minute=0, second=0, microsecond=0)
|
||||
# dateStart_timestamp = calendar.timegm(dateStart.timetuple())
|
||||
#
|
||||
# getAllProviders = request.args.get('getProviders')
|
||||
# provider = request.args.get('provider')
|
||||
# allProvider = request.args.get('all')
|
||||
# if getAllProviders == 'True':
|
||||
# if allProvider == "True":
|
||||
# range_providers = r_serv_charts.smembers('all_provider_set')
|
||||
#
|
||||
# return jsonify(list(range_providers))
|
||||
# else:
|
||||
# range_providers = r_serv_charts.zrevrangebyscore('providers_set_'+ get_date_range(0)[0], '+inf', '-inf', start=0, num=8)
|
||||
# # if empty, get yesterday top providers
|
||||
# range_providers = r_serv_charts.zrevrangebyscore('providers_set_'+ get_date_range(1)[1], '+inf', '-inf', start=0, num=8) if range_providers == [] else range_providers
|
||||
#
|
||||
#
|
||||
# # if still empty, takes from all providers
|
||||
# if range_providers == []:
|
||||
# print('today provider empty')
|
||||
# range_providers = r_serv_charts.smembers('all_provider_set')
|
||||
#
|
||||
# return jsonify(list(range_providers))
|
||||
#
|
||||
# elif provider is not None:
|
||||
# to_return = {}
|
||||
#
|
||||
# cur_provider_name = provider + '_'
|
||||
# list_date = {}
|
||||
# for cur_timestamp in range(int(dateStart_timestamp), int(dateStart_timestamp)-sevenDays-oneHour, -oneHour):
|
||||
# cur_set_name = cur_provider_name + str(cur_timestamp)
|
||||
#
|
||||
# list_value = []
|
||||
# for cur_id in r_serv_sentiment.smembers(cur_set_name):
|
||||
# cur_value = (r_serv_sentiment.get(cur_id))
|
||||
# list_value.append(cur_value)
|
||||
# list_date[cur_timestamp] = list_value
|
||||
# to_return[provider] = list_date
|
||||
#
|
||||
# return jsonify(to_return)
|
||||
# return "Bad request"
|
||||
#
|
||||
#
|
||||
#
|
||||
# @sentiments.route("/sentiment_analysis_plot_tool/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def sentiment_analysis_plot_tool():
|
||||
# return render_template("sentiment_analysis_plot_tool.html")
|
||||
#
|
||||
#
|
||||
#
|
||||
# @sentiments.route("/sentiment_analysis_plot_tool_getdata/", methods=['GET'])
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def sentiment_analysis_plot_tool_getdata():
|
||||
# getProviders = request.args.get('getProviders')
|
||||
#
|
||||
# if getProviders == 'True':
|
||||
# providers = []
|
||||
# for cur_provider in r_serv_charts.smembers('all_provider_set'):
|
||||
# providers.append(cur_provider)
|
||||
# return jsonify(providers)
|
||||
#
|
||||
# else:
|
||||
# query = request.args.get('query')
|
||||
# query = query.split(',')
|
||||
# Qdate = request.args.get('Qdate')
|
||||
#
|
||||
# date1 = (Qdate.split('-')[0]).split('/')
|
||||
# date1 = datetime.date(int(date1[2]), int(date1[0]), int(date1[1]))
|
||||
#
|
||||
# date2 = (Qdate.split('-')[1]).split('/')
|
||||
# date2 = datetime.date(int(date2[2]), int(date2[0]), int(date2[1]))
|
||||
#
|
||||
# timestamp1 = calendar.timegm(date1.timetuple())
|
||||
# timestamp2 = calendar.timegm(date2.timetuple())
|
||||
#
|
||||
# oneHour = 60*60
|
||||
# oneDay = oneHour*24
|
||||
#
|
||||
# to_return = {}
|
||||
# for cur_provider in query:
|
||||
# list_date = {}
|
||||
# cur_provider_name = cur_provider + '_'
|
||||
# for cur_timestamp in range(int(timestamp1), int(timestamp2)+oneDay, oneHour):
|
||||
# cur_set_name = cur_provider_name + str(cur_timestamp)
|
||||
#
|
||||
# list_value = []
|
||||
# for cur_id in r_serv_sentiment.smembers(cur_set_name):
|
||||
# cur_value = (r_serv_sentiment.get(cur_id))
|
||||
# list_value.append(cur_value)
|
||||
# list_date[cur_timestamp] = list_value
|
||||
# to_return[cur_provider] = list_date
|
||||
#
|
||||
# return jsonify(to_return)
|
||||
#
|
||||
# # ========= REGISTRATION =========
|
||||
# app.register_blueprint(sentiments, url_prefix=baseUrl)
|
|
@ -1,7 +0,0 @@
|
|||
{#<li id='page-sentiment'><a class="dropdown-toggle" data-toggle="dropdown" href="{{ url_for('sentiments.sentiment_analysis_trending') }}"><i class="fa fa-heart"></i> Sentiment Analysis#}
|
||||
{# <span class="caret"></span></a>#}
|
||||
{# <ul class="dropdown-menu">#}
|
||||
{# <li><a href="{{ url_for('sentiments.sentiment_analysis_trending') }}"><i class="fa fa-bar-chart-o"> </i> Sentiment trending</a></li>#}
|
||||
{# <li><a href="{{ url_for('sentiments.sentiment_analysis_plot_tool') }}"><i class="fa fa-wrench"> </i> Sentiment plot Tool</a></li>#}
|
||||
{# </ul>#}
|
||||
{#</li>#}
|
|
@ -1,134 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Sentiment Plot Tool - AIL</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery-ui.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.stack.js') }}"></script>
|
||||
|
||||
<style>
|
||||
.sparkLineStats ul {
|
||||
padding-left:0;
|
||||
list-style:none
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header" data-page="page-sentiment" >Sentiment analysis: Plot tool</h1>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
<div class="row">
|
||||
|
||||
<!-- Panel OPTIONS -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-today" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Select options</strong>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<!-- left column -->
|
||||
<div class="col-lg-9">
|
||||
<!-- providers charts -->
|
||||
<div class="col-lg-6">
|
||||
<div class="sparkLineStats">
|
||||
<ul id="providerList1">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="sparkLineStats">
|
||||
<ul id="providerList2">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- right column -->
|
||||
<div class="col-lg-3">
|
||||
<div aria-disabled="false" class="slider sliderRange sliderBlue ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" style="margin-bottom: 5px;"></div>
|
||||
<strong>Date:</strong> <input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
<div class="row">
|
||||
<button id="plot_btn" class="btn btn-info" style="margin-right: 8px; margin-left: 8px;float: right;">Plot!</button>
|
||||
<label style="float: right;"><input id="checkbox_stacked" type="checkbox" checked=true> Stacked graph?</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Panel PLOT -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-today" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Graph</strong>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="graph" style="height: 300px;"></div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
<!-- import graph function -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
activePage = $('h1.page-header').attr('data-page');
|
||||
$("#"+activePage).addClass("active");
|
||||
});
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/sentiment_plot.js') }}"
|
||||
data-url_sentiment_analysis="{{ url_for('sentiments.sentiment_analysis_plot_tool_getdata') }}">
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,251 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Sentiment Trending - AIL</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/FlexGauge.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.sparkline.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.canvasjs.min.js') }}"></script>
|
||||
|
||||
<style>
|
||||
|
||||
.moodtable_worst {
|
||||
background: rgba(255, 0, 0, 0.47);
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.moodtable_best {
|
||||
background: rgba(132, 255, 0, 0.5);
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.jqstooltip{
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.sparkLineStats ul {
|
||||
padding-left:0;
|
||||
list-style:none
|
||||
}
|
||||
|
||||
.sparkLineStats {
|
||||
position: relative;
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
|
||||
.sparkLineStats ul li {
|
||||
margin-bottom: 8px;
|
||||
line-height: 90px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.sparkLineStats ul li div {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.sparkLineStats ul li div:first-child {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.panelInside {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.fg-dial-label {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
left: 0;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
top: -60px;
|
||||
margin-bottom: -10px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header" data-page="page-sentiment" >Sentiment analysis: Trending</h1>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
<div class="row">
|
||||
<button id="LoadAll" class="btn btn-info" style="margin: 5px;"><span class="glyphicon glyphicon-download"> </span> Load data from all providers </button>
|
||||
|
||||
<!-- Pannel TODAY -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-today" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong data-toggle="tooltip" data-placement="right" title="Providers displayed are in the top list in Module Statistics">Today's mood</strong>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!-- left column -->
|
||||
<div class="col-lg-9" style="padding-left: 0px;">
|
||||
<!-- providers charts -->
|
||||
<div class="col-lg-6">
|
||||
<div id="today_divl" class="sparkLineStats">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div id="today_divr" class="sparkLineStats">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- right column -->
|
||||
<div class="col-lg-3">
|
||||
<div class="well text-center" style="padding: 0px;">
|
||||
<strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the last hour max value">Mood value</strong>
|
||||
<div id="gauge_today_last_hour"></div>
|
||||
<strong data-toggle="tooltip" data-placement="top" title="Average of the sentiments' intensity">Compound by mood</strong>
|
||||
<div id="bar_today_last_hour" style="height: 70px; width: 100%;"></div>
|
||||
</div>
|
||||
<div class="well text-center" style="padding: 0px;">
|
||||
<strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the today max value">Mood value</strong>
|
||||
<div id="gauge_today_last_days"></div>
|
||||
<strong data-toggle="tooltip" data-placement="top" title="Average of the of sentiments' intensity">Compound by mood</strong>
|
||||
<div id="bar_today_last_days" style="height: 70px; width: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pannel WEEK -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-week" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Week's mood</strong>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!-- left column -->
|
||||
<div class="col-lg-9" style="padding-left: 0px;">
|
||||
<!-- providers charts -->
|
||||
<div class="col-lg-6">
|
||||
<div id="week_divl" class="sparkLineStats">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div id="week_divr" class="sparkLineStats">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- right column -->
|
||||
<div class="col-lg-3">
|
||||
<div class="well text-center" style="padding: 0px;">
|
||||
<strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the week max value">Mood value</strong>
|
||||
<div id="gauge_week"></div>
|
||||
</div>
|
||||
<div class="well text-center" style="padding: 0px;">
|
||||
<table class="table table-striped table-bordered table-hover" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Worst mood</th>
|
||||
<th>Best mood</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="worst1 moodtable_worst">no data</td>
|
||||
<td class="best1 moodtable_best">no data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="worst2 moodtable_worst">no data</td>
|
||||
<td class="best2 moodtable_best">no data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="worst3 moodtable_worst">no data</td>
|
||||
<td class="best3 moodtable_best">no data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="worst4 moodtable_worst">no data</td>
|
||||
<td class="best4 moodtable_best">no data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="worst5 moodtable_worst">no data</td>
|
||||
<td class="best5 moodtable_best">no data</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
<!-- import graph function -->
|
||||
<script src="{{ url_for('static', filename='js/sentiment_trending.js') }}"
|
||||
data-url_sentiment_analysis_getplotdata="{{ url_for('sentiments.sentiment_analysis_getplotdata') }}">
|
||||
</script>
|
||||
<script>
|
||||
$("#LoadAll").hide();
|
||||
|
||||
$(document).ready(function(){
|
||||
activePage = $('h1.page-header').attr('data-page');
|
||||
$("#"+activePage).addClass("active");
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
$("#LoadAll").on("click", function(){ draw_page("True"); });
|
||||
draw_page("False");
|
||||
// Reload every 30min
|
||||
setTimeout(function(){ location.reload(); }, 30*60*1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,99 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*-coding:UTF-8 -*
|
||||
|
||||
'''
|
||||
Flask functions and routes for the trending charts page
|
||||
'''
|
||||
# import os
|
||||
# import sys
|
||||
# import datetime
|
||||
# import flask
|
||||
# from flask import Flask, render_template, jsonify, request, Blueprint
|
||||
#
|
||||
# from Role_Manager import login_admin, login_read_only
|
||||
# from flask_login import login_required
|
||||
#
|
||||
# sys.path.append(os.environ['AIL_BIN'])
|
||||
# ##################################
|
||||
# # Import Project packages
|
||||
# ##################################
|
||||
# from packages.Date import Date
|
||||
#
|
||||
# # ============ VARIABLES ============
|
||||
# import Flask_config
|
||||
#
|
||||
# app = Flask_config.app
|
||||
# config_loader = Flask_config.config_loader
|
||||
# baseUrl = Flask_config.baseUrl
|
||||
# r_serv_charts = Flask_config.r_serv_charts
|
||||
#
|
||||
# trendings = Blueprint('trendings', __name__, template_folder='templates')
|
||||
#
|
||||
# # ============ FUNCTIONS ============
|
||||
#
|
||||
# def get_date_range(num_day):
|
||||
# curr_date = datetime.date.today()
|
||||
# date = Date(str(curr_date.year)+str(curr_date.month).zfill(2)+str(curr_date.day).zfill(2))
|
||||
# date_list = []
|
||||
#
|
||||
# for i in range(0, num_day+1):
|
||||
# date_list.append(date.substract_day(i))
|
||||
#
|
||||
# return date_list
|
||||
#
|
||||
#
|
||||
# # ============ ROUTES ============
|
||||
#
|
||||
# @trendings.route("/_progressionCharts", methods=['GET'])
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def progressionCharts():
|
||||
# attribute_name = request.args.get('attributeName')
|
||||
# trending_name = request.args.get('trendingName')
|
||||
# bar_requested = True if request.args.get('bar') == "true" else False
|
||||
#
|
||||
# if (bar_requested):
|
||||
# num_day = int(request.args.get('days'))
|
||||
# bar_values = []
|
||||
#
|
||||
# date_range = get_date_range(num_day)
|
||||
# # Retreive all data from the last num_day
|
||||
# for date in date_range:
|
||||
#
|
||||
# curr_value = r_serv_charts.hget(attribute_name, date)
|
||||
# bar_values.append([date[0:4]+'/'+date[4:6]+'/'+date[6:8], int(curr_value if curr_value is not None else 0)])
|
||||
# bar_values.insert(0, attribute_name)
|
||||
# return jsonify(bar_values)
|
||||
#
|
||||
# else:
|
||||
# redis_progression_name = "z_top_progression_" + trending_name
|
||||
# keyw_value = r_serv_charts.zrevrangebyscore(redis_progression_name, '+inf', '-inf', withscores=True, start=0, num=10)
|
||||
#
|
||||
# return jsonify(keyw_value)
|
||||
#
|
||||
# @trendings.route("/wordstrending/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def wordstrending():
|
||||
# default_display = config_loader.get_config_str("Flask", "default_display")
|
||||
# return render_template("Wordstrending.html", default_display = default_display)
|
||||
#
|
||||
#
|
||||
# @trendings.route("/protocolstrending/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def protocolstrending():
|
||||
# default_display = config_loader.get_config_str("Flask", "default_display")
|
||||
# return render_template("Protocolstrending.html", default_display = default_display)
|
||||
#
|
||||
#
|
||||
# @trendings.route("/trending/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def trending():
|
||||
# default_display = config_loader.get_config_str("Flask", "default_display")
|
||||
# return render_template("Trending.html", default_display = default_display)
|
||||
#
|
||||
#
|
||||
# # ========= REGISTRATION =========
|
||||
# app.register_blueprint(trendings, url_prefix=baseUrl)
|
|
@ -1,154 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
|
||||
<title>Trending Charts - AIL</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/dygraph_gallery.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!-- JS -->
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
|
||||
<script>
|
||||
var default_display = {{ default_display }};
|
||||
var current_displayed_graph;
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header" data-page="page-trendingchart">Trending charts</h1>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
<div class="row">
|
||||
|
||||
<!-- /.nav-tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#tld-tab" data-attribute-name="tld" data-pannel="TldTrending" data-path="../static//csv/tldstrendingdata.csv">Top level domains</a></li>
|
||||
<li><a data-toggle="tab" href="#domain-tab" data-attribute-name="domain" data-pannel="DomainTrending" data-path="../static//csv/domainstrendingdata.csv">Domains</a></li>
|
||||
<li><a data-toggle="tab" href="#protocol-tab" data-attribute-name="scheme" data-pannel="ProtocolTrending" data-path="../static//csv/protocolstrendingdata.csv">Protocols</a></li>
|
||||
<li><a data-toggle="tab" href="#words-tab" data-pannel="WordTrending" data-path="../static//csv/wordstrendingdata.csv">Words</a></li>
|
||||
</ul>
|
||||
</br>
|
||||
|
||||
<script>
|
||||
var chart_1_num_day = 5;
|
||||
var chart_2_num_day = 15;
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/trendingchart.js')}}"
|
||||
data-url_progressionCharts="{{ url_for('trendings.progressionCharts') }}">
|
||||
</script>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="col-lg-12 tab-pane fade in active" id="tld-tab" >
|
||||
{% include 'trending_graphs/Tldstrending.html' %}
|
||||
</div>
|
||||
<div class="col-lg-12 tab-pane fade" id="domain-tab">
|
||||
{% include 'trending_graphs/Domainstrending.html' %}
|
||||
</div>
|
||||
<div class="col-lg-12 tab-pane fade" id="protocol-tab">
|
||||
{% include 'trending_graphs/Protocolstrending.html' %}
|
||||
</div>
|
||||
<div class="col-lg-12 tab-pane fade" id="words-tab">
|
||||
{% include 'trending_graphs/Wordstrending.html' %}
|
||||
</div>
|
||||
</div> <!-- tab-content -->
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
|
||||
<!-- import graph function -->
|
||||
<script src="{{ url_for('static', filename='js/plot-graph.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var refresh_interval = 1000*60*2; //number of miliseconds between each call
|
||||
var launched_refresher = []; //Avoid launching mutliple refresher
|
||||
var active_tab_name = "tld"; //Avoid a redraw of the graph is the tab is not active
|
||||
function refresh_top_chart(attr_name, immediate){
|
||||
if (immediate){
|
||||
plot_top_graph(attr_name, true);
|
||||
binder(active_tab_name);
|
||||
}
|
||||
setTimeout(function() {
|
||||
$("[flash-"+attr_name+"]").css('color', '#fece00');
|
||||
setTimeout(function() { $("[flash-"+attr_name+"]").css('color', 'black'); }, 1000);
|
||||
refresh_top_chart(attr_name, false);
|
||||
if (active_tab_name == attr_name)
|
||||
plot_top_graph(attr_name, false);
|
||||
}, refresh_interval);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- instanciate and plot graphs -->
|
||||
<script type="text/javascript">
|
||||
// Create, plot and set the limit of displayed headers
|
||||
function create_and_plot(pannel, path){
|
||||
//var graph_domain = new Graph($(event.target).attr('data-pannel'), $(event.target).attr('data-path'));
|
||||
$.get(path, function(myContentFile) {
|
||||
var lines = myContentFile.split("\r\n");
|
||||
var header_size = lines[0].split(',').length-1;
|
||||
current_displayed_graph = new Graph(pannel, path, header_size);
|
||||
setTimeout(function() { current_displayed_graph.set_Visibility(default_display)}, 300);
|
||||
}, 'text');
|
||||
|
||||
}
|
||||
|
||||
// When a pannel is shown, create_and_plot.
|
||||
$('.nav-tabs a').on('shown.bs.tab', function(event){
|
||||
create_and_plot($(event.target).attr('data-pannel'), $(event.target).attr('data-path'));
|
||||
active_tab_name = $(event.target).attr('data-attribute-name')
|
||||
//Top progression chart
|
||||
if(launched_refresher.indexOf($(event.target).attr('data-attribute-name')) == -1){
|
||||
launched_refresher.push($(event.target).attr('data-attribute-name'));
|
||||
refresh_top_chart($(event.target).attr('data-attribute-name'), true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
activePage = $('h1.page-header').attr('data-page');
|
||||
$("#"+activePage).addClass("active");
|
||||
|
||||
$("[align]").css({padding: "2px", width: 'auto', 'background': "rgba(102, 102, 102, 0.15)" , 'border': "3px solid rgb(102, 102, 102)"})
|
||||
|
||||
// Create the graph when the page has just loaded
|
||||
create_and_plot("TldTrending", '../static//csv/tldstrendingdata.csv')
|
||||
//Top progression chart
|
||||
refresh_top_chart("tld", true);
|
||||
});
|
||||
|
||||
// Used when we modify the number of displayed curves
|
||||
function take_top(new_display){
|
||||
current_displayed_graph.set_Visibility_andHide(new_display, default_display);
|
||||
default_display = new_display;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-domain" class="glyphicon glyphicon-flash " flash-domain=""></i> Top Progression for the last 5 days
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph1-domain' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-pie-chart1-domain" style="height:250px; width:48%;"></div>
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart1-domain" style="height:250px; width:48%; margin: 5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-domain" class="glyphicon glyphicon-flash " flash-domain=""></i> Top Progression for the last 15 days
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph2-domain' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart2-domain" style="height:250px; width:100%; margin:5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-bar-chart-o fa-fw"></i> Top Domain Trending
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
|
||||
Actions
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="#" id="linear">Linear Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="log">Log Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="unzoom" onclick="unzoomGraph()">Unzoom</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="edit_graph">Edit graph words</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group btn-group-xs pull-right" style="margin-right: 5px;">
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<!-- <div id="DomainTrending" style="width:100%;"></div> -->
|
||||
<div id="DomainTrending" style="width:100%; height:800px;"></div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
|
@ -1,96 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-credential" class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-tld" class="fa fa-unlock" flash=""></i> <strong> Credential</strong> - most posted domain
|
||||
<b id="day-credential" class="pull-right">Today</b>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph-credential' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-6" id="flot-pie-chart-credential" style="height:250px; width:33%;"></div>
|
||||
<div class="flot-chart-content col-lg-6" id="flot-bar-chart-credential" style="height:250px; width:66%; margin-top: 5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-mail" class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-mail" class="fa fa-envelope" flash=""></i><strong> Mail</strong> - most posted domain (max 1 per paste)
|
||||
<b id="day-mail" class="pull-right">Today</b>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph-mail' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-6" id="flot-pie-chart-mail" style="height:250px; width:33%;"></div>
|
||||
<div class="flot-chart-content col-lg-6" id="flot-bar-chart-mail" style="height:250px; width:66%; margin-top: 5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-size" class="glyphicon glyphicon-transfer" flash=""></i><strong> Provider</strong>
|
||||
<b class="pull-right">Today</b>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="">
|
||||
<div class="col-lg-12">
|
||||
<h4 class="col-lg-3">Average paste size by provider </h4>
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph-size' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-6" id="flot-pie-chart-size" style="height:250px; width:33%;"></div>
|
||||
<div class="flot-chart-content col-lg-6" id="flot-bar-chart-size" style="height:250px; width:66%;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<h4 class="col-lg-3">Number of paste by provider </h4>
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph-num' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-6" id="flot-pie-chart-num" style="height:250px; width:33%;"></div>
|
||||
<div class="flot-chart-content col-lg-6" id="flot-bar-chart-num" style="height:250px; width:66%;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
|
@ -1,82 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-scheme" class="glyphicon glyphicon-flash " flash-scheme=""></i> Top Progression for the last 5 days
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph1-scheme' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-pie-chart1-scheme" style="height:250px; width:48%;"></div>
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart1-scheme" style="height:250px; width:48%; margin:5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-scheme" class="glyphicon glyphicon-flash " flash-scheme=""></i> Top Progression for the last 15 days
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph2-scheme' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart2-scheme" style="height:250px; width:100%; margin:5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-bar-chart-o fa-fw"></i> Protocols Trend
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
|
||||
Actions
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="#" id="linear">Linear Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="log">Log Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="unzoom" onclick="unzoomGraph()">Unzoom</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="edit_graph">Edit graph words</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group btn-group-xs pull-right" style="margin-right: 5px;">
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<!-- <div id="ProtocolsTrending" style="width:100%;"></div> -->
|
||||
<div id="ProtocolTrending" style="width:100%; height:800px;"></div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
|
@ -1,84 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i id="flash-tld" class="glyphicon glyphicon-flash " flash-tld=""></i> Top Progression for the last 5 days
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph1-tld' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-pie-chart1-tld" style="height:250px; width:48%;"></div>
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart1-tld" style="height:250px; width:48%; margin-top: 5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<div class="">
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="glyphicon glyphicon-flash " flash-tld=""></i> Top Progression for the last 15 days
|
||||
</div>
|
||||
<div id="flash-tld" class="panel-body">
|
||||
<div class="col-lg-12">
|
||||
<div class="flot-chart-content pull-right" id='tooltip_graph2-tld' align="right">No bar hovered</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="flot-chart-content col-lg-3" id="flot-bar-chart2-tld" style="height:250px; width:100%; margin-top: 5px;"><div class="alert alert-info">Click on a part</div></div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.panel -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-bar-chart-o fa-fw"></i> Top Level Domain Trending
|
||||
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
|
||||
Actions
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="#" id="linear">Linear Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="log">Log Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="unzoom" onclick="unzoomGraph()">Unzoom</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="edit_graph">Edit graph words</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group btn-group-xs pull-right" style="margin-right: 5px;">
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<!-- <div id="TldsTrending" style="width:100%;"></div> -->
|
||||
<div id="TldTrending" style="width:100%; height:800px;"></div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
|
@ -1,37 +0,0 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-bar-chart-o fa-fw"></i> Words Trend
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
|
||||
Actions
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="#" id="linear">Linear Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="log">Log Scale</a>
|
||||
</li>
|
||||
<li><a href="#" id="unzoom" onclick="unzoomGraph()">Unzoom</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="edit_graph">Edit graph words</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group btn-group-xs pull-right" style="margin-right: 5px;">
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
|
||||
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<!-- <div id="WordTrending" style="width:100%;"></div> -->
|
||||
<div id="WordTrending" style="width:100%; height:800px;"></div>
|
||||
</div>
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
|
@ -1,143 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*-coding:UTF-8 -*
|
||||
|
||||
'''
|
||||
Flask functions and routes for the trending modules page
|
||||
'''
|
||||
# import os
|
||||
# import sys
|
||||
# import datetime
|
||||
# import flask
|
||||
# from flask import Flask, render_template, jsonify, request, Blueprint
|
||||
#
|
||||
# from Role_Manager import login_admin, login_read_only
|
||||
# from flask_login import login_required
|
||||
#
|
||||
# sys.path.append(os.environ['AIL_BIN'])
|
||||
# ##################################
|
||||
# # Import Project packages
|
||||
# ##################################
|
||||
# from packages.Date import Date
|
||||
#
|
||||
# # ============ VARIABLES ============
|
||||
# import Flask_config
|
||||
#
|
||||
# app = Flask_config.app
|
||||
# baseUrl = Flask_config.baseUrl
|
||||
# r_serv_charts = Flask_config.r_serv_charts
|
||||
#
|
||||
# trendingmodules = Blueprint('trendingmodules', __name__, template_folder='templates')
|
||||
#
|
||||
# # ============ FUNCTIONS ============
|
||||
#
|
||||
# # Iterate over elements in the module provided and return the today data or the last data
|
||||
# # return format: [('passed_days', num_of_passed_days), ('elem_name1', elem_value1), ('elem_name2', elem_value2)]]
|
||||
# def get_top_relevant_data(server, module_name):
|
||||
# days = 0
|
||||
# for date in get_date_range(15):
|
||||
# redis_progression_name_set = 'top_'+ module_name +'_set_' + date
|
||||
# member_set = server.zrevrangebyscore(redis_progression_name_set, '+inf', '-inf', withscores=True)
|
||||
#
|
||||
# if len(member_set) == 0: #No data for this date
|
||||
# days += 1
|
||||
# else:
|
||||
# member_set.insert(0, ("passed_days", days))
|
||||
# return member_set
|
||||
#
|
||||
#
|
||||
# def get_date_range(num_day):
|
||||
# curr_date = datetime.date.today()
|
||||
# date = Date(str(curr_date.year)+str(curr_date.month).zfill(2)+str(curr_date.day).zfill(2))
|
||||
# date_list = []
|
||||
#
|
||||
# for i in range(0, num_day+1):
|
||||
# date_list.append(date.substract_day(i))
|
||||
# return date_list
|
||||
#
|
||||
# # ============ ROUTES ============
|
||||
#
|
||||
# @trendingmodules.route("/_moduleCharts", methods=['GET'])
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def modulesCharts():
|
||||
# keyword_name = request.args.get('keywordName')
|
||||
# module_name = request.args.get('moduleName')
|
||||
# bar_requested = True if request.args.get('bar') == "true" else False
|
||||
#
|
||||
# if (bar_requested):
|
||||
# num_day = int(request.args.get('days'))
|
||||
# bar_values = []
|
||||
#
|
||||
# date_range = get_date_range(num_day)
|
||||
# # Retreive all data from the last num_day
|
||||
# for date in date_range:
|
||||
# curr_value = r_serv_charts.hget(date, module_name+'-'+keyword_name)
|
||||
# bar_values.append([date[0:4]+'/'+date[4:6]+'/'+date[6:8], int(curr_value if curr_value is not None else 0)])
|
||||
# bar_values.insert(0, keyword_name)
|
||||
# return jsonify(bar_values)
|
||||
#
|
||||
# else:
|
||||
# member_set = get_top_relevant_data(r_serv_charts, module_name)
|
||||
# member_set = member_set if member_set is not None else []
|
||||
# if len(member_set) == 0:
|
||||
# member_set.append(("No relevant data", int(100)))
|
||||
# return jsonify(member_set)
|
||||
#
|
||||
#
|
||||
# @trendingmodules.route("/_providersChart", methods=['GET'])
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def providersChart():
|
||||
# keyword_name = request.args.get('keywordName')
|
||||
# module_name = request.args.get('moduleName')
|
||||
# bar_requested = True if request.args.get('bar') == "true" else False
|
||||
#
|
||||
# if (bar_requested):
|
||||
# num_day = int(request.args.get('days'))
|
||||
# bar_values = []
|
||||
#
|
||||
# date_range = get_date_range(num_day)
|
||||
# # Retreive all data from the last num_day
|
||||
# for date in date_range:
|
||||
# curr_value_size = ( r_serv_charts.hget(keyword_name+'_'+'size', date) )
|
||||
# if curr_value_size is not None:
|
||||
# curr_value_size = curr_value_size
|
||||
#
|
||||
# curr_value_num = r_serv_charts.hget(keyword_name+'_'+'num', date)
|
||||
#
|
||||
# curr_value_size_avg = r_serv_charts.hget(keyword_name+'_'+'avg', date)
|
||||
# if curr_value_size_avg is not None:
|
||||
# curr_value_size_avg = curr_value_size_avg
|
||||
#
|
||||
#
|
||||
# if module_name == "size":
|
||||
# curr_value = float(curr_value_size_avg if curr_value_size_avg is not None else 0)
|
||||
# else:
|
||||
# curr_value = float(curr_value_num if curr_value_num is not None else 0.0)
|
||||
#
|
||||
# bar_values.append([date[0:4]+'/'+date[4:6]+'/'+date[6:8], curr_value])
|
||||
# bar_values.insert(0, keyword_name)
|
||||
# return jsonify(bar_values)
|
||||
#
|
||||
# else:
|
||||
# #redis_provider_name_set = 'top_size_set' if module_name == "size" else 'providers_set'
|
||||
# redis_provider_name_set = 'top_avg_size_set_' if module_name == "size" else 'providers_set_'
|
||||
# redis_provider_name_set = redis_provider_name_set + get_date_range(0)[0]
|
||||
#
|
||||
# member_set = r_serv_charts.zrevrangebyscore(redis_provider_name_set, '+inf', '-inf', withscores=True, start=0, num=8)
|
||||
#
|
||||
# # Member set is a list of (value, score) pairs
|
||||
# if len(member_set) == 0:
|
||||
# member_set.append(("No relevant data", float(100)))
|
||||
# return jsonify(member_set)
|
||||
#
|
||||
#
|
||||
# @trendingmodules.route("/moduletrending/")
|
||||
# @login_required
|
||||
# @login_read_only
|
||||
# def moduletrending():
|
||||
# return render_template("Moduletrending.html")
|
||||
#
|
||||
#
|
||||
# # ========= REGISTRATION =========
|
||||
# app.register_blueprint(trendingmodules, url_prefix=baseUrl)
|
|
@ -1,73 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Modules Statistics - AIL</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/dygraph_gallery.css') }}" rel="stylesheet" type="text/css" />
|
||||
<!-- JS -->
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
</br>
|
||||
{% include 'trending_graphs/Moduletrending.html' %}
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
|
||||
<script>
|
||||
var chart_1_num_day = 5;
|
||||
var chart_2_num_day = 15;
|
||||
</script>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/moduleTrending.js') }}"
|
||||
data-url_providersChart="{{ url_for('trendingmodules.providersChart') }}"
|
||||
data-url_moduleCharts="{{ url_for('trendingmodules.modulesCharts') }}">
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
activePage = "page-modulestats"
|
||||
$("#"+activePage).addClass("active");
|
||||
|
||||
$("[align]").css({padding: "2px", width: 'auto', 'background': "rgba(102, 102, 102, 0.15)" , 'border': "3px solid rgb(102, 102, 102)"})
|
||||
|
||||
refreshPlot(true);
|
||||
});
|
||||
|
||||
function refreshPlot(init){
|
||||
refreshAnimation();
|
||||
|
||||
plot_top_graph("credential", init);
|
||||
plot_top_graph("mail", init);
|
||||
plot_top_graph("size", init);
|
||||
plot_top_graph("num", init);
|
||||
|
||||
setTimeout(function(){ refreshPlot(false); }, 10000);
|
||||
}
|
||||
|
||||
function refreshAnimation(){
|
||||
$("[flash]").css('color', '#fece00');
|
||||
setTimeout(function() { $("[flash]").css('color', 'black'); }, 1000);
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
{#
|
||||
<li id='page-modulestats'><a href="{{ url_for('trendingmodules.moduletrending') }}"><i class="glyphicon glyphicon-stats"></i> Modules statistics</a></li>
|
||||
#}
|
|
@ -1,42 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Analysis Information Leak framework Dashboard</title>
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<!-- JS -->
|
||||
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header" data-page="page-termsfrequency" >MODULENAME</h1>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
activePage = "page-MODULENAME"
|
||||
$("#"+activePage).addClass("active");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<div id="wrapper">
|
||||
<div class="navbar navbar-inverse navbar-static-top nav">
|
||||
{% include 'header.html' %}
|
||||
<!-- /.navbar-top-links -->
|
||||
<div class="navbar-default sidebar" role="navigation">
|
||||
<div class="sidebar-collapse">
|
||||
<ul class="nav" id="side-menu">
|
||||
<li class="sidebar-search">
|
||||
{% include 'searchbox.html' %}
|
||||
</li>
|
||||
</ul>
|
||||
<!-- /#side-menu -->
|
||||
</div>
|
||||
<!-- /.sidebar-collapse -->
|
||||
<a href="{{ url_for('dashboard.index') }}"><img src="{{ url_for('static', filename='image/ail-project.png') }}" style="width:200px;"/></a>
|
||||
</div>
|
||||
<!-- /.navbar-static-side -->
|
||||
</div>
|
||||
</div>
|
|
@ -8,7 +8,7 @@ git submodule update
|
|||
wget -q http://dygraphs.com/dygraph-combined.js -O ./static/js/dygraph-combined.js
|
||||
|
||||
BOOTSTRAP_VERSION='4.2.1'
|
||||
FONT_AWESOME_VERSION='5.7.1'
|
||||
FONT_AWESOME_VERSION='6.6.0'
|
||||
|
||||
D3_JS_VERSION='5.16.0'
|
||||
wget https://d3js.org/d3.v7.min.js -O ./static/js/d3.v7.min.js
|
||||
|
@ -17,8 +17,7 @@ rm -rf temp
|
|||
mkdir temp
|
||||
|
||||
wget https://github.com/twbs/bootstrap/releases/download/v${BOOTSTRAP_VERSION}/bootstrap-${BOOTSTRAP_VERSION}-dist.zip -O temp/bootstrap${BOOTSTRAP_VERSION}.zip
|
||||
wget https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip -O temp/FONT_AWESOME_4.7.0.zip
|
||||
wget https://github.com/FortAwesome/Font-Awesome/archive/5.7.1.zip -O temp/FONT_AWESOME_${FONT_AWESOME_VERSION}.zip
|
||||
wget https://github.com/FortAwesome/Font-Awesome/archive/${FONT_AWESOME_VERSION}.zip -O temp/FONT_AWESOME_${FONT_AWESOME_VERSION}.zip
|
||||
wget https://github.com/d3/d3/releases/download/v${D3_JS_VERSION}/d3.zip -O temp/d3_${D3_JS_VERSION}.zip
|
||||
|
||||
# dateRangePicker
|
||||
|
@ -26,8 +25,7 @@ wget https://github.com/moment/moment/archive/2.24.0.zip -O temp/moment.zip
|
|||
wget https://github.com/longbill/jquery-date-range-picker/archive/v0.20.0.zip -O temp/daterangepicker.zip
|
||||
|
||||
unzip -qq temp/bootstrap${BOOTSTRAP_VERSION}.zip -d temp/
|
||||
unzip -qq temp/FONT_AWESOME_4.7.0.zip -d temp/
|
||||
unzip -qq temp/FONT_AWESOME_${FONT_AWESOME_VERSION}.zip -d temp/
|
||||
unzip temp/FONT_AWESOME_${FONT_AWESOME_VERSION}.zip -d temp/
|
||||
unzip -qq temp/d3_${D3_JS_VERSION}.zip -d temp/
|
||||
|
||||
unzip -qq temp/moment.zip -d temp/
|
||||
|
@ -38,8 +36,6 @@ mv temp/bootstrap-${BOOTSTRAP_VERSION}-dist/js/bootstrap.min.js.map ./static/js/
|
|||
mv temp/bootstrap-${BOOTSTRAP_VERSION}-dist/css/bootstrap.min.css ./static/css/bootstrap4.min.css
|
||||
mv temp/bootstrap-${BOOTSTRAP_VERSION}-dist/css/bootstrap.min.css.map ./static/css/bootstrap4.min.css.map
|
||||
|
||||
mv temp/Font-Awesome-4.7.0 temp/font-awesome
|
||||
|
||||
rm -rf ./static/webfonts/
|
||||
mv temp/Font-Awesome-${FONT_AWESOME_VERSION}/css/all.min.css ./static/css/font-awesome.min.css
|
||||
mv temp/Font-Awesome-${FONT_AWESOME_VERSION}/webfonts ./static/webfonts
|
||||
|
|
Loading…
Reference in a new issue