Exemplo n.º 1
0
def main(args=None):
    if not HAS_NEO_MODULE:
        print(
            'neo4j python module not found! Please install the module neo4j-driver first (pip install neo4j-driver)'
        )
        return
    if args is None:
        parser = argparse.ArgumentParser(
            add_help=True,
            description='ROADrecon policies to HTML plugin',
            formatter_class=argparse.RawDescriptionHelpFormatter)
        parser.add_argument(
            '-d',
            '--database',
            action='store',
            help=
            'Database file. Can be the local database name for SQLite, or an SQLAlchemy compatible URL such as postgresql+psycopg2://dirkjan@/roadtools',
            default='roadrecon.db')
        add_args(parser)
        args = parser.parse_args()
    db_url = database.parse_db_argument(args.database)
    if args.database_password is None:
        args.database_user, args.database_password = BloodHoundPlugin.detect_db_config(
        )
        if args.database_password is None:
            print(
                'Error: Could not autodetect the Neo4j database credentials from your BloodHound config. Please specify them manually'
            )
            return
    session = database.get_session(database.init(dburl=db_url))
    plugin = BloodHoundPlugin(session, args.neodatabase, args.database_user,
                              args.database_password)
    plugin.main()
Exemplo n.º 2
0
def main(args=None):
    if args is None:
        parser = argparse.ArgumentParser(
            add_help=True,
            description='ROADrecon policies to HTML plugin',
            formatter_class=argparse.RawDescriptionHelpFormatter)
        parser.add_argument(
            '-d',
            '--database',
            action='store',
            help=
            'Database file. Can be the local database name for SQLite, or an SQLAlchemy compatible URL such as postgresql+psycopg2://dirkjan@/roadtools',
            default='roadrecon.db')
        add_args(parser)
        args = parser.parse_args()
    db_url = database.parse_db_argument(args.database)
    session = database.get_session(database.init(dburl=db_url))
    plugin = AccessPoliciesPlugin(session, args.file)
    plugin.main(args.print)
Exemplo n.º 3
0
def main(args=None):
    if args is None:
        parser = create_args_parser()
        args = parser.parse_args()

    db_url = database.parse_db_argument(args.database)
    session = database.get_session(database.init(dburl=db_url))
    filename, file_extension = os.path.splitext(args.file)
    if not file_extension:
        file_extension = '.xlsx'
    if file_extension not in SUPPORTED_EXTENSIONS:
        print("%s is not a supported extention. Only %s are supported" %
              (file_extension, ', '.join(SUPPORTED_EXTENSIONS)))
        return

    plugin = ExportToFilePlugin(session,
                                filename + file_extension,
                                verbose=args.verbose)
    plugin.main()
    print("Data have been exported to the %s%s file" %
          (filename, file_extension))