This Python script is designed to send requests to the Cookie Doctor API to process a list of hostnames. The script reads a single hostname, a list of hostnames, or a .txt
file containing hostnames, sends them to the Cookie Doctor API for processing, and saves the response in JSON or text format.
- Multi-threaded execution using Python's
ThreadPoolExecutor
for concurrent processing. - Input flexibility: Accepts a single hostname, a list of hostnames, or a
.txt
file containing hostnames. - Saves output: Responses are saved as JSON or plain text in an organized folder structure.
- Error handling: Captures and logs errors during the request.
- Python 3.6+ is required to run this script.
- Required Python libraries:
requests
You can install the required dependencies using:
pip install requests
-
Clone the repository:
git clone https://github.com/edgewatch/cookie.doctor.git cd cookie.doctor
-
Install dependencies:
pip install -r requirements.txt
-
Ensure the API endpoint for Cookie Doctor is configured correctly:
API_COOKIE_DOCTOR='https://api.cookie.doctor/api/v1/process_host/'
The script can process a single hostname, a list of hostnames, or a .txt
file containing multiple hostnames.
python cookie_scanner.py <hostname|hostnames.txt|["hostname1", "hostname2", ...]>
-
Single Hostname:
python cookie_scanner.py https://example.com
-
List of Hostnames (as a string):
python cookie_scanner.py '["https://example.com", "http://test.com"]'
-
Hostnames from a
.txt
file:python cookie_scanner.py hostnames.txt
- The responses from the Cookie Doctor API are saved in the
output/
directory. - For each hostname, a corresponding folder is created. The response is saved as a
.json
file if it's valid JSON or as a.txt
file if not. - The filenames are timestamped to differentiate between scans.
output/
└── example.com/
└── example.com_2023-09-30_15_23_45.json
The script processes hostnames concurrently using Python's ThreadPoolExecutor
, with 4 worker threads by default. This can be adjusted inside the script if necessary.
Contributions are welcome! If you find a bug or want to improve this script, feel free to submit a pull request or create an issue.
This project is licensed under the MIT License.