Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix script entry point and #28 #32

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bloodhound_import/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import asyncio
import logging
from bloodhound_import import database
from bloodhound_import.importer import parse_file, add_constraints
Expand Down Expand Up @@ -51,4 +52,4 @@ async def main():


if __name__ == "__main__":
main()
asyncio.run(main())
4 changes: 2 additions & 2 deletions bloodhound_import/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Code borrowed from
https://github.com/fox-it/aclpwn.py/blob/master/aclpwn/database.py
"""
from neo4j import AsyncGraphDatabase
from neo4j import AsyncGraphDatabase, AsyncDriver
import platform
import json
import os


def init_driver(ip, port, scheme, user, password):
def init_driver(ip, port, scheme, user, password) -> AsyncDriver:
uri = "{}://{}:{}".format(scheme, ip, port)
driver = AsyncGraphDatabase.driver(uri, auth=(user, password))
return driver
Expand Down
2 changes: 1 addition & 1 deletion bloodhound_import/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ async def parse_container(tx: neo4j.Transaction, container: dict):
query = build_add_edge_query('Container', target['ObjectType'], 'Contains', '{isacl: false}')
await tx.run(query, props=dict(source=identifier, target=target['ObjectIdentifier']))

async def parse_file(filename: str, driver: neo4j.GraphDatabase):
async def parse_file(filename: str, driver: neo4j.AsyncDriver):
"""Parse a bloodhound file.

Arguments:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
packages=['bloodhound_import'],
install_requires=['neo4j-driver', 'ijson'],
entry_points={
'console_scripts': ['bloodhound-import=bloodhound_import:main']
'console_scripts': ['bloodhound-import=bloodhound_import:__main__']
}
)