diff --git a/Dockerfile b/Dockerfile index 31ae5b7..add503a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \ org.opencontainers.image.authors="Team AppThreat " \ org.opencontainers.image.source="https://github.com/appthreat/cpggen" \ org.opencontainers.image.url="https://github.com/appthreat/cpggen" \ - org.opencontainers.image.version="1.1.2" \ + org.opencontainers.image.version="1.1.3" \ org.opencontainers.image.vendor="AppThreat" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.title="cpggen" \ diff --git a/Dockerfile-alma8 b/Dockerfile-alma8 index 92cb67c..f5d79ae 100644 --- a/Dockerfile-alma8 +++ b/Dockerfile-alma8 @@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \ org.opencontainers.image.authors="Team AppThreat " \ org.opencontainers.image.source="https://github.com/appthreat/cpggen" \ org.opencontainers.image.url="https://github.com/appthreat/cpggen" \ - org.opencontainers.image.version="1.1.2" \ + org.opencontainers.image.version="1.1.3" \ org.opencontainers.image.vendor="AppThreat" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.title="cpggen" \ diff --git a/Dockerfile-oss b/Dockerfile-oss index 4961840..dfca9ad 100644 --- a/Dockerfile-oss +++ b/Dockerfile-oss @@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \ org.opencontainers.image.authors="Team AppThreat " \ org.opencontainers.image.source="https://github.com/appthreat/cpggen" \ org.opencontainers.image.url="https://github.com/appthreat/cpggen" \ - org.opencontainers.image.version="1.1.2" \ + org.opencontainers.image.version="1.1.3" \ org.opencontainers.image.vendor="AppThreat" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.title="cpggen" \ diff --git a/README.md b/README.md index cc9b97c..93ef720 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Download the executable binary for your operating system from the [releases page - cdxgen with Node.js 18 - Generates SBoM ```bash -curl -LO https://github.com/AppThreat/cpggen/releases/download/v1.1.2/cpggen-linux-amd64 +curl -LO https://github.com/AppThreat/cpggen/releases/download/v1.1.3/cpggen-linux-amd64 chmod +x cpggen-linux-amd64 ./cpggen-linux-amd64 --help ``` @@ -39,7 +39,7 @@ chmod +x cpggen-linux-amd64 On Windows, ```powershell -curl -LO https://github.com/appthreat/cpggen/releases/download/v1.1.2/cpggen.exe +curl -LO https://github.com/appthreat/cpggen/releases/download/v1.1.3/cpggen.exe .\cpggen.exe --help ``` diff --git a/cpggen/cli.py b/cpggen/cli.py index 046df95..1a94edb 100644 --- a/cpggen/cli.py +++ b/cpggen/cli.py @@ -189,6 +189,7 @@ async def generate_cpg(): src = "" languages = "" cpg_out_dir = None + export_out_dir = None is_temp_dir = False auto_build = True skip_sbom = True @@ -243,15 +244,19 @@ async def generate_cpg(): src.startswith("http") or src.startswith("git://") or src.startswith("pkg:") ): url = src - if url.startswith("http") or url.startswith("git://") or url.startswith("pkg:"): + if url: clone_dir = tempfile.mkdtemp(prefix="cpggen") - if src.startswith("pkg:"): - download_file = utils.download_package(src, clone_dir) + if url.startswith("pkg:"): + download_file = utils.download_package(url, clone_dir) if download_file and os.path.exists(download_file): src = clone_dir else: src = utils.clone_repo(url, clone_dir) is_temp_dir = True + if not cpg_out_dir: + cpg_out_dir = tempfile.mkdtemp(prefix="cpggen_cpg_out") + if not export_out_dir: + export_out_dir = tempfile.mkdtemp(prefix="cpggen_export_out") if cpg_out_dir and not os.path.exists(cpg_out_dir): os.makedirs(cpg_out_dir, exist_ok=True) if not languages or languages == "autodetect": @@ -483,7 +488,11 @@ def main(): src = args.src cpg_out_dir = args.cpg_out_dir export_out_dir = args.export_out_dir - if not src.startswith("http") and not src.startswith("git://"): + if ( + not src.startswith("http") + and not src.startswith("git://") + and not src.startswith("pkg:") + ): src = str(PurePath(args.src)) if not cpg_out_dir and src: if os.path.isfile(src): @@ -544,7 +553,6 @@ def main(): languages = languages.split(",") if cpg_out_dir and not os.path.exists(cpg_out_dir): os.makedirs(cpg_out_dir, exist_ok=True) - cpg( src, cpg_out_dir, diff --git a/pyproject.toml b/pyproject.toml index 1246a5f..35ba78c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cpggen" -version = "1.1.2" +version = "1.1.3" description = "Generate CPG for multiple languages for use with joern" authors = ["Team AppThreat "] license = "Apache-2.0"