示例#1
0
import subprocess
import psycopg2
from subprocess import PIPE
import json
import re
import os
import requests

import sbom_populate as p
import initial_scans as s

if __name__ == "__main__":
    with open("augur_sbom_config.json") as json_file:
        config = json.load(json_file)
        dbname = config["dbname"]
        user = config["user"]
        password = config["password"]
        host = config["host"]
        port = config["port"]
        dsfile = config["dsfile"]
        ipath = config["repos_path"]
        print("---------------------")
        print("INITIAL SCANS RUNNING")
        print("---------------------")
        s.scan(dbname, user, password, host, port, dsfile, ipath)
        print("------------------")
        print("SBOM SCANS RUNNING")
        print("------------------")
        p.scan(dbname, user, password, host, port, dsfile, ipath)
示例#2
0
        print("HOME EQUALS " + home)

        configtools = 'postgresql://{}:{}@{}:{}/{}'.format(
            user, password, host, port, dbname
        )

        Path(home+"/.config/dosocs2").mkdir(parents=True, exist_ok=True) 

        with open("dosocs2-example.conf") as configfile:
            content = configfile.read()
            content_new = re.sub('(connection_uri = .*)\n', "connection_uri = " + configtools + "?options=--search_path=spdx\n", content)
            with open("dosocs2.conf","w+") as outfile:
                outfile.write(content_new)
            with open(home + "/.config/dosocs2/dosocs2.conf","w+") as coreconfig:
                coreconfig.write(content_new)

        wd = os.getcwd()
        mwd = wd + "/dosocs2.conf"

        print("---------------------")
        print("INITIAL SCANS RUNNING")
        print("---------------------")
        s.scan(dbname, user, password, host, port, dsfile, ipath, depth, mwd)
        #print(os.getcwd())
        os.chdir(wd)
        #print(os.getcwd())
        print("------------------")
        print("SBOM SCANS RUNNING")
        print("------------------")
        p.scan(dbname, user, password, host, port, dsfile, ipath, mwd)