Skip to content

Component: Python scripts

Sjors edited this page Aug 29, 2017 · 5 revisions

Fill the file "config.ini" in the project's root with the required values:

[osint_sources]

SHODAN_API_KEY: *{Shodan API key here}*

CENSYS_API_ID: *{Censys API ID here}* 

CENSYS_API_KEY: *{Censys Secret here}*

[elastic]

ELASTICSEARCH_IP: *{IP of Elasticsearch cluster here}*

X-PACK_ENABLED: *{Whether X-PACK is enabled (true/false}*

X-PACK_USERNAME: *{(optional) X-PACK SHIELD username here}*

X-PACK_PASSWORD: *{(optional) X-PACK SHIELD password here}*

[other]

INSTITUTIONS_FILE:  *{(optional) Path to CSV file containing institutions/organizations. Format is [name,CIDR] where
every CIDR belonging to an institution should be a separate entry. The scripts will combine multiple entries to one
institution with a lists of CIDRS}*

Install the following modules for Python3 (can be installed with easy_install3 or pip3):

  • Shodan
  • Censys
  • Elasticsearch
  • Netaddr

You can now run the following scripts:

  • tofile-*.py files take arguments and can be runned automatically, for example with a CRON job. Run with the '-h' flag for more info;
  • tofile-*-manually.py files will ask for user input interactively;
  • convert-*.py files can convert the resulting files from tofile-*.py to Elasticsearch compatible files, if not already converted with the '-c' flag from tofile-*.py;
  • Scripts in debugscripts/ can be used for debugging purposes.