Skip to content

Commit

Permalink
chg: [domain search] add btn to crawl unknown onion
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Feb 19, 2025
1 parent aa6677f commit bd436b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions var/www/blueprints/crawler_splash.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ def send_to_spider():
return create_json_response(res[0], res[1])
return redirect(url_for('crawler_splash.manual'))

@crawler_splash.route("/crawlers/domain_discovery", methods=['GET'])
@login_required
@login_user_no_api
def domain_discovery():
user_org = current_user.get_org()
user_id = current_user.get_user_id()
domain = request.form.get('domain')
data = {'depth': 1, 'har': True, 'screenshot': True, 'url': f'http://{domain}', 'proxy': 'force_tor'}
res = crawlers.api_add_crawler_task(data, user_org, user_id=user_id)

if res[1] != 200:
return create_json_response(res[0], res[1])
return redirect(url_for('crawler_splash.crawlers_dashboard'))

@crawler_splash.route("/crawlers/scheduler", methods=['GET'])
@login_required
Expand Down Expand Up @@ -599,10 +612,16 @@ def domains_search_name():
dom = Domains.Domain(name)
if dom.exists():
return redirect(url_for('crawler_splash.showDomain', domain=dom.get_id()))
else:
if name.endswith('.onion') and len(name) == 62:
send_to_crawler = True
else:
send_to_crawler = False

l_dict_domains = Domains.api_search_domains_by_name(name, domains_types, meta=True, page=page)
return render_template("domains/domains_result_list.html", template_folder='../../',
l_dict_domains=l_dict_domains, bootstrap_label=bootstrap_label,
send_to_crawler=send_to_crawler,
domains_types=domains_types)

@crawler_splash.route('/domains/today', methods=['GET'])
Expand Down
10 changes: 10 additions & 0 deletions var/www/templates/domains/domains_result_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
</div>
</div>

{% if send_to_crawler %}
<div class="text-center">
<a href="{{ url_for('crawler_splash.domain_discovery') }}?domain={{ l_dict_domains['search'] }}">
<button class="btn btn-outline-dark pb-2">
<i class="fa-solid fa-spider fa-4x fa-bounce"></i><span class="mb-2"> Send Unknown Onion to Crawler</span>
</button>
</a>
</div>
{% endif %}

{% with l_dict_domains=l_dict_domains['list_elem'], bootstrap_label=bootstrap_label %}
{% include 'domains/card_img_domain.html' %}
{% endwith %}
Expand Down

0 comments on commit bd436b1

Please sign in to comment.