First, we import the required libraries to handle argument parsing, creating spreadsheets, hashing files, parsing JSON data, and interacting with web pages.
from __future__ import print_functionimport argparseimport csvimport hashlibimport jsonimport osimport requestsimport sysimport time
This recipe's command-line handler is a little more complicated than normal. It takes three positional arguments, INPUT_FILE, OUTPUT_CSV, and API_KEY, which represent the input text file of domains and IPs or file paths, the desired output CSV location, and a text file containing the API key to use, respectively. In addition to this, there are a few optional arguments, -t (or --type) and --limit, to specify the type of data in the input file ...