Skip to content
Pak Cyberbot edited this page Jan 2, 2024 · 3 revisions

This facilitates access to data files such as keyword lists, reporting templates, site databases, and more.

Usage Examples

KeywordLists

from csilibs.data import KeywordLists

print(KeywordLists.files)

The files attribute returns a list of paths for keyword TXT files.

Templates

This is used to generate any case report by populating templates. Check out the reportme() function in utils.

from csilibs.data import Templates, KeywordLists

print(Templates.DOCX_CSI_TEMPLATE)
print(Templates.get_templates())

DOCX_CSI_TEMPLATE is a variable representing a template name, returning the path of the corresponding DOCX template file. The get_templates() function returns a dictionary of template names and their file paths. Template names are listed below:

  • DOCX_CSI_TEMPLATE
  • ODT_CSI_TEMPLATE
  • ODT_CSI_MISSING_PERSON
  • ODT_DIGITAL_EVIDENCE_FORENSIC
  • ODT_CONSENT_TO_SEARCH

SitesUser

This helps interact with the database file containing information for username searches on different websites.

from csilibs.data import SitesUser

print(SitesUser.get_sites())
# Expected Output:
# ['Social_sites', 'NSFW_sites', 'Onion_sites', 'Financial_sites', 'Gaming_sites']

print(SitesUser.get_sites_safe())

print(SitesUser.get_data(SitesUser.SITES_ONION))

The get_sites_safe() function returns a list of sites excluding NSFW. The values of this list can be provided as an argument to the get_data() function. get_data() returns a list of dictionary data for site usernames.

Example data:

{'id': 2, 'site_name': 'Facebook', 'site_url': 'https://www.facebook.com/{}', 'method': 'GET', 'type': 'string', 'key': 'not found|may be broken|removed', 'onoff': '0'}

Adding data

from csilibs.data import SitesUser


site_data = {
    "site_name": 'ExampleSite',
    "site_url": 'http://example.com/{}',
    "method": 'GET',
    "type": 'string',
    "key": '404|Page Not Found',
    "onoff": '0'
}

print(SitesUser.add_data(SitesUser.SITES_SOCIAL, site_data))

You can add new site username data using add_data() function to the database by providing a dictionary with the same keys mentioned in the code above.

apiKeys()

This function facilitates interaction with the API keys file and handles its encryption.

It takes two optional arguments: a password string and a data dictionary. It returns a tuple with a boolean indicating whether the file is encrypted and a dictionary containing API keys data.

During a fresh installation of the pip library, only the JSON file is provided. If you provide a password to this function, the file will be encrypted.

  • If an encrypted file is present and a password is provided, it decrypts the file.
  • If no encrypted file is present, it encrypts the API keys if a password is provided. However, this operation does not return any data.
  • If no password is provided, it simply returns the data.
  • If the file is already encrypted and the 'data' dictionary argument is provided, it will overwrite the file with the data in JSON format.
from csilibs.data import apiKeys
# Only returns the empty API keys data
print(apiKeys())

# The first time a password is provided, it won't return any data. After that, a password must be provided to get the data.
print(apiKeys('password123'))

# To change the API key data
dict_data = {'binaryedge_api': {'key': '', 'inTools': ['Recon-NG', 'Spiderfoot']}}

print(apiKeys('password123',dict_data))