Application to search Shodan for Calibre Web sites that and pull all books into a database and then display on a website.
Some of this code is based on code created by Krazybug - https://github.com/Krazybug/calishot. Some of this code is based on code created by gnur - https://github.com/gnur/demeter
Requirements:
- Python 3.9+ (macOS/Linux tested)
- Optional: use a virtual environment
This installer sets up the app and dependencies only. It does not include or copy any files from the repo books/ or data/ directories.
Installs from GitHub, creates the data directory, and ensures the demeter module is present.
# From the repo root
python3 install_from_github.pyThis will:
- Upgrade pip/setuptools/wheel
- Install calishot-web from GitHub
- Create data directory at:
~/.calishot/data - Ensure
demeter.pyis available in site-packages
Run the web app:
python3 -m calishot_web.appPlace your SQLite DB at one of the recognized locations:
~/data/sites.db(default)- or set an explicit directory via
CALISHOT_DATA_DIR:
export CALISHOT_DATA_DIR=/path/to/dir
calishot-webpython3 -m pip install "git+https://github.com/dwilliamhouston/Calishot-2.0.git@main#subdirectory=."Then run:
calishot_web# Clean build artifacts
rm -rf build dist *.egg-info
# Build sdist and wheel
python3 -m build
# Install the wheel
python3 -m pip install --force-reinstall --no-deps --no-cache-dir dist/calishot_web-*-py3-none-any.whlRun:
calishot_webcalishot_web/app.py looks for the database in this order:
CALISHOT_DATA_DIR/sites.dbifCALISHOT_DATA_DIRis set~/.calishot/data/sites.db- Current working directory:
./data/sites.db
If the DB is missing, the app returns a helpful error JSON from /api/country_counts.
-
"No module named 'demeter'":
-
Reinstall the package to ensure
demeter.pyis included:python3 -m pip install --force-reinstall --no-deps --no-cache-dir dist/calishot_web-*-py3-none-any.whl -
Or rerun the installer:
python3 install_from_github.py
-
-
zsh: no matches found: dist/*.whl:-
The glob didn’t match. List dist and install the exact file:
ls -1 dist python3 -m pip install dist/calishot_web-0.1.0-py3-none-any.whl
-
-
Static/templates path issues when frozen:
resource_path()incalishot_web/app.pyhandles installed, dev, and PyInstaller modes.
python3 -m pip uninstall -y calishot_web- Start the app after install:
calishot_web
# or override host/port
HOST=127.0.0.1 PORT=5003 calishot_web- Place your database at
~/.calishot/data/sites.dbor setCALISHOT_DATA_DIR.
GET /— main UI (calishot_web/templates/index_clean.html)GET /demeter— Demeter UIGET /api/country_counts— JSON country->count fromsites.db
Demeter actions (proxied from demeter.py):
POST /api/demeter/host/listPOST /api/demeter/host/list_allPOST /api/demeter/host/add— JSON:{ "hosturl": ["https://example"] }POST /api/demeter/host/rm— JSON:{ "hostid": 123 }POST /api/demeter/host/enable— JSON:{ "enable_all": true | false, "enable_country": "US", "hostid": 123 }POST /api/demeter/host/disable— JSON:{ "disable_all": true | false, "hostid": 123 }POST /api/demeter/host/stats— JSON:{ "hostid": 123 }POST /api/demeter/scrape/run— JSON:{ "extension": "epub", "outputdir": "books", "authors": [..], "titles": [..] }GET /api/demeter/scrape/status?job_id=<id>POST /api/demeter/scrape/cancel_allPOST /api/demeter/scrape/reset_cancel
Use docker-compose (recommended):
docker compose up --build -dDefaults from docker-compose.yml:
- Port:
5003exposed - Volumes:
./data->/app/data(placesites.dbhere)./books->/app/books./calishot_web/templates->/app/calishot_web/templates./calishot_webtemplates->/app/calishot_webtemplates
- Environment:
DATA_DIR=/dataFLASK_APP=calishot_web/app.pyFLASK_ENV=development
Access the app at http://localhost:5003
Instructions if you want to use existing or downloaded index.db locally (Not using Docker)
Step 1 - Setup new python environemnt and install datasette.
python -m venv shodantest ../calishot/bin/activate pip install datasette pip install datasette-json-html pip install datasette-pretty-json
Step 2 - Execute from command line: pip -r install requirements.txt
Step 3 - download index.db into your venv directory.
Step 4 - Execute from command line:
docker run -d
--name=calishot
-p 5001:5000
-v /LOCALDIRHERE/app/data:/app/data
dwilliamhouston/shodantest:latest datasette -p 5000 -h 0.0.0.0 /app/data/index.db --config sql_time_limit_ms:50000 --config allow_download:off --config max_returned_rows:2000 --config num_sql_threads:10 --config allow_csv_stream:off --metadata metadata.json
Instructions if using Docker rather than setting up your own Python environment:
Step 1 - Create a directory called /app and then a directory called /app/data and put the index.db file in it.
Step 2 Execute from command line:
docker run -d
--name=calishot
-p 5001:5000
-v /LOCALDIRHERE/app/data:/app/data
dwilliamhouston/shodantest:latest datasette -p 5000 -h 0.0.0.0 /app/data/index.db --config sql_time_limit_ms:50000 --config allow_download:off --config max_returned_rows:2000 --config num_sql_threads:10 --config allow_csv_stream:off --metadata metadata.json
Step 3 - open the browser to http://localhost:5001