mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
fix: [UI showDomain] fix down domain history
This commit is contained in:
parent
fffb4464c6
commit
b4f49f9e81
4 changed files with 69 additions and 64 deletions
|
@ -283,15 +283,16 @@ def get_domain_items_crawled(domain, domain_type, port, epoch=None, items_link=F
|
|||
item_crawled['epoch'] = item_root['epoch']
|
||||
item_crawled['date'] = time.strftime('%Y/%m/%d - %H:%M.%S', time.gmtime(item_root['epoch']))
|
||||
item_crawled['items'] = []
|
||||
for item in get_domain_items(domain, item_root['root_item']):
|
||||
dict_item = {"id": item}
|
||||
if items_link:
|
||||
dict_item['link'] = Item.get_item_link(item)
|
||||
if item_screenshot:
|
||||
dict_item['screenshot'] = Item.get_item_screenshot(item)
|
||||
if item_tag:
|
||||
dict_item['tags'] = Tag.get_item_tags_minimal(item)
|
||||
item_crawled['items'].append(dict_item)
|
||||
if item_root['root_item'] != str(item_root['epoch']):
|
||||
for item in get_domain_items(domain, item_root['root_item']):
|
||||
dict_item = {"id": item}
|
||||
if items_link:
|
||||
dict_item['link'] = Item.get_item_link(item)
|
||||
if item_screenshot:
|
||||
dict_item['screenshot'] = Item.get_item_screenshot(item)
|
||||
if item_tag:
|
||||
dict_item['tags'] = Tag.get_item_tags_minimal(item)
|
||||
item_crawled['items'].append(dict_item)
|
||||
return item_crawled
|
||||
|
||||
def get_link_tree():
|
||||
|
@ -540,7 +541,7 @@ class Domain(object):
|
|||
def __init__(self, domain, port=None):
|
||||
self.domain = str(domain)
|
||||
self.type = get_domain_type(domain)
|
||||
if self.is_domain_up():
|
||||
if self.domain_was_up():
|
||||
self.current_port = sanathyse_port(port, self.domain, self.type)
|
||||
|
||||
def get_domain_name(self):
|
||||
|
|
|
@ -61,7 +61,7 @@ def showDomain():
|
|||
|
||||
dict_domain = domain.get_domain_metadata()
|
||||
dict_domain['domain'] = domain_name
|
||||
if domain.is_domain_up():
|
||||
if domain.domain_was_up():
|
||||
dict_domain = {**dict_domain, **domain.get_domain_correlation()}
|
||||
dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain)
|
||||
dict_domain['origin_item'] = domain.get_domain_last_origin()
|
||||
|
@ -69,7 +69,8 @@ def showDomain():
|
|||
dict_domain['tags_safe'] = Tag.is_tags_safe(dict_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
|
||||
dict_domain['crawler_history']['random_item'] = random.choice(dict_domain['crawler_history']['items'])
|
||||
if dict_domain['crawler_history']['items']:
|
||||
dict_domain['crawler_history']['random_item'] = random.choice(dict_domain['crawler_history']['items'])
|
||||
|
||||
return render_template("showDomain.html", dict_domain=dict_domain, bootstrap_label=bootstrap_label,
|
||||
modal_add_tags=Tag.get_modal_add_tags(dict_domain['domain'], tag_type="domain"))
|
||||
|
|
|
@ -449,7 +449,7 @@ if (d.popover) {
|
|||
} else {
|
||||
desc = desc + "Red"
|
||||
}
|
||||
desc = desc + ";\"><i class=\"fas"
|
||||
desc = desc + ";\"><i class=\"fas "
|
||||
if (data["status"]) {
|
||||
desc = desc + "fa-check-circle"
|
||||
} else {
|
||||
|
|
|
@ -287,52 +287,54 @@
|
|||
{{dict_domain["crawler_history"]["port"]}}
|
||||
</span>
|
||||
</div>
|
||||
<h5>Crawled Items</h5>
|
||||
<h5>Crawled Items {% if not dict_domain["crawler_history"]["items"] %}: DOWN{% endif %}</h5>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-bordered table-hover" id="myTable_1">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Crawled Pastes</th>
|
||||
<th class="text-center"><i class="fas fa-images"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in dict_domain["crawler_history"]["items"] %}
|
||||
<tr>
|
||||
<td>
|
||||
<a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{item["id"]}}" class="text-secondary">
|
||||
<div style="line-height:0.9;">{{ item["link"] }}</div>
|
||||
</a>
|
||||
<div>
|
||||
{% for tag in item["tags"] %}
|
||||
<a href="{{ url_for('Tags.Tags_page') }}?ltags={{ tag["tag"] }}">
|
||||
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag["min_tag"] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{%if item["screenshot"]%}
|
||||
<span class="icon_img" onclick="reload_image('{{ item["screenshot"] }}', '{{ item["link"] }}', '{{ item["id"] }}');" id="{{ item["screenshot"].replace('/', '') }}">
|
||||
<i class="far fa-image"></i>
|
||||
{% if dict_domain["crawler_history"]["items"] %}
|
||||
<table class="table table-striped table-bordered table-hover" id="myTable_1">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Crawled Pastes</th>
|
||||
<th class="text-center"><i class="fas fa-images"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in dict_domain["crawler_history"]["items"] %}
|
||||
<tr>
|
||||
<td>
|
||||
<a target="_blank" href="{{ url_for('showsavedpastes.showsavedpaste') }}?paste={{item["id"]}}" class="text-secondary">
|
||||
<div style="line-height:0.9;">{{ item["link"] }}</div>
|
||||
</a>
|
||||
<div>
|
||||
{% for tag in item["tags"] %}
|
||||
<a href="{{ url_for('Tags.Tags_page') }}?ltags={{ tag["tag"] }}">
|
||||
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }} pull-left">{{ tag["min_tag"] }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{%if item["screenshot"]%}
|
||||
<span class="icon_img" onclick="reload_image('{{ item["screenshot"] }}', '{{ item["link"] }}', '{{ item["id"] }}');" id="{{ item["screenshot"].replace('/', '') }}">
|
||||
<i class="far fa-image"></i>
|
||||
</button>
|
||||
{%endif%}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="text-center mb-4">
|
||||
<a href="{{ url_for('hiddenServices.download_domain') }}?domain={{domain}}&port={{port}}{% if epoch %}&epoch={{epoch}}{% endif %}" target="blank" style="font-size: 15px">
|
||||
<button class="btn btn-info"><i class="fas fa-download"></i> Download Domain Content
|
||||
</button>
|
||||
{%endif%}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="text-center mb-4">
|
||||
<a href="{{ url_for('hiddenServices.download_domain') }}?domain={{domain}}&port={{port}}{% if epoch %}&epoch={{epoch}}{% endif %}" target="blank" style="font-size: 15px">
|
||||
<button class="btn btn-info"><i class="fas fa-download"></i> Download Domain Content
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{%endif%}
|
||||
{%endif%}
|
||||
|
||||
{% if dict_domain["history"] %}
|
||||
|
@ -456,17 +458,18 @@ img.addEventListener("error", img_error);
|
|||
var draw_img = false;
|
||||
|
||||
{%if "crawler_history" in dict_domain%}
|
||||
{%if dict_domain['crawler_history']['random_item']['screenshot']%}
|
||||
var screenshot = "{{dict_domain['crawler_history']['random_item']['screenshot']}}";
|
||||
var selected_icon = $("#"+screenshot.replace(/\//g, ""));
|
||||
selected_icon.addClass("icon_selected");
|
||||
selected_icon.removeClass("icon_img");
|
||||
{%if "random_item" in dict_domain['crawler_history']%}
|
||||
{%if dict_domain['crawler_history']['random_item']['screenshot']%}
|
||||
var screenshot = "{{dict_domain['crawler_history']['random_item']['screenshot']}}";
|
||||
var selected_icon = $("#"+screenshot.replace(/\//g, ""));
|
||||
selected_icon.addClass("icon_selected");
|
||||
selected_icon.removeClass("icon_img");
|
||||
|
||||
|
||||
$("#screenshot_link").attr("href", screenshot_href + "{{dict_domain['crawler_history']['random_item']['id']}}");
|
||||
$("#screenshot_link").text("{{dict_domain['crawler_history']['random_item']['link']}}");
|
||||
{%else%}
|
||||
var screenshot = "";
|
||||
$("#screenshot_link").attr("href", screenshot_href + "{{dict_domain['crawler_history']['random_item']['id']}}");
|
||||
$("#screenshot_link").text("{{dict_domain['crawler_history']['random_item']['link']}}");
|
||||
{%else%}
|
||||
var screenshot = "";
|
||||
{%endif%}
|
||||
{%endif%}
|
||||
{%else%}
|
||||
var screenshot = "";
|
||||
|
|
Loading…
Reference in a new issue