62 lines
2.0 KiB
Org Mode
62 lines
2.0 KiB
Org Mode
* Introduction to hepc -- HTTP End Point for CodeQL
|
|
** Usage Sample
|
|
#+BEGIN_SRC sh
|
|
cd ~/work-gh/mrva/mrvahepc
|
|
uv sync # one-time install; uv-run shebangs avoid manual activation
|
|
|
|
# Collect DBs from filesystem
|
|
cd ~/work-gh/mrva/mrvahepc && rm -fR db-collection.tmp/
|
|
export MRVA_HEPC_ENDPOINT=http://hepc
|
|
./bin/mc-hepc-init --db_collection_dir db-collection.tmp \
|
|
--starting_path ~/work-gh/mrva/mrva-open-source-download/ \
|
|
--max_dbs 17
|
|
|
|
# Serve collected DBs plus metadata
|
|
cd ~/work-gh/mrva/mrvahepc
|
|
./bin/mc-hepc-serve --codeql-db-dir db-collection.tmp
|
|
|
|
# Test server
|
|
curl 127.0.0.1:8070/index -o - 2>/dev/null | wc -l
|
|
|
|
curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
|
|
-o - 2>/dev/null | wc -l
|
|
|
|
url=$(curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
|
|
-o - 2>/dev/null | head -1 | jq -r .result_url)
|
|
echo $url
|
|
# http://hepc/db/db-collection.tmp/aircrack-ng-aircrack-ng-ctsj-41ebbe.zip
|
|
|
|
wget $(echo $url|sed 's|http://hepc|http://127.0.0.1:8070|g;')
|
|
|
|
#+END_SRC
|
|
|
|
** Installation
|
|
- Use [[https://docs.astral.sh/uv/][uv]] to install dependencies without manually activating a venv
|
|
#+begin_example
|
|
cd ~/work-gh/mrva/mrvahepc
|
|
uv sync
|
|
#+end_example
|
|
=uv sync= installs everything declared in =pyproject.toml= into a managed
|
|
=.venv= and caches the wheels; the =bin/= scripts already use
|
|
=uv run= in their shebangs, so you can execute them directly.
|
|
|
|
- Local development
|
|
#+begin_example
|
|
cd ~/work-gh/mrva/mrvahepc
|
|
uv sync
|
|
uv pip install --editable .
|
|
#+end_example
|
|
The =--editable= install is optional; use =./bin/*= directly to avoid
|
|
relying on entry points in your shell.
|
|
|
|
- Full installation
|
|
#+begin_example
|
|
pip install mrvahepc
|
|
#+end_example
|
|
|
|
** Use as library
|
|
The best way to examine the code is starting from the high-level scripts
|
|
in =bin/=.
|
|
|
|
|