INNER CODE UNIT · Python

checkoutdir

idnahacks/GoodHound · goodhound/ghutils.py:30

def checkoutdir(path):
    """Check if the user input output path exists and is a directory and creates the file path if needed."""
    if Path(path).exists():
        if not Path(path).is_dir():
            logging.error('Selected output path is not a directory')
            exit(1)
    else:
        os.makedirs(path, exist_ok=True)

def checkdbfileexists(sqlpath):
    """Looks at the provided sql-path argument and determines whether to create a new db or update an existing one."""
    if Path(sqlpath).exists():
        if Path(sqlpath).is_file():
            dbfile = sqlpath
        else:
            dbfile = sqlpath + os.sep + "goodhound.db"
    else:
        os.makedirs(sqlpath, exist_ok=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…