mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 15:57:16 +00:00
chg: [UI show Item] refactoring + bootstrap 4 migration
This commit is contained in:
parent
eec64c3bc7
commit
afc7cfc77d
33 changed files with 910 additions and 45 deletions
|
@ -23,7 +23,7 @@ sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
|
||||||
import Tracker
|
import Tracker
|
||||||
import regex_helper
|
import regex_helper
|
||||||
|
|
||||||
full_item_url = "/showsavedpaste/?paste="
|
full_item_url = "/object/item?id="
|
||||||
mail_body_template = "AIL Framework,\nNew occurrence for term tracked regex: {}\nitem id: {}\nurl: {}{}"
|
mail_body_template = "AIL Framework,\nNew occurrence for term tracked regex: {}\nitem id: {}\nurl: {}{}"
|
||||||
|
|
||||||
dict_regex_tracked = Term.get_regex_tracked_words_dict()
|
dict_regex_tracked = Term.get_regex_tracked_words_dict()
|
||||||
|
|
|
@ -20,7 +20,7 @@ from packages import Term
|
||||||
|
|
||||||
from lib import Tracker
|
from lib import Tracker
|
||||||
|
|
||||||
full_item_url = "/showsavedpaste/?paste="
|
full_item_url = "/object/item/?id="
|
||||||
|
|
||||||
mail_body_template = "AIL Framework,\nNew occurrence for term tracked term: {}\nitem id: {}\nurl: {}{}"
|
mail_body_template = "AIL Framework,\nNew occurrence for term tracked term: {}\nitem id: {}\nurl: {}{}"
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,24 @@ from uuid import uuid4
|
||||||
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
|
||||||
import ConfigLoader
|
import ConfigLoader
|
||||||
|
|
||||||
|
sys.path.append('../../configs/keys')
|
||||||
|
try:
|
||||||
|
from thehive4py.api import TheHiveApi
|
||||||
|
import thehive4py.exceptions
|
||||||
|
from theHiveKEYS import the_hive_url, the_hive_key, the_hive_verifycert
|
||||||
|
if the_hive_url == '':
|
||||||
|
is_hive_connected = False
|
||||||
|
else:
|
||||||
|
is_hive_connected = TheHiveApi(the_hive_url, the_hive_key, cert=the_hive_verifycert)
|
||||||
|
except:
|
||||||
|
is_hive_connected = False
|
||||||
|
if is_hive_connected != False:
|
||||||
|
try:
|
||||||
|
is_hive_connected.get_alert(0)
|
||||||
|
is_hive_connected = True
|
||||||
|
except thehive4py.exceptions.AlertException:
|
||||||
|
is_hive_connected = False
|
||||||
|
|
||||||
## LOAD CONFIG ##
|
## LOAD CONFIG ##
|
||||||
config_loader = ConfigLoader.ConfigLoader()
|
config_loader = ConfigLoader.ConfigLoader()
|
||||||
r_serv_cache = config_loader.get_redis_conn("Redis_Cache")
|
r_serv_cache = config_loader.get_redis_conn("Redis_Cache")
|
||||||
|
@ -37,6 +55,16 @@ def load_tags_to_export_in_cache():
|
||||||
# save combinaison of tags in cache
|
# save combinaison of tags in cache
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def is_hive_connected(): # # TODO: REFRACTOR, put in cache (with retry)
|
||||||
|
return is_hive_connected
|
||||||
|
|
||||||
|
def get_item_hive_cases(item_id):
|
||||||
|
hive_case = r_serv_metadata.get('hive_cases:{}'.format(item_id))
|
||||||
|
if hive_case:
|
||||||
|
hive_case = the_hive_url + '/index.html#/case/{}/details'.format(hive_case)
|
||||||
|
return hive_case
|
||||||
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# # set default
|
# # set default
|
||||||
# if r_serv_db.get('hive:auto-alerts') is None:
|
# if r_serv_db.get('hive:auto-alerts') is None:
|
||||||
|
|
|
@ -223,8 +223,8 @@ def get_item_url(correlation_name, value, correlation_type=None):
|
||||||
endpoint = 'crawler_splash.showDomain'
|
endpoint = 'crawler_splash.showDomain'
|
||||||
url = url_for(endpoint, domain=value)
|
url = url_for(endpoint, domain=value)
|
||||||
elif correlation_name == 'item':
|
elif correlation_name == 'item':
|
||||||
endpoint = 'showsavedpastes.showsavedpaste'
|
endpoint = 'objects_item.showItem'
|
||||||
url = url_for(endpoint, paste=value)
|
url = url_for(endpoint, id=value)
|
||||||
elif correlation_name == 'paste': ### # TODO: remove me
|
elif correlation_name == 'paste': ### # TODO: remove me
|
||||||
endpoint = 'showsavedpastes.showsavedpaste'
|
endpoint = 'showsavedpastes.showsavedpaste'
|
||||||
url = url_for(endpoint, paste=value)
|
url = url_for(endpoint, paste=value)
|
||||||
|
|
|
@ -113,9 +113,6 @@ def get_item_parent(item_id):
|
||||||
def get_item_children(item_id):
|
def get_item_children(item_id):
|
||||||
return list(r_serv_metadata.smembers('paste_children:{}'.format(item_id)))
|
return list(r_serv_metadata.smembers('paste_children:{}'.format(item_id)))
|
||||||
|
|
||||||
def add_item_parent(item_parent, item_id):
|
|
||||||
return item_basic.add_item_parent(item_parent, item_id)
|
|
||||||
|
|
||||||
# # TODO: handle domain last origin in domain lib
|
# # TODO: handle domain last origin in domain lib
|
||||||
def _delete_node(item_id):
|
def _delete_node(item_id):
|
||||||
# only if item isn't deleted
|
# only if item isn't deleted
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import redis
|
import redis
|
||||||
|
import html2text
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
@ -59,6 +60,9 @@ def get_item_basename(item_id):
|
||||||
def get_item_size(item_id):
|
def get_item_size(item_id):
|
||||||
return round(os.path.getsize(os.path.join(PASTES_FOLDER, item_id))/1024.0, 2)
|
return round(os.path.getsize(os.path.join(PASTES_FOLDER, item_id))/1024.0, 2)
|
||||||
|
|
||||||
|
def get_item_encoding(item_id):
|
||||||
|
return None
|
||||||
|
|
||||||
def get_lines_info(item_id, item_content=None):
|
def get_lines_info(item_id, item_content=None):
|
||||||
if not item_content:
|
if not item_content:
|
||||||
item_content = get_item_content(item_id)
|
item_content = get_item_content(item_id)
|
||||||
|
@ -73,9 +77,37 @@ def get_lines_info(item_id, item_content=None):
|
||||||
return {'nb': nb_line, 'max_length': max_length}
|
return {'nb': nb_line, 'max_length': max_length}
|
||||||
|
|
||||||
|
|
||||||
|
def get_item_metadata(item_id, item_content=None):
|
||||||
|
## TODO: FIXME ##performance
|
||||||
|
# encoding
|
||||||
|
# language
|
||||||
|
# lines info
|
||||||
|
|
||||||
|
item_metadata = {}
|
||||||
|
item_metadata['date'] = get_item_date(item_id, add_separator=True)
|
||||||
|
item_metadata['source'] = get_source(item_id)
|
||||||
|
item_metadata['size'] = get_item_size(item_id)
|
||||||
|
item_metadata['encoding'] = get_item_encoding(item_id)
|
||||||
|
item_metadata['lines'] = get_lines_info(item_id, item_content=item_content)
|
||||||
|
|
||||||
|
return item_metadata
|
||||||
|
|
||||||
|
def get_item_parent(item_id):
|
||||||
|
return item_basic.get_item_parent(item_id)
|
||||||
|
|
||||||
|
def add_item_parent(item_parent, item_id):
|
||||||
|
return item_basic.add_item_parent(item_parent, item_id)
|
||||||
|
|
||||||
def get_item_content(item_id):
|
def get_item_content(item_id):
|
||||||
return item_basic.get_item_content(item_id)
|
return item_basic.get_item_content(item_id)
|
||||||
|
|
||||||
|
def get_item_content_html2text(item_id, item_content=None):
|
||||||
|
if not item_content:
|
||||||
|
item_content = get_item_content(item_id)
|
||||||
|
h = html2text.HTML2Text()
|
||||||
|
h.ignore_links = False
|
||||||
|
return h.handle(item_content)
|
||||||
|
|
||||||
# API
|
# API
|
||||||
def get_item(request_dict):
|
def get_item(request_dict):
|
||||||
if not request_dict:
|
if not request_dict:
|
||||||
|
@ -257,6 +289,18 @@ def get_item_list_desc(list_item_id):
|
||||||
def is_crawled(item_id):
|
def is_crawled(item_id):
|
||||||
return item_basic.is_crawled(item_id)
|
return item_basic.is_crawled(item_id)
|
||||||
|
|
||||||
|
def get_crawler_matadata(item_id, ltags=None):
|
||||||
|
dict_crawler = {}
|
||||||
|
if is_crawled(item_id):
|
||||||
|
dict_crawler['domain'] = get_item_domain(item_id)
|
||||||
|
if not ltags:
|
||||||
|
ltags = Tag.get_obj_tag(item_id)
|
||||||
|
dict_crawler['is_tags_safe'] = Tag.is_tags_safe(ltags)
|
||||||
|
dict_crawler['url'] = get_item_link(item_id)
|
||||||
|
dict_crawler['screenshot'] = get_item_screenshot(item_id)
|
||||||
|
dict_crawler['har'] = get_item_har_name(item_id)
|
||||||
|
return dict_crawler
|
||||||
|
|
||||||
def is_onion(item_id):
|
def is_onion(item_id):
|
||||||
is_onion = False
|
is_onion = False
|
||||||
if len(is_onion) > 62:
|
if len(is_onion) > 62:
|
||||||
|
@ -293,7 +337,7 @@ def get_item_screenshot(item_id):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def get_item_har_name(item_id):
|
def get_item_har_name(item_id):
|
||||||
os.path.join(screenshot_directory, item_id) + '.json'
|
har_path = os.path.join(screenshot_directory, item_id) + '.json'
|
||||||
if os.path.isfile(har_path):
|
if os.path.isfile(har_path):
|
||||||
return har_path
|
return har_path
|
||||||
else:
|
else:
|
||||||
|
@ -322,6 +366,24 @@ def get_item_duplicate(item_id, r_list=True):
|
||||||
return []
|
return []
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def get_item_nb_duplicates(item_id):
|
||||||
|
return r_serv_metadata.scard('dup:{}'.format(item_id))
|
||||||
|
|
||||||
|
def get_item_duplicates_dict(item_id):
|
||||||
|
dict_duplicates = {}
|
||||||
|
for duplicate in get_item_duplicate(item_id):
|
||||||
|
duplicate = duplicate[1:-1].replace('\'', '').replace(' ', '').split(',')
|
||||||
|
duplicate_id = duplicate[1]
|
||||||
|
if not duplicate_id in dict_duplicates:
|
||||||
|
dict_duplicates[duplicate_id] = {'date': get_item_date(duplicate_id, add_separator=True), 'algo': {}}
|
||||||
|
algo = duplicate[0]
|
||||||
|
if algo == 'tlsh':
|
||||||
|
similarity = 100 - int(duplicate[2])
|
||||||
|
else:
|
||||||
|
similarity = int(duplicate[2])
|
||||||
|
dict_duplicates[duplicate_id]['algo'][algo] = similarity
|
||||||
|
return dict_duplicates
|
||||||
|
|
||||||
def add_item_duplicate(item_id, l_dup):
|
def add_item_duplicate(item_id, l_dup):
|
||||||
for item_dup in l_dup:
|
for item_dup in l_dup:
|
||||||
r_serv_metadata.sadd('dup:{}'.format(item_dup), item_id)
|
r_serv_metadata.sadd('dup:{}'.format(item_dup), item_id)
|
||||||
|
|
|
@ -24,7 +24,7 @@ import Tracker
|
||||||
import item_basic
|
import item_basic
|
||||||
|
|
||||||
|
|
||||||
full_item_url = "/showsavedpaste/?paste="
|
full_item_url = "/object/item?id="
|
||||||
mail_body_template = "AIL Framework,\nNew YARA match: {}\nitem id: {}\nurl: {}{}"
|
mail_body_template = "AIL Framework,\nNew YARA match: {}\nitem id: {}\nurl: {}{}"
|
||||||
|
|
||||||
last_refresh = time.time()
|
last_refresh = time.time()
|
||||||
|
|
|
@ -22,6 +22,7 @@ textblob
|
||||||
#Tokeniser
|
#Tokeniser
|
||||||
nltk
|
nltk
|
||||||
|
|
||||||
|
html2text
|
||||||
yara-python
|
yara-python
|
||||||
|
|
||||||
#Crawler
|
#Crawler
|
||||||
|
|
29
update/v3.3/Update.py
Executable file
29
update/v3.3/Update.py
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*-coding:UTF-8 -*
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import redis
|
||||||
|
import argparse
|
||||||
|
import datetime
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/'))
|
||||||
|
import ConfigLoader
|
||||||
|
|
||||||
|
new_version = 'v3.3'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
start_deb = time.time()
|
||||||
|
|
||||||
|
config_loader = ConfigLoader.ConfigLoader()
|
||||||
|
r_serv_db = config_loader.get_redis_conn("ARDB_DB")
|
||||||
|
config_loader = None
|
||||||
|
|
||||||
|
#Set current ail version
|
||||||
|
r_serv_db.set('ail:version', new_version)
|
||||||
|
|
||||||
|
#Set current ail version
|
||||||
|
r_serv_db.hset('ail:update_date', new_version, datetime.datetime.now().strftime("%Y%m%d"))
|
54
update/v3.3/Update.sh
Executable file
54
update/v3.3/Update.sh
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_REDIS" ] && echo "Needs the env var AIL_REDIS. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_ARDB" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_BIN" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_FLASK" ] && echo "Needs the env var AIL_FLASK. Run the script from the virtual environment." && exit 1;
|
||||||
|
|
||||||
|
export PATH=$AIL_HOME:$PATH
|
||||||
|
export PATH=$AIL_REDIS:$PATH
|
||||||
|
export PATH=$AIL_ARDB:$PATH
|
||||||
|
export PATH=$AIL_BIN:$PATH
|
||||||
|
export PATH=$AIL_FLASK:$PATH
|
||||||
|
|
||||||
|
GREEN="\\033[1;32m"
|
||||||
|
DEFAULT="\\033[0;39m"
|
||||||
|
|
||||||
|
echo -e $GREEN"Shutting down AIL ..."$DEFAULT
|
||||||
|
bash ${AIL_BIN}/LAUNCH.sh -ks
|
||||||
|
wait
|
||||||
|
|
||||||
|
bash ${AIL_BIN}/LAUNCH.sh -ldbv &
|
||||||
|
wait
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# SUBMODULES #
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
# echo ""
|
||||||
|
# echo -e $GREEN"installing KVORCKS ..."$DEFAULT
|
||||||
|
# cd ${AIL_HOME}
|
||||||
|
# test ! -d kvrocks/ && git clone https://github.com/bitleak/kvrocks.git
|
||||||
|
# pushd kvrocks/
|
||||||
|
# make -j4
|
||||||
|
# popd
|
||||||
|
|
||||||
|
echo -e $GREEN"Installing html2text ..."$DEFAULT
|
||||||
|
pip3 install html2text
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e $GREEN"Updating AIL VERSION ..."$DEFAULT
|
||||||
|
echo ""
|
||||||
|
python ${AIL_HOME}/update/v3.3/Update.py
|
||||||
|
wait
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e $GREEN"Shutting down ARDB ..."$DEFAULT
|
||||||
|
bash ${AIL_BIN}/LAUNCH.sh -ks
|
||||||
|
wait
|
||||||
|
|
||||||
|
exit 0
|
|
@ -42,6 +42,8 @@ from blueprints.crawler_splash import crawler_splash
|
||||||
from blueprints.correlation import correlation
|
from blueprints.correlation import correlation
|
||||||
from blueprints.tags_ui import tags_ui
|
from blueprints.tags_ui import tags_ui
|
||||||
from blueprints.import_export import import_export
|
from blueprints.import_export import import_export
|
||||||
|
from blueprints.objects_item import objects_item
|
||||||
|
from blueprints.old_endpoints import old_endpoints
|
||||||
|
|
||||||
|
|
||||||
Flask_dir = os.environ['AIL_FLASK']
|
Flask_dir = os.environ['AIL_FLASK']
|
||||||
|
@ -97,6 +99,8 @@ app.register_blueprint(crawler_splash, url_prefix=baseUrl)
|
||||||
app.register_blueprint(correlation, url_prefix=baseUrl)
|
app.register_blueprint(correlation, url_prefix=baseUrl)
|
||||||
app.register_blueprint(tags_ui, url_prefix=baseUrl)
|
app.register_blueprint(tags_ui, url_prefix=baseUrl)
|
||||||
app.register_blueprint(import_export, url_prefix=baseUrl)
|
app.register_blueprint(import_export, url_prefix=baseUrl)
|
||||||
|
app.register_blueprint(objects_item, url_prefix=baseUrl)
|
||||||
|
app.register_blueprint(old_endpoints, url_prefix=baseUrl)
|
||||||
# ========= =========#
|
# ========= =========#
|
||||||
|
|
||||||
# ========= Cookie name ========
|
# ========= Cookie name ========
|
||||||
|
|
97
var/www/blueprints/objects_item.py
Normal file
97
var/www/blueprints/objects_item.py
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*-coding:UTF-8 -*
|
||||||
|
|
||||||
|
'''
|
||||||
|
Blueprint Flask: crawler splash endpoints: dashboard, onion crawler ...
|
||||||
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for, Response, abort, send_file
|
||||||
|
from flask_login import login_required, current_user
|
||||||
|
|
||||||
|
# Import Role_Manager
|
||||||
|
from Role_Manager import login_admin, login_analyst, login_read_only
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages'))
|
||||||
|
import Item
|
||||||
|
import Tag
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'export'))
|
||||||
|
import Export
|
||||||
|
|
||||||
|
# ============ BLUEPRINT ============
|
||||||
|
objects_item = Blueprint('objects_item', __name__, template_folder=os.path.join(os.environ['AIL_FLASK'], 'templates/objects/item'))
|
||||||
|
|
||||||
|
# ============ VARIABLES ============
|
||||||
|
bootstrap_label = ['primary', 'success', 'danger', 'warning', 'info']
|
||||||
|
|
||||||
|
|
||||||
|
# ============ FUNCTIONS ============
|
||||||
|
|
||||||
|
|
||||||
|
# ============= ROUTES ==============
|
||||||
|
@objects_item.route("/object/item") #completely shows the paste in a new tab
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def showItem(): # # TODO: support post
|
||||||
|
item_id = request.args.get('id')
|
||||||
|
if not item_id or not Item.exist_item(item_id):
|
||||||
|
abort(404)
|
||||||
|
|
||||||
|
dict_item = {}
|
||||||
|
dict_item['id'] = item_id
|
||||||
|
dict_item['name'] = dict_item['id'].replace('/', ' / ')
|
||||||
|
dict_item['father'] = Item.get_item_parent(item_id)
|
||||||
|
dict_item['content'] = Item.get_item_content(item_id)
|
||||||
|
dict_item['metadata'] = Item.get_item_metadata(item_id, item_content=dict_item['content'])
|
||||||
|
dict_item['tags'] = Tag.get_obj_tag(item_id)
|
||||||
|
#dict_item['duplicates'] = Item.get_item_nb_duplicates(item_id)
|
||||||
|
dict_item['duplicates'] = Item.get_item_duplicates_dict(item_id)
|
||||||
|
dict_item['crawler'] = Item.get_crawler_matadata(item_id, ltags=dict_item['tags'])
|
||||||
|
|
||||||
|
## EXPORT SECTION
|
||||||
|
# # TODO: ADD in Export SECTION
|
||||||
|
dict_item['hive_case'] = Export.get_item_hive_cases(item_id)
|
||||||
|
|
||||||
|
return render_template("show_item.html", bootstrap_label=bootstrap_label,
|
||||||
|
modal_add_tags=Tag.get_modal_add_tags(dict_item['id'], object_type='item'),
|
||||||
|
is_hive_connected=Export.get_item_hive_cases(item_id),
|
||||||
|
dict_item=dict_item)
|
||||||
|
|
||||||
|
# kvrocks data
|
||||||
|
|
||||||
|
# # TODO: dynamic load:
|
||||||
|
## duplicates
|
||||||
|
## correlations
|
||||||
|
|
||||||
|
## Dynamic Path FIX
|
||||||
|
|
||||||
|
@objects_item.route("/object/item/html2text")
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def html2text(): # # TODO: support post
|
||||||
|
item_id = request.args.get('id')
|
||||||
|
if not item_id or not Item.exist_item(item_id):
|
||||||
|
abort(404)
|
||||||
|
return Item.get_item_content_html2text(item_id)
|
||||||
|
|
||||||
|
@objects_item.route("/object/item/raw_content")
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def item_raw_content(): # # TODO: support post
|
||||||
|
item_id = request.args.get('id')
|
||||||
|
if not item_id or not Item.exist_item(item_id):
|
||||||
|
abort(404)
|
||||||
|
return Response(Item.get_item_content(item_id), mimetype='text/plain')
|
||||||
|
|
||||||
|
@objects_item.route("/object/item/download")
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def item_download(): # # TODO: support post
|
||||||
|
item_id = request.args.get('id')
|
||||||
|
if not item_id or not Item.exist_item(item_id):
|
||||||
|
abort(404)
|
||||||
|
return send_file(Item.get_raw_content(item_id), attachment_filename=item_id, as_attachment=True)
|
34
var/www/blueprints/old_endpoints.py
Normal file
34
var/www/blueprints/old_endpoints.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*-coding:UTF-8 -*
|
||||||
|
|
||||||
|
'''
|
||||||
|
Blueprint Flask: crawler splash endpoints: dashboard, onion crawler ...
|
||||||
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for, Response
|
||||||
|
from flask_login import login_required, current_user
|
||||||
|
|
||||||
|
# Import Role_Manager
|
||||||
|
from Role_Manager import login_admin, login_analyst, login_read_only
|
||||||
|
|
||||||
|
# ============ BLUEPRINT ============
|
||||||
|
old_endpoints = Blueprint('old_endpoints', __name__, template_folder=os.path.join(os.environ['AIL_FLASK'], 'templates'))
|
||||||
|
|
||||||
|
# ============ VARIABLES ============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ============ FUNCTIONS ============
|
||||||
|
|
||||||
|
|
||||||
|
# ============= ROUTES ==============
|
||||||
|
@old_endpoints.route("/showsavedpaste/")
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def showsavedpaste():
|
||||||
|
item_id = request.args.get('paste', '')
|
||||||
|
return redirect(url_for('objects_item.showItem', id=item_id))
|
|
@ -358,7 +358,7 @@ def submit_status():
|
||||||
link = ''
|
link = ''
|
||||||
if paste_submit_link:
|
if paste_submit_link:
|
||||||
for paste in paste_submit_link:
|
for paste in paste_submit_link:
|
||||||
url = url_for('showsavedpastes.showsavedpaste') + '?paste=' + paste
|
url = url_for('objects_item.showItem') + '?id=' + paste
|
||||||
link += '<a target="_blank" href="' + url + '" class="list-group-item">' + paste +'</a>'
|
link += '<a target="_blank" href="' + url + '" class="list-group-item">' + paste +'</a>'
|
||||||
|
|
||||||
if nb_total == '-1':
|
if nb_total == '-1':
|
||||||
|
|
|
@ -377,7 +377,7 @@ def remove_tag(): #TODO remove me , used by showpaste
|
||||||
res = Tag.api_delete_obj_tags(tags=[tag], object_id=path, object_type="item")
|
res = Tag.api_delete_obj_tags(tags=[tag], object_id=path, object_type="item")
|
||||||
if res[1] != 200:
|
if res[1] != 200:
|
||||||
return str(res[0])
|
return str(res[0])
|
||||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
return redirect(url_for('objects_item.showItem', id=path))
|
||||||
|
|
||||||
@Tags.route("/Tags/confirm_tag")
|
@Tags.route("/Tags/confirm_tag")
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -395,7 +395,7 @@ def confirm_tag():
|
||||||
#add analyst tag
|
#add analyst tag
|
||||||
Tag.add_tag('item', tag, path)
|
Tag.add_tag('item', tag, path)
|
||||||
|
|
||||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
return redirect(url_for('objects_item.showItem', id=path))
|
||||||
|
|
||||||
return 'incompatible tag'
|
return 'incompatible tag'
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ def tag_validation():
|
||||||
r_serv_statistics.sadd('fp:'+tag, path)
|
r_serv_statistics.sadd('fp:'+tag, path)
|
||||||
r_serv_statistics.srem('tp:'+tag, path)
|
r_serv_statistics.srem('tp:'+tag, path)
|
||||||
|
|
||||||
return redirect(url_for('showsavedpastes.showsavedpaste', paste=path))
|
return redirect(url_for('objects_item.showItem', id=path))
|
||||||
else:
|
else:
|
||||||
return 'input error'
|
return 'input error'
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
{% for path in all_path %}
|
{% for path in all_path %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pb-0">{{ paste_date[loop.index0] }}</td>
|
<td class="pb-0">{{ paste_date[loop.index0] }}</td>
|
||||||
<td class="pb-0"><a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{path}}" class="text-secondary">
|
<td class="pb-0"><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{path}}" class="text-secondary">
|
||||||
<div style="line-height:0.9;">{{ path }}</div>
|
<div style="line-height:0.9;">{{ path }}</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
|
@ -375,7 +375,7 @@ function toggle_sidebar(){
|
||||||
button.tooltip(button);
|
button.tooltip(button);
|
||||||
$("#container-show-more").append(button);
|
$("#container-show-more").append(button);
|
||||||
|
|
||||||
$("#button_show_path").attr('href', '{{ url_for('showsavedpastes.showsavedpaste') }}?paste=' + $(modal).attr('data-path'));
|
$("#button_show_path").attr('href', '{{ url_for('objects_item.showItem') }}?id=' + $(modal).attr('data-path'));
|
||||||
$("#button_show_path").show('fast');
|
$("#button_show_path").show('fast');
|
||||||
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
|
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
|
||||||
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
|
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
{% for path in all_path %}
|
{% for path in all_path %}
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ loop.index0 }}</td>
|
<td> {{ loop.index0 }}</td>
|
||||||
<td><a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{path}}">{{ path }}</a>
|
<td><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{path}}">{{ path }}</a>
|
||||||
<div>
|
<div>
|
||||||
{% for tag in paste_tags[loop.index0] %}
|
{% for tag in paste_tags[loop.index0] %}
|
||||||
<a href="{{ url_for('Tags.get_tagged_paste') }}?ltags={{ tag[1] }}">
|
<a href="{{ url_for('Tags.get_tagged_paste') }}?ltags={{ tag[1] }}">
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ paste_date[loop.index0] }}</td>
|
<td>{{ paste_date[loop.index0] }}</td>
|
||||||
<td>{{ paste_linenum[loop.index0] }}</td>
|
<td>{{ paste_linenum[loop.index0] }}</td>
|
||||||
<td><p><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="left" title="{{ content[loop.index0] }} "></span> <button type="button" class="btn-link" data-num="{{ loop.index0 + 1 }}" data-toggle="modal" data-target="#mymodal" data-url="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{ path }}&num={{ loop.index0+1 }}" data-path="{{ path }}"><span class="fa fa-search-plus"></span></button></p></td>
|
<td><p><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="left" title="{{ content[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 }}&num={{ loop.index0+1 }}" data-path="{{ path }}"><span class="fa fa-search-plus"></span></button></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ def dashboard_alert(log):
|
||||||
log = log[46:].split(';')
|
log = log[46:].split(';')
|
||||||
if len(log) == 6:
|
if len(log) == 6:
|
||||||
time = datetime_from_utc_to_local(utc_str)
|
time = datetime_from_utc_to_local(utc_str)
|
||||||
path = url_for('showsavedpastes.showsavedpaste',paste=log[5])
|
path = url_for('objects_item.showItem',id=log[5])
|
||||||
|
|
||||||
res = {'date': date, 'time': time, 'script': log[0], 'domain': log[1], 'date_paste': log[2],
|
res = {'date': date, 'time': time, 'script': log[0], 'domain': log[1], 'date_paste': log[2],
|
||||||
'paste': log[3], 'message': log[4], 'path': path}
|
'paste': log[3], 'message': log[4], 'path': path}
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script> var url_showSavedPath = "{{ url_for('showsavedpastes.showsavedpaste') }}"; </script>
|
<script> var url_showSavedPath = "{{ url_for('objects_item.showItem') }}"; </script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$("#page-Dashboard").addClass("active");
|
$("#page-Dashboard").addClass("active");
|
||||||
|
|
|
@ -489,7 +489,7 @@ def correlation_graph_node_json(correlation_type, type_id, key_id):
|
||||||
for node in nodes_set_dump:
|
for node in nodes_set_dump:
|
||||||
nodes.append({"id": node[0], "group": node[1], "first_seen": node[3], "last_seen": node[4], "nb_seen_in_paste": node[5], 'icon': get_icon_text(correlation_type, node[2]),"url": url_for(get_show_key_id_endpoint(correlation_type), type_id=node[2], key_id=node[0]), 'hash': True})
|
nodes.append({"id": node[0], "group": node[1], "first_seen": node[3], "last_seen": node[4], "nb_seen_in_paste": node[5], 'icon': get_icon_text(correlation_type, node[2]),"url": url_for(get_show_key_id_endpoint(correlation_type), type_id=node[2], key_id=node[0]), 'hash': True})
|
||||||
for node in nodes_set_paste:
|
for node in nodes_set_paste:
|
||||||
nodes.append({"id": node[0], "group": node[1],"url": url_for('showsavedpastes.showsavedpaste', paste=node[0]), 'hash': False})
|
nodes.append({"id": node[0], "group": node[1],"url": url_for('objects_item.showItem', id=node[0]), 'hash': False})
|
||||||
links = []
|
links = []
|
||||||
for link in links_set:
|
for link in links_set:
|
||||||
links.append({"source": link[0], "target": link[1]})
|
links.append({"source": link[0], "target": link[1]})
|
||||||
|
@ -1060,7 +1060,7 @@ def hash_graph_node_json():
|
||||||
for node in nodes_set_hash:
|
for node in nodes_set_hash:
|
||||||
nodes.append({"id": node[0], "group": node[1], "first_seen": node[2], "last_seen": node[3], 'estimated_type': node[4], "nb_seen_in_paste": node[5], "size": node[6], 'icon': get_file_icon_text(node[4]),"url": url_for('hashDecoded.showHash', hash=node[7]), 'hash': True})
|
nodes.append({"id": node[0], "group": node[1], "first_seen": node[2], "last_seen": node[3], 'estimated_type': node[4], "nb_seen_in_paste": node[5], "size": node[6], 'icon': get_file_icon_text(node[4]),"url": url_for('hashDecoded.showHash', hash=node[7]), 'hash': True})
|
||||||
for node in nodes_set_paste:
|
for node in nodes_set_paste:
|
||||||
nodes.append({"id": node[0], "group": node[1], "nb_seen_in_paste": node[2],"url": url_for('showsavedpastes.showsavedpaste', paste=node[3]), 'hash': False})
|
nodes.append({"id": node[0], "group": node[1], "nb_seen_in_paste": node[2],"url": url_for('objects_item.showItem', id=node[3]), 'hash': False})
|
||||||
links = []
|
links = []
|
||||||
for link in links_set:
|
for link in links_set:
|
||||||
links.append({"source": link[0], "target": link[1]})
|
links.append({"source": link[0], "target": link[1]})
|
||||||
|
|
|
@ -227,7 +227,7 @@
|
||||||
{{item['date'][0:4]}}/{{item['date'][4:6]}}/{{item['date'][6:8]}}
|
{{item['date'][0:4]}}/{{item['date'][4:6]}}/{{item['date'][6:8]}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="text-secondary" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{item['id']}}">
|
<a class="text-secondary" target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{item['id']}}">
|
||||||
<div style="line-height:0.9;">{{ item['id'] }}</div>
|
<div style="line-height:0.9;">{{ item['id'] }}</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
{% for path in r %}
|
{% for path in r %}
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ loop.index0 }}</td>
|
<td> {{ loop.index0 }}</td>
|
||||||
<td><a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{path}}">{{ path }}</a>
|
<td><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{path}}">{{ path }}</a>
|
||||||
<div>
|
<div>
|
||||||
{% for tag in paste_tags[loop.index0] %}
|
{% for tag in paste_tags[loop.index0] %}
|
||||||
<a href="{{ url_for('tags_ui.get_obj_by_tags') }}?object_type=item<ags={{ tag[1] }}">
|
<a href="{{ url_for('tags_ui.get_obj_by_tags') }}?object_type=item<ags={{ tag[1] }}">
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ paste_date[loop.index0] }}</td>
|
<td>{{ paste_date[loop.index0] }}</td>
|
||||||
<td>{{ paste_size[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('showsavedpastes.showsavedpaste') }}?paste={{ path }}" data-path="{{ path }}"><span class="fa fa-search-plus"></span></button></p></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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -207,11 +207,11 @@
|
||||||
}
|
}
|
||||||
search_table.row.add( [
|
search_table.row.add( [
|
||||||
init_num_of_elements_in_table+((offset))+i+1,
|
init_num_of_elements_in_table+((offset))+i+1,
|
||||||
"<a target=\"_blank\" href=\"{{ url_for('showsavedpastes.showsavedpaste') }}?paste="+data.path_array[i]+"&num="+i+"\"> "+ data.path_array[i] +"</a>"
|
"<a target=\"_blank\" href=\"{{ url_for('objects_item.showItem') }}?id="+data.path_array[i]+"&num="+i+"\"> "+ data.path_array[i] +"</a>"
|
||||||
+ "<div>" + tag + "</div>",
|
+ "<div>" + tag + "</div>",
|
||||||
data.date_array[i],
|
data.date_array[i],
|
||||||
data.size_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('showsavedpastes.showsavedpaste') }}?paste="+data.path_array[i]+"&num="+i+"\" data-path=\""+data.path_array[i]+"\"><span class=\"fa fa-search-plus\"></span></button></p>"
|
"<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 );
|
] ).draw( false );
|
||||||
}
|
}
|
||||||
offset = offset + data.path_array.length;
|
offset = offset + data.path_array.length;
|
||||||
|
|
|
@ -404,13 +404,6 @@ def show_item_min(requested_path , content_range=0):
|
||||||
|
|
||||||
# ============ ROUTES ============
|
# ============ ROUTES ============
|
||||||
|
|
||||||
@showsavedpastes.route("/showsavedpaste/") #completely shows the paste in a new tab
|
|
||||||
@login_required
|
|
||||||
@login_read_only
|
|
||||||
def showsavedpaste():
|
|
||||||
requested_path = request.args.get('paste', '')
|
|
||||||
return showpaste(0, requested_path)
|
|
||||||
|
|
||||||
@showsavedpastes.route("/showsaveditem_min/") #completely shows the paste in a new tab
|
@showsavedpastes.route("/showsaveditem_min/") #completely shows the paste in a new tab
|
||||||
@login_required
|
@login_required
|
||||||
@login_read_only
|
@login_read_only
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
{% if item_parent %}
|
{% if item_parent %}
|
||||||
<div class="list-group" id="item_parent">
|
<div class="list-group" id="item_parent">
|
||||||
<a href="{{ url_for('showsavedpastes.showsavedpaste')}}?paste={{item_parent}}" target="_blank">{{item_parent}}</a>
|
<a href="{{ url_for('objects_item.showItem')}}?id={{item_parent}}" target="_blank">{{item_parent}}</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Father</td>
|
<td>Father</td>
|
||||||
<td><a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{ crawler_metadata['paste_father'] }}" id='paste_father'>{{ crawler_metadata['paste_father'] }}</a></td>
|
<td><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{ crawler_metadata['paste_father'] }}" id='paste_father'>{{ crawler_metadata['paste_father'] }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Url</td>
|
<td>Url</td>
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<small><a class="text-info" href="{{ url_for('showsavedpastes.showsavedrawpaste') }}?paste={{ request.args.get('paste') }}" id='raw_paste' > [Raw content] </a></small>
|
<small><a class="text-info" href="{{ url_for('objects_item.item_raw_content') }}?id={{ request.args.get('paste') }}" id='raw_paste' > [Raw content] </a></small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
html_to_add += "<td>"+curr_data.size+"</td>";
|
html_to_add += "<td>"+curr_data.size+"</td>";
|
||||||
html_to_add += "<td>"+curr_data.lineinfo[0]+"</td>";
|
html_to_add += "<td>"+curr_data.lineinfo[0]+"</td>";
|
||||||
html_to_add += "<td>"+curr_data.lineinfo[1]+"</td>";
|
html_to_add += "<td>"+curr_data.lineinfo[1]+"</td>";
|
||||||
html_to_add += "<td><div class=\"row\"><button class=\"btn btn-xs btn-default\" data-toggle=\"popover\" data-placement=\"left\" data-content=\""+curr_data.content.replace(/\"/g, "\'")+"\">Preview content</button><a target=\"_blank\" href=\"{{ url_for('showsavedpastes.showsavedpaste') }}?paste="+curr_data.path+"&num=0\"> <button type=\"button\" class=\"btn btn-xs btn-info\">Show Paste</button></a></div></td>";
|
html_to_add += "<td><div class=\"row\"><button class=\"btn btn-xs btn-default\" data-toggle=\"popover\" data-placement=\"left\" data-content=\""+curr_data.content.replace(/\"/g, "\'")+"\">Preview content</button><a target=\"_blank\" href=\"{{ url_for('objects_item.showItem') }}?id="+curr_data.path+"&num=0\"> <button type=\"button\" class=\"btn btn-xs btn-info\">Show Paste</button></a></div></td>";
|
||||||
|
|
||||||
html_to_add += "</tr>";
|
html_to_add += "</tr>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,7 @@ function bindEventsForCurrentPage() {
|
||||||
html_to_add += "<td>"+curr_data.size+"</td>";
|
html_to_add += "<td>"+curr_data.size+"</td>";
|
||||||
html_to_add += "<td>"+curr_data.lineinfo[0]+"</td>";
|
html_to_add += "<td>"+curr_data.lineinfo[0]+"</td>";
|
||||||
html_to_add += "<td>"+curr_data.lineinfo[1]+"</td>";
|
html_to_add += "<td>"+curr_data.lineinfo[1]+"</td>";
|
||||||
html_to_add += "<td><div class=\"row\"><button class=\"btn btn-xs btn-default\" data-toggle=\"popover\" data-placement=\"left\" data-content=\""+curr_data.content.replace(/\"/g, "\'")+"\">Preview content</button><a target=\"_blank\" href=\"{{ url_for('showsavedpastes.showsavedpaste') }}?paste="+curr_data.path+"&num=0\"> <button type=\"button\" class=\"btn btn-xs btn-info\">Show Paste</button></a></div></td>";
|
html_to_add += "<td><div class=\"row\"><button class=\"btn btn-xs btn-default\" data-toggle=\"popover\" data-placement=\"left\" data-content=\""+curr_data.content.replace(/\"/g, "\'")+"\">Preview content</button><a target=\"_blank\" href=\"{{ url_for('objects_item.showItem') }}?id="+curr_data.path+"&num=0\"> <button type=\"button\" class=\"btn btn-xs btn-info\">Show Paste</button></a></div></td>";
|
||||||
|
|
||||||
html_to_add += "</tr>";
|
html_to_add += "</tr>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ function create_log_table(obj_json) {
|
||||||
msage.appendChild(document.createTextNode(message.join(" ")));
|
msage.appendChild(document.createTextNode(message.join(" ")));
|
||||||
|
|
||||||
var paste_path = parsedmess[5];
|
var paste_path = parsedmess[5];
|
||||||
var url_to_saved_paste = url_showSavedPath+"?paste="+paste_path+"&num="+parsedmess[0];
|
var url_to_saved_paste = url_showSavedPath+"?id="+paste_path;
|
||||||
|
|
||||||
var action_icon_a = document.createElement("A");
|
var action_icon_a = document.createElement("A");
|
||||||
action_icon_a.setAttribute("TARGET", "_blank");
|
action_icon_a.setAttribute("TARGET", "_blank");
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2 float-right">
|
<div class="mb-2 float-right">
|
||||||
<a href="{{ url_for('showsavedpastes.showsavedpaste')}}?paste={{ dict_object["correlation_id"] }}" target="_blank" style="font-size: 15px">
|
<a href="{{ url_for('objects_item.showItem')}}?id={{ dict_object["correlation_id"] }}" target="_blank" style="font-size: 15px">
|
||||||
<button class="btn btn-info"><i class="fas fa-search"></i> Show Paste
|
<button class="btn btn-info"><i class="fas fa-search"></i> Show Paste
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><i class="far fa-file"></i></td>
|
<td><i class="far fa-file"></i></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="badge" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste', paste=dict_domain['father']['item_father']) }}" />{{ dict_domain['father']['item_father'] }}</a>
|
<a class="badge" target="_blank" href="{{ url_for('objects_item.showItem', id=dict_domain['father']['item_father']) }}" />{{ dict_domain['father']['item_father'] }}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if dict_domain['father']['domain_father'] %}
|
{% if dict_domain['father']['domain_father'] %}
|
||||||
|
@ -374,7 +374,7 @@
|
||||||
{% for item in dict_domain["crawler_history"]["items"] %}
|
{% for item in dict_domain["crawler_history"]["items"] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{item["id"]}}" class="text-secondary">
|
<a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{item["id"]}}" class="text-secondary">
|
||||||
<div style="line-height:0.9;">{{ item["link"] }}</div>
|
<div style="line-height:0.9;">{{ item["link"] }}</div>
|
||||||
</a>
|
</a>
|
||||||
<div>
|
<div>
|
||||||
|
@ -520,7 +520,7 @@ function toggle_sidebar(){
|
||||||
<script>
|
<script>
|
||||||
var ctx = canvas.getContext('2d'), img = new Image();
|
var ctx = canvas.getContext('2d'), img = new Image();
|
||||||
var base_url = "{{ url_for('showsavedpastes.screenshot', filename="") }}";
|
var base_url = "{{ url_for('showsavedpastes.screenshot', filename="") }}";
|
||||||
var screenshot_href = "{{ url_for('showsavedpastes.showsavedpaste') }}?paste=";
|
var screenshot_href = "{{ url_for('objects_item.showItem') }}?id=";
|
||||||
|
|
||||||
/// turn off image smoothing
|
/// turn off image smoothing
|
||||||
ctx.webkitImageSmoothingEnabled = false;
|
ctx.webkitImageSmoothingEnabled = false;
|
||||||
|
|
120
var/www/templates/modals/create_hive_case.html
Normal file
120
var/www/templates/modals/create_hive_case.html
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
<div id="create_hive_case_modal" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
|
||||||
|
<div id="create_hive_case_modal_content" class="modal-content">
|
||||||
|
<div class="modal-header justify-content-center">
|
||||||
|
<img id="hive-logo" src="{{url_for('static', filename='image/thehive-logo.png') }}" width="500" >
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<form method="post" action="{{ url_for('PasteSubmit.create_hive_case') }}" target="_blank">
|
||||||
|
|
||||||
|
<div class="input clear required">
|
||||||
|
<label for="EventThreatLevelId">Threat Level</label>
|
||||||
|
<select name="threat_level_hive" id="EventThreatLevelId" required="required">
|
||||||
|
<option value="1">High</option>
|
||||||
|
<option value="2" selected="selected">Medium</option>
|
||||||
|
<option value="3">Low</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="input select required">
|
||||||
|
<label for="TLP">TLP</label>
|
||||||
|
<select name="hive_tlp" id="hive_tlp" required="required" class="selectpicker">
|
||||||
|
<option value="0">White</option>
|
||||||
|
<option value="1">Green</option>
|
||||||
|
<option value="2" selected="selected">Amber</option>
|
||||||
|
<option value="3">Red</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="clear required">
|
||||||
|
<label for="hive_case_title">Title</label>
|
||||||
|
<input name="hive_case_title" class="form-control span6" placeholder="Title" type="text" id="hive_case_title" required="required"/>
|
||||||
|
</div>
|
||||||
|
<div class="clear required">
|
||||||
|
<label for="hive_description">Description</label>
|
||||||
|
<input name="hive_description" class="form-control span6" placeholder="Quick Case Description" type="text" id="hive_description" required="required"/>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" id="paste" name="paste" value="{{ dict_item['id'] }}">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-primary" type="submit">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
Create Case
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal" >Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script> // TODO: add tags to PASTE or DOMAIN
|
||||||
|
var ltags;
|
||||||
|
var ltagsgalaxies;
|
||||||
|
|
||||||
|
$.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
|
||||||
|
function(data) {
|
||||||
|
|
||||||
|
ltags = $('#ltags').tagSuggest({
|
||||||
|
data: data,
|
||||||
|
maxDropHeight: 200,
|
||||||
|
name: 'ltags'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
|
||||||
|
function(data) {
|
||||||
|
|
||||||
|
ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({
|
||||||
|
data: data,
|
||||||
|
maxDropHeight: 200,
|
||||||
|
name: 'ltagsgalaxies'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery("#all-tags-taxonomies").click(function(e){
|
||||||
|
//change input tags list
|
||||||
|
$.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
|
||||||
|
function(data) {
|
||||||
|
ltags.setData(data)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery("#all-tags-galaxies").click(function(e){
|
||||||
|
$.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
|
||||||
|
function(data) {
|
||||||
|
ltagsgalaxies.setData(data)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
{% for taxo in modal_add_tags['active_taxonomies'] %}
|
||||||
|
jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){
|
||||||
|
$.getJSON("{{ url_for('Tags.get_tags_taxonomie') }}?taxonomie={{ taxo }}",
|
||||||
|
function(data) {
|
||||||
|
ltags.setData(data)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for galaxy in modal_add_tags['active_galaxies'] %}
|
||||||
|
jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){
|
||||||
|
$.getJSON("{{ url_for('Tags.get_tags_galaxy') }}?galaxy={{ galaxy }}",
|
||||||
|
function(data) {
|
||||||
|
ltagsgalaxies.setData(data)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
function addTags() {
|
||||||
|
var tags = ltags.getValue()
|
||||||
|
var tagsgalaxy = ltagsgalaxies.getValue()
|
||||||
|
window.location.replace("{{ url_for('tags_ui.add_tags') }}?tags=" + tags + "&tagsgalaxies=" + tagsgalaxy + "&object_id={{ modal_add_tags['object_id'] }}&object_type={{ modal_add_tags['object_type'] }}");
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -86,7 +86,7 @@ function get_html_and_update_modal(event, truemodal) {
|
||||||
button.tooltip(button);
|
button.tooltip(button);
|
||||||
$("#container-show-more").append(button);
|
$("#container-show-more").append(button);
|
||||||
|
|
||||||
$("#modal_show_min_item_button_show_item").attr('href', '{{ url_for('showsavedpastes.showsavedpaste') }}?paste=' + $(modal).attr('data-path'));
|
$("#modal_show_min_item_button_show_item").attr('href', '{{ url_for('objects_item.showItem') }}?id=' + $(modal).attr('data-path'));
|
||||||
$("#modal_show_min_item_button_show_item").show('fast');
|
$("#modal_show_min_item_button_show_item").show('fast');
|
||||||
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
|
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
|
||||||
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
|
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
|
||||||
|
|
446
var/www/templates/objects/item/show_item.html
Normal file
446
var/www/templates/objects/item/show_item.html
Normal file
|
@ -0,0 +1,446 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Show Item Object - AIL</title>
|
||||||
|
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
|
||||||
|
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
|
||||||
|
<link href="{{ url_for('static', filename='css/dataTables.bootstrap.min.css') }}" rel="stylesheet">
|
||||||
|
<link href="{{ url_for('static', filename='css/tags.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
|
<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/popper.min.js')}}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/bootstrap4.min.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/dataTables.bootstrap.min.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/tags.js') }}"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.rotate{
|
||||||
|
-moz-transition: all 0.1s linear;
|
||||||
|
-webkit-transition: all 0.1s linear;
|
||||||
|
transition: all 0.1s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate.down{
|
||||||
|
-moz-transform:rotate(180deg);
|
||||||
|
-webkit-transform:rotate(180deg);
|
||||||
|
transform:rotate(180deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% include 'nav_bar.html' %}
|
||||||
|
|
||||||
|
<div class="card my-2 mx-2">
|
||||||
|
<div class="card-header bg-dark">
|
||||||
|
<h3 class="text-white text-center" >{{ dict_item['name'] }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body pb-1">
|
||||||
|
<table class="table table-condensed">
|
||||||
|
<thead class="">
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Source</th>
|
||||||
|
<th>Encoding</th>
|
||||||
|
<th>Size (Kb)</th>
|
||||||
|
<th>Number of lines</th>
|
||||||
|
<th>Max line length</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{ dict_item['metadata']['date'] }}</td>
|
||||||
|
<td>{{ dict_item['metadata']['source'] }}</td>
|
||||||
|
<td>{{ dict_item['metadata']['encoding'] }}</td>
|
||||||
|
<td>{{ dict_item['metadata']['size'] }}</td>
|
||||||
|
<td>{{ dict_item['metadata']['lines']['nb'] }}</td>
|
||||||
|
<td>{{ dict_item['metadata']['lines']['max_length'] }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h5>
|
||||||
|
<div>
|
||||||
|
{% include 'modals/edit_tag.html' %}
|
||||||
|
{% for tag in dict_item['tags'] %}
|
||||||
|
<button class="btn btn-{{ bootstrap_label[loop.index0 % 5] }}" data-toggle="modal" data-target="#edit_tags_modal"
|
||||||
|
data-tagid="{{ tag }}" data-objtype="item" data-objid="{{ dict_item['id'] }}">
|
||||||
|
{{ tag }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
<br>
|
||||||
|
{% include 'modals/add_tags.html' %}
|
||||||
|
<button type="button" class="btn btn-light" data-toggle="modal" data-target="#add_tags_modal">
|
||||||
|
<i class="far fa-plus-square"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if dict_item['father'] %}
|
||||||
|
<div class="mt-3">
|
||||||
|
Father: <a href="{{ url_for('objects_item.showItem')}}?id={{dict_item['father']}}" target="_blank">{{dict_item['father']}}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="d-flex flex-row-reverse bd-highlight">
|
||||||
|
<div>
|
||||||
|
<a href="{{ url_for('correlation.show_correlation')}}?object_type=paste&correlation_id={{ dict_item['id'] }}&correlation_objects=paste" target="_blank">
|
||||||
|
<button class="btn btn-lg btn-info"><i class="fas fa-project-diagram"></i> Correlations Graph
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="mx-2">
|
||||||
|
{% with obj_type='item', obj_id=dict_item['id'], obj_lvl=0%}
|
||||||
|
{% include 'import_export/block_add_user_object_to_export.html' %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
{% if is_hive_connected %}
|
||||||
|
<div>
|
||||||
|
{% include 'modals/create_hive_case.html' %}
|
||||||
|
<button type="button" class="btn btn-lg btn-outline-dark mx-1" data-toggle="modal" data-target="#create_hive_case_modal">
|
||||||
|
Create
|
||||||
|
<img id="thehive-icon" src="{{url_for('static', filename='image/thehive_icon.png') }}">
|
||||||
|
Case
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if misp_eventid %}
|
||||||
|
<div class="list-group" id="misp_event">
|
||||||
|
<li class="list-group-item active">MISP Events already Created</li>
|
||||||
|
<a target="_blank" href="{{ misp_url }}" class="list-group-item">{{ misp_url }}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if dict_item['hive_case'] %}
|
||||||
|
<div class="list-group" id="misp_event">
|
||||||
|
<li class="list-group-item active">The Hive Case already Created</li>
|
||||||
|
<a target="_blank" href="{{ hive_url }}" class="list-group-item">{{ hive_url }}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if dict_item['duplicates'] != 0 %}
|
||||||
|
<div id="accordionDuplicate" class="mb-2 mx-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header py-1" id="headingDuplicate">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-11">
|
||||||
|
<div class="mt-2">
|
||||||
|
<i class="far fa-clone"></i> duplicates
|
||||||
|
<div class="badge badge-warning">{{dict_item['duplicates']|length}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
<button class="btn btn-link btn-lg py-2 float-right rotate" data-toggle="collapse" data-target="#collapseDuplicate" aria-expanded="true" aria-controls="collapseDuplicate">
|
||||||
|
<i class="fas fa-chevron-circle-down"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapseDuplicate" class="collapse" aria-labelledby="headingDuplicate" data-parent="#accordionDuplicate">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<table class="table" id="tableDup">
|
||||||
|
<thead class="thead-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Similarity</th>
|
||||||
|
<th>Item</th>
|
||||||
|
<th>Diff</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for duplicate_id in dict_item['duplicates'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{dict_item['duplicates'][duplicate_id]['date']}}</td>
|
||||||
|
<td class="py-0">
|
||||||
|
<table class="table table-borderless table-sm my-0">
|
||||||
|
<tbody>
|
||||||
|
{%for algo in dict_item['duplicates'][duplicate_id]['algo']|sort()%}
|
||||||
|
<tr>
|
||||||
|
<td class="py-0">{{algo}}</td>
|
||||||
|
<td class="w-100 py-0">
|
||||||
|
<div class="progress mt-1">
|
||||||
|
<div class="progress-bar progress-bar-striped {%if algo=='tlsh'%}bg-secondary{%endif%}" role="progressbar" style="width: {{dict_item['duplicates'][duplicate_id]['algo'][algo]}}%;" aria-valuenow="{{dict_item['duplicates'][duplicate_id]['algo'][algo]}}" aria-valuemin="0" aria-valuemax="100">
|
||||||
|
{{dict_item['duplicates'][duplicate_id]['algo'][algo]}}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{%endfor%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url_for('objects_item.showItem')}}?id={{duplicate_id}}" target="_blank">
|
||||||
|
{{duplicate_id}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a target="_blank" href="{{ url_for('showsavedpastes.showDiff') }}?s1={{dict_item['id']}}&s2={{duplicate_id}}" class="fa fa-columns" title="Show diff"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if l_64|length != 0 %}
|
||||||
|
<div id="accordionDecoded" class="mb-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header py-1" id="headingDecoded">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-11">
|
||||||
|
<div class="mt-2">
|
||||||
|
<i class="fas fa-lock-open"></i> Decoded Files
|
||||||
|
<div class="badge badge-warning">{{l_64|length}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
<button class="btn btn-link py-2 float-right rotate" data-toggle="collapse" data-target="#collapseDecoded" aria-expanded="true" aria-controls="collapseDecoded">
|
||||||
|
<i class="fas fa-chevron-circle-down"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapseDecoded" class="collapse show" aria-labelledby="headingDecoded" data-parent="#accordionDecoded">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<table id="tableb64" class="red_table table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>estimated type</th>
|
||||||
|
<th>hash</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for b64 in l_64 %}
|
||||||
|
<tr>
|
||||||
|
<td><i class="fas {{ b64[0] }}"></i> {{ b64[1] }}</td>
|
||||||
|
<td><a target="_blank" href="{{ url_for('correlation.show_correlation') }}?object_type=decoded&correlation_id={{ b64[2] }}&correlation_objects=paste"</a> {{b64[2]}} ({{ b64[4] }})</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if dict_item['crawler'] %}
|
||||||
|
<div id="accordionCrawler" class="mb-3 mx-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header py-1" id="headingCrawler">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-11">
|
||||||
|
<div class="mt-2">
|
||||||
|
<i class="fas fa-spider"></i> Crawler
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-1">
|
||||||
|
<button class="btn btn-link btn-lg py-2 float-right rotate down" data-toggle="collapse" data-target="#collapseCrawler" aria-expanded="true" aria-controls="collapseCrawler">
|
||||||
|
<i class="fas fa-chevron-circle-down"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapseCrawler" class="collapse show" aria-labelledby="headingCrawler" data-parent="#accordionCrawler">
|
||||||
|
|
||||||
|
<div class="row mx-0">
|
||||||
|
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="my-2">
|
||||||
|
<table class="table table-sm">
|
||||||
|
<thead>
|
||||||
|
<td></td>
|
||||||
|
<td>Last Origin:</td>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><i class="far fa-file"></i></td>
|
||||||
|
<td>
|
||||||
|
<a class="badge" target="_blank" href="{{ url_for('objects_item.showItem', paste=dict_item['father']) }}" />{{ dict_item['father'] }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<td><i class="fab fa-html5"></i></td>
|
||||||
|
<td>
|
||||||
|
<a class="badge" target="_blank" href="{{ url_for('crawler_splash.showDomain', domain=dict_item['crawler']['domain']) }}" />{{ dict_item['crawler']['domain'] }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>url</td>
|
||||||
|
<td>
|
||||||
|
{{ dict_item['crawler']['url'] }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="card my-2" style="background-color:#ecf0f1;">
|
||||||
|
<div class="card-body py-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input class="custom-range mt-2" id="blocks" type="range" min="1" max="50" value="{%if dict_item['crawler']['is_tags_safe']%}13{%else%}0{%endif%}">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<button class="btn {%if dict_item['crawler']['is_tags_safe']%}btn-primary{%else%}btn-danger{%endif%}" onclick="blocks.value=50;pixelate();">
|
||||||
|
{%if dict_item['crawler']['is_tags_safe']%}
|
||||||
|
<i class="fas fas fa-plus-square"></i>
|
||||||
|
{%else%}
|
||||||
|
<i class="fas fa-exclamation-triangle"></i>
|
||||||
|
{%endif%}
|
||||||
|
<span class="label-icon">Full resolution</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<canvas id="canvas" style="width:100%;"></canvas>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- nav-pills nav-justified nav-tabs-->
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body pt-0 py-1 px-2">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills" id="pills-tab" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="pills-content-tab" data-toggle="pill" href="#pills-content" role="tab" aria-controls="pills-content" aria-selected="true">Content</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="pills-html2text-tab" data-toggle="pill" href="#pills-html2text" role="tab" aria-controls="pills-html2text" aria-selected="false">html2text</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Others</a>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="{{ url_for('objects_item.item_raw_content', id=dict_item['id']) }}"><i class="far fa-file"></i> Raw Content</a>
|
||||||
|
<a class="dropdown-item" href="{{ url_for('objects_item.item_download', id=dict_item['id']) }}"><i class="fas fa-download"></i> Download</i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-content" id="pills-tabContent">
|
||||||
|
<div class="tab-pane fade show active" id="pills-content" role="tabpanel" aria-labelledby="pills-content-tab">
|
||||||
|
<p class="my-0"> <pre class="border">{{ dict_item['content'] }}</pre></p>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="pills-html2text" role="tabpanel" aria-labelledby="pills-html2text-tab">
|
||||||
|
<p class="my-0"> <pre id="html2text-container" class="border"></pre></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var ltags
|
||||||
|
var ltagsgalaxies
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#tableDup').DataTable();
|
||||||
|
// $('#tableb64').DataTable({
|
||||||
|
// "aLengthMenu": [[5, 10, 15, -1], [5, 10, 15, "All"]],
|
||||||
|
// "iDisplayLength": 5,
|
||||||
|
// "order": [[ 1, "asc" ]]
|
||||||
|
// });
|
||||||
|
$(".rotate").click(function(){
|
||||||
|
$(this).toggleClass("down") ;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pills-html2text-tab').on('shown.bs.tab', function (e) {
|
||||||
|
if ($('#html2text-container').is(':empty')){
|
||||||
|
$.get("{{ url_for('objects_item.html2text') }}?id={{ dict_item['id'] }}").done(function(data){
|
||||||
|
$('#html2text-container').text(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% if dict_item['crawler'] %}
|
||||||
|
<script>
|
||||||
|
var ctx = canvas.getContext('2d'), img = new Image();
|
||||||
|
|
||||||
|
/// turn off image smoothing
|
||||||
|
ctx.webkitImageSmoothingEnabled = false;
|
||||||
|
ctx.imageSmoothingEnabled = false;
|
||||||
|
|
||||||
|
img.onload = pixelate;
|
||||||
|
img.addEventListener("error", img_error);
|
||||||
|
var draw_img = false;
|
||||||
|
|
||||||
|
img.src = "{{ url_for('showsavedpastes.screenshot', filename=dict_item['crawler']['screenshot']) }}";
|
||||||
|
|
||||||
|
function pixelate() {
|
||||||
|
|
||||||
|
/// use slider value
|
||||||
|
if( blocks.value == 50 ){
|
||||||
|
size = 1;
|
||||||
|
} else {
|
||||||
|
var size = (blocks.value) * 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.width = img.width;
|
||||||
|
canvas.height = img.height;
|
||||||
|
|
||||||
|
/// cache scaled width and height
|
||||||
|
w = canvas.width * size;
|
||||||
|
h = canvas.height * size;
|
||||||
|
|
||||||
|
/// draw original image to the scaled size
|
||||||
|
ctx.drawImage(img, 0, 0, w, h);
|
||||||
|
|
||||||
|
/// pixelated
|
||||||
|
ctx.drawImage(canvas, 0, 0, w, h, 0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function img_error() {
|
||||||
|
img.onerror=null;
|
||||||
|
img.src="{{ url_for('static', filename='image/AIL.png') }}";
|
||||||
|
blocks.value = 50;
|
||||||
|
pixelate;
|
||||||
|
}
|
||||||
|
|
||||||
|
blocks.addEventListener('change', pixelate, false);
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
|
@ -129,7 +129,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pb-0">{{ dict_obj['date'] }}</td>
|
<td class="pb-0">{{ dict_obj['date'] }}</td>
|
||||||
<td class="pb-0">
|
<td class="pb-0">
|
||||||
<a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{dict_obj['id']}}" class="text-secondary">
|
<a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{dict_obj['id']}}" class="text-secondary">
|
||||||
<div style="line-height:0.9;">{{ dict_obj['id'] }}</div>
|
<div style="line-height:0.9;">{{ dict_obj['id'] }}</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
|
|
Loading…
Reference in a new issue