Add hepc integration
This commit is contained in:
committed by
=Michael Hohn
parent
8e35b1605c
commit
fe026416c5
38
README.org
38
README.org
@@ -1,29 +1,31 @@
|
||||
* Introduction to hepc -- HTTP End Point for CodeQL
|
||||
** Usage Sample
|
||||
#+BEGIN_SRC sh
|
||||
# Collect DBs from filesystem
|
||||
cd ~/work-gh/mrva/mrvahepc && rm -fR db-collection.tmp/
|
||||
./bin/mc-hepc-init --db_collection_dir db-collection.tmp \
|
||||
--starting_path ~/work-gh/mrva/mrva-open-source-download \
|
||||
--max_dbs 17
|
||||
# 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
|
||||
. venv/bin/activate
|
||||
./bin/mc-hepc-serve --codeql-db-dir db-collection.tmp
|
||||
# Serve collected DBs plus metadata
|
||||
cd ~/work-gh/mrva/mrvahepc
|
||||
. venv/bin/activate
|
||||
|
||||
# Test server
|
||||
curl 127.0.0.1:8070/index -o - 2>/dev/null | wc -l
|
||||
./bin/mc-hepc-serve --codeql-db-dir db-collection.tmp
|
||||
|
||||
curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
|
||||
-o - 2>/dev/null | wc -l
|
||||
# Test server
|
||||
curl 127.0.0.1:8070/index -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
|
||||
curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
|
||||
-o - 2>/dev/null | wc -l
|
||||
|
||||
wget $(echo $url|sed 's|http://hepc|http://127.0.0.1:8070|g;')
|
||||
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
|
||||
|
||||
|
||||
@@ -52,10 +52,15 @@ def process_db_file(zip_path, db_collection_dir):
|
||||
source_location_prefix = local.path(yaml_data["sourceLocationPrefix"])
|
||||
repo = source_location_prefix.name
|
||||
owner = source_location_prefix.parent.name
|
||||
cid = generate_cid(cli_version, creation_time, primary_language, sha)
|
||||
cid = generate_cid(cli_version, creation_time, primary_language, sha)
|
||||
new_db_fname = f"{owner}-{repo}-ctsj-{cid}.zip"
|
||||
result_url = f"http://hepc/db/{db_collection_dir}/{new_db_fname}"
|
||||
|
||||
hepc_endpoint = os.getenv("MRVA_HEPC_ENDPOINT")
|
||||
if hepc_endpoint is None:
|
||||
log("WARN", "Environment variable 'MRVA_HEPC_ENDPOINT' is not set."
|
||||
"Using default 'http://hepc'.")
|
||||
hepc_endpoint = "http://hepc"
|
||||
result_url = f"{hepc_endpoint}/db/{db_collection_dir}/{new_db_fname}"
|
||||
|
||||
metadata = {
|
||||
"git_branch" : "HEAD",
|
||||
"git_commit_id" : sha,
|
||||
|
||||
8
mrvahepc.code-workspace
Normal file
8
mrvahepc.code-workspace
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
Reference in New Issue
Block a user