Skip to content

Commit

Permalink
fix script entry point and fox-it#28
Browse files Browse the repository at this point in the history
  • Loading branch information
daddycocoaman committed Dec 14, 2022
1 parent 8ad4006 commit 44c858a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
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__']
}
)

0 comments on commit 44c858a

Please sign in to comment.