INNER CODE UNIT · Python

db_connect

idnahacks/GoodHound · goodhound/neodb.py:6

def db_connect(args):
    """Sets up the connection to the neo4j database"""
    logging.info('Connecting to database.')
    try:
        graph = Graph(args.server, user=args.username, password=args.password)
        return graph    
    except Exception as e:
        logging.error("Database connection failure.")
        logging.error(e.__context__)
        sys.exit(1)

def schema(graph, args):
    """Optionally runs cypher statements to add attributes to nodes or edges."""
    try:
        with open(args.schema,'r') as schema_query:
            line = schema_query.readline()
            logging.info('Writing schema.')
            while line:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…