Files
trailofbits-buttercup/program-model/src/buttercup/program_model/kythe.py
T
2over12 ea2fd093d5 Program model integrate (#13)
* Add documentation

* Add janusgraph custom configuration. Simply graph creation.

* Add properties to edges. Index on uri property.

* reformat

* Create libpng graph in a more reasonable amount of time.

* Update README.md

* Wrap indexing into function

* updating...

* update proto

* fix command

* Update settings for serve and processing indexing

* Add dockerfile to docker container

* Add trigger script

* Fix error with loading graphml file

* reformat

* Remove resource constraints for program model

* Change permissions of temp dir

* Update readme

* Update dockerignore

---------

Co-authored-by: Evan Downing <2077950+evandowning@users.noreply.github.com>
2025-02-18 11:59:16 -05:00

35 lines
949 B
Python

import subprocess
import logging
import os
from dataclasses import dataclass
logger = logging.getLogger(__name__)
@dataclass
class KytheConf:
kythe_dir: str
class KytheTool:
def __init__(self, conf: KytheConf):
self.conf = conf
def merge_kythe_output(self, input_dir: str, output_kzip: str):
merge_path = os.path.join(self.conf.kythe_dir, "tools/kzip")
total = []
for fl in os.listdir(input_dir):
if fl.endswith(".kzip"):
total.append(os.path.join(input_dir, fl))
command = [merge_path, "merge", "--output", output_kzip] + total
subprocess.run(command, check=True)
return True
def cxx_index(self, input_kzip: str, output_bin: str):
indexer_path = os.path.join(self.conf.kythe_dir, "indexers/cxx_indexer")
command = [indexer_path, input_kzip, "-o", output_bin]
subprocess.run(command, check=True)
return True