Skip to content

Data Leak

The functions of data_leak.core, taken from their docstrings.

data_leak.core

SearxError

Bases: Exception

SearxNG could not answer a query: unreachable, refused, or not valid JSON.

start_scheduler()

Launch multiple planning tasks in background:

- Fire main every 5 minutes from Monday to Sunday
- Fire cleanup every 2 hours

cleanup()

Remove 2 hours old, useless, pasteIDs.

main_data_leak()

Read the keywords and search each of them (the job of the module).

check_urls(keyword, urls)

Check if the URL is new.

Parameters:

Name Type Description Default
keyword

Keyword stored in database.

required
urls

Fresh searx urls.

required

Returns:

Type Description
list

Urls not already in alert database column.

check_searx(keyword)

Pull Searx instance for keyword.

Parameters:

Name Type Description Default
keyword

Keyword stored in database.

required

Returns:

Type Description
list

Matched urls.

Raises:

Type Description
SearxError

SearxNG could not answer; check_keywords reports it once per run.

check_pastebin(keywords)

Check Pastebin for keyword list.

Parameters:

Name Type Description Default
keywords

Keywords stored in database.

required

Returns:

Type Description
dictionary

Matched urls & Corresponding keyword.

check_keywords(keywords)

Check keywords in Searx Instance & Pastebin.

Parameters:

Name Type Description Default
keywords

Keywords stored in database.

required

send_data_leak_notifications(alert)

Sends notifications to Slack, Citadel, TheHive or Email based on Data Leak. Slack, Citadel and TheHive follow the instance settings (Connectors > Notifications); the email goes to the subscribers who ticked E-mail.

Parameters:

Name Type Description Default
alert

Alert Object.

required

send_data_leak_notifications_group(keyword, alerts_number, alerts)

Sends grouped notifications to Slack, Citadel, TheHive or Email based on data_leak_group. If the application is TheHive, individual notifications are sent for each alert.

Parameters:

Name Type Description Default
keyword

The keyword or term associated with the data leak.

required
alerts_number

The total number of alerts in the group.

required
alerts

The list of individual alerts to be processed and sent to TheHive.

required