mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
chg: [Domain] Show last origin
This commit is contained in:
parent
63b3d5a5f9
commit
6b9ba9d377
3 changed files with 39 additions and 7 deletions
|
@ -154,6 +154,21 @@ def get_domain_last_check(domain, domain_type=None, r_format="str"):
|
|||
last_check = '{}/{}/{}'.format(last_check[0:4], last_check[4:6], last_check[6:8])
|
||||
return last_check
|
||||
|
||||
def get_domain_last_origin(domain, domain_type):
|
||||
'''
|
||||
Get domain last origin
|
||||
|
||||
:param domain: crawled domain
|
||||
:type domain: str
|
||||
:param domain_type: domain type
|
||||
:type domain_type: str
|
||||
|
||||
:return: last orgin item_id
|
||||
:rtype: str
|
||||
'''
|
||||
origin_item = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent')
|
||||
return origin_item
|
||||
|
||||
def get_domain_tags(domain):
|
||||
'''
|
||||
Retun all tags of a given domain.
|
||||
|
@ -280,6 +295,20 @@ class Domain(object):
|
|||
'''
|
||||
return get_domain_last_check(self.domain, domain_type=self.type)
|
||||
|
||||
def get_domain_last_origin(self):
|
||||
'''
|
||||
Get domain last origin
|
||||
|
||||
:param domain: crawled domain
|
||||
:type domain: str
|
||||
:param domain_type: domain type
|
||||
:type domain_type: str
|
||||
|
||||
:return: last orgin item_id
|
||||
:rtype: str
|
||||
'''
|
||||
return get_domain_last_origin(self.domain, self.type)
|
||||
|
||||
def is_domain_up(self): # # TODO: handle multiple ports
|
||||
'''
|
||||
Return True if this domain is UP
|
||||
|
|
|
@ -46,8 +46,8 @@ def api_validator(api_response):
|
|||
# ============= ROUTES ==============
|
||||
# add route : /crawlers/show_domain
|
||||
@crawler_splash.route('/crawlers/showDomain')
|
||||
#@login_required
|
||||
#@login_analyst
|
||||
@login_required
|
||||
@login_analyst
|
||||
def showDomain():
|
||||
domain_name = request.args.get('domain')
|
||||
epoch = request.args.get('epoch')
|
||||
|
@ -63,6 +63,7 @@ def showDomain():
|
|||
dict_domain['domain'] = domain_name
|
||||
if domain.is_domain_up():
|
||||
dict_domain = {**dict_domain, **domain.get_domain_correlation()}
|
||||
dict_domain['origin_item'] = domain.get_domain_last_origin()
|
||||
dict_domain['tags'] = domain.get_domain_tags()
|
||||
dict_domain['history'] = domain.get_domain_history_with_status()
|
||||
dict_domain['crawler_history'] = domain.get_domain_items_crawled(items_link=True, epoch=epoch, item_screenshot=True, item_tag=True) # # TODO: handle multiple port
|
||||
|
|
|
@ -78,11 +78,6 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if origin_paste_name=='manual' or origin_paste_name=='auto' %}
|
||||
<span class="badge badge-dark">{{ origin_paste_name }}</span>
|
||||
{%else%}
|
||||
<a class="badge badge-dark" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste', paste=origin_paste) }}" />{{ origin_paste_name }}</a>
|
||||
{%endif%}
|
||||
<div>
|
||||
{% for tag in dict_domain['tags'] %}
|
||||
<a href="{{ url_for('Tags.Tags_page') }}?ltags={{ tag }}">
|
||||
|
@ -96,6 +91,13 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
{% if dict_domain['origin_item']=='manual' or dict_domain['origin_item']=='auto' %}
|
||||
<span class="badge badge-dark">{{ dict_domain['origin_item'] }}</span>
|
||||
{%else%}
|
||||
Last Origin: <a class="badge" target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste', paste=dict_domain['origin_item']) }}" />{{ dict_domain['origin_item'] }}</a>
|
||||
{%endif%}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue