chg: [UI show domain] add last origin table: domain + item

This commit is contained in:
Terrtia 2020-10-05 14:56:50 +02:00
parent 1a4c595024
commit eec64c3bc7
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 40 additions and 7 deletions

View file

@ -474,6 +474,14 @@ def get_domain_last_origin(domain, domain_type):
origin_item = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent') origin_item = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent')
return origin_item return origin_item
def get_domain_father(domain, domain_type):
dict_father = {}
dict_father['item_father'] = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent')
if dict_father['item_father'] != 'auto' and dict_father['item_father'] != 'manual':
if Item.is_crawled(dict_father['item_father']):
dict_father['domain_father'] = Item.get_domain(dict_father['item_father'])
return dict_father
def get_domain_tags(domain): def get_domain_tags(domain):
''' '''
Retun all tags of a given domain. Retun all tags of a given domain.
@ -744,6 +752,9 @@ class Domain(object):
''' '''
return get_domain_last_origin(self.domain, self.type) return get_domain_last_origin(self.domain, self.type)
def get_domain_father(self):
return get_domain_father(self.domain, self.type)
def domain_was_up(self): def domain_was_up(self):
''' '''
Return True if this domain was UP at least one time Return True if this domain was UP at least one time

View file

@ -110,7 +110,7 @@ def showDomain():
if domain.domain_was_up(): if domain.domain_was_up():
dict_domain = {**dict_domain, **domain.get_domain_correlation()} dict_domain = {**dict_domain, **domain.get_domain_correlation()}
dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain) dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain)
dict_domain['origin_item'] = domain.get_domain_last_origin() dict_domain['father'] = domain.get_domain_father()
dict_domain['tags'] = domain.get_domain_tags() dict_domain['tags'] = domain.get_domain_tags()
dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags']) dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags'])
dict_domain['history'] = domain.get_domain_history_with_status() dict_domain['history'] = domain.get_domain_history_with_status()

View file

@ -94,12 +94,34 @@
</button> </button>
</div> </div>
<hr> <table class="table table-sm table-responsive">
{% if dict_domain['origin_item']=='manual' or dict_domain['origin_item']=='auto' %} <thead>
<span class="badge badge-dark">{{ dict_domain['origin_item'] }}</span> <td></td>
<td>Last Origin:</td>
</thead>
<tbody>
{% if dict_domain['father']=='manual' or dict_domain['father']=='auto' %}
<tr>
<td></td>
<td><span class="badge badge-dark">{{ dict_domain['father'] }}</span></td>
</tr>
{%else%} {%else%}
Last Origin: <a class="badge" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste', paste=dict_domain['origin_item']) }}" />{{ dict_domain['origin_item'] }}</a> <tr>
<td><i class="far fa-file"></i></td>
<td>
<a class="badge" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste', paste=dict_domain['father']['item_father']) }}" />{{ dict_domain['father']['item_father'] }}</a>
</td>
</tr>
{% if dict_domain['father']['domain_father'] %}
<td><i class="fab fa-html5"></i></td>
<td>
<a class="badge" target="_blank" href="{{ url_for('crawler_splash.showDomain', domain=dict_domain['father']['domain_father']) }}" />{{ dict_domain['father']['domain_father'] }}</a>
</td>
{%endif%} {%endif%}
<p>
{%endif%}
</tbody>
</table>
{% if 'correlation_nb' in dict_domain %} {% if 'correlation_nb' in dict_domain %}
{% if dict_domain["correlation_nb"] > 0 %} {% if dict_domain["correlation_nb"] > 0 %}