Using virtual python environments is helpful when needing to run old python2 or earlier code. It can also keep your main python environment clean if needing to download potentially conflicting python packages.
# Setting up a python2 virtual env called 'etblue-venv' in the /tmp directoryvirtualenv /tmp/etblue-venv -p $(which python)# Connecting to the virtual environmentsource /tmp/etblue-venv/bin/activate# After connecting, your shell will display the name of the venvβββ(/tmp/etblue-venv)β(kaliγΏkali)# Verify python version (depends on version you selected)ββ$ python2.7 -V Python 2.7.18# Exit venv (you can go back to it with the 'source' command above)deactivate# The venv remains until you delete it sudo rm -R etblue-venv
import jsonjson_dump ="./possible-subdomains.json"withopen(json_dump)as f: data = json.load(f)for host in data["results"]:print(host["host"], host["url"])# print out the host & URL