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

Update DBCreator.py #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update DBCreator.py #31

wants to merge 2 commits into from

Conversation

kontr0x
Copy link

@kontr0x kontr0x commented Apr 17, 2023

Updated syntax to comply with the newest version.

Fixed minor issues in the "DEFAULT DOMAIN CONTROLLERS POLICY" query.

Updated to latest pip packages (requirements.txt needs to be adjusted):

  • neo4j==1.7.6 --> 5.7.0
  • neobolt==1.7.16 --> 1.7.17
  • neotime==1.7.4
  • pytz==2019.3 --> 2023.3
  • six==1.14.0 --> 1.16.0

Updated syntax to comply with the newest version.

Fixed minor issues in the "DEFAULT DOMAIN CONTROLLERS POLICY" query.
@unamuno
Copy link

unamuno commented May 24, 2023

Fixes the Bug:
neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: The old parameter syntax {param} is no longer supported. Please use $param instead (line 1, column 8 (offset: 7))
"UNWIND {props} as prop MERGE (n:Base {objectid:prop.id}) SET n:Computer, n += prop.props WITH n MERGE (m:Group {name:$gname}) WITH n,m MERGE (n)-[:MemberOf]->(m)"

@z-jxy z-jxy mentioned this pull request Jul 20, 2023
@tinmarino
Copy link

Thank you, this fixed the bug for me

Before

(Cmd) generate
Starting data generation with nodes=500
Populating Standard Nodes
Adding Standard Edges
Generating Computer Nodes
Traceback (most recent call last):
  File "/home/mtourneboeuf/Program/BloodHound-Tools/DBCreator/DBCreator.py", line 806, in <module>
    MainMenu().cmdloop()
  File "/home/mtourneboeuf/Program/BloodHound-Tools/DBCreator/DBCreator.py", line 69, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "/usr/lib/python3.10/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python3.10/cmd.py", line 217, in onecmd
    return func(arg)
  File "/home/mtourneboeuf/Program/BloodHound-Tools/DBCreator/DBCreator.py", line 200, in do_generate
    self.generate_data()
  File "/home/mtourneboeuf/Program/BloodHound-Tools/DBCreator/DBCreator.py", line 358, in generate_data
    session.run(
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/work/session.py", line 314, in run
    self._auto_result._run(
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/work/result.py", line 221, in _run
    self._attach()
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/work/result.py", line 409, in _attach
    self._connection.fetch_message()
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/io/_common.py", line 178, in inner
    func(*args, **kwargs)
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 855, in fetch_message
    res = self._process_message(tag, fields)
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt5.py", line 370, in _process_message
    response.on_failure(summary_metadata or {})
  File "/home/mtourneboeuf/.local/lib/python3.10/site-packages/neo4j/_sync/io/_common.py", line 245, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input '}': expected ':' (line 1, column 14 (offset: 13))
"UNWIND {props} as prop MERGE (n:Base {objectid:prop.id}) SET n:Computer, n += prop.props WITH n MERGE (m:Group {name:$gname}) WITH n,m MERGE (n)-[:MemberOf]->(m)"
              ^}

After

(Cmd) generate
Starting data generation with nodes=500
Populating Standard Nodes
Adding Standard Edges
Generating Computer Nodes
Creating Domain Controllers
Generating User Nodes
Generating Group Nodes
Adding Domain Admins to Local Admins of Computers
Creating 15 Domain Admins (3% of users capped at 30)
Applying random group nesting
Adding users to groups
Calculated 7 groups per user with a variance of - 6
Adding local admin rights
Adding RDP/ExecuteDCOM/AllowedToDelegateTo
Adding sessions
Adding Domain Admin ACEs
Creating OUs
Creating GPOs
Adding outbound ACLs to 2 objects
Marking some users as Kerberoastable
Adding unconstrained delegation to a few computers
Database Generation Finished!

@gudgeong
Copy link

Hi All,

I have this list of packages
Package Version


neo4j 5.24.0
neobolt 1.7.17
neotime 1.7.4
pip 24.0
pytz 2024.2
six 1.16.0

But I still seem to be getting this error

neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: The old parameter syntax {param} is no longer supported. Please use $param instead (line 1, column 8 (offset: 7))
"UNWIND {props} as prop MERGE (n:Base {objectid:prop.id}) SET n:Computer, n += prop.props WITH n MERGE (m:Group {name:$gname}) WITH n,m MERGE (n)-[:MemberOf]->(m)"
^}

Maybe I have something wrong somewhere.... neo4j package too new ??

@kontr0x
Copy link
Author

kontr0x commented Sep 17, 2024

Hi All,

I have this list of packages Package Version

neo4j 5.24.0 neobolt 1.7.17 neotime 1.7.4 pip 24.0 pytz 2024.2 six 1.16.0

But I still seem to be getting this error

neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: The old parameter syntax {param} is no longer supported. Please use $param instead (line 1, column 8 (offset: 7)) "UNWIND {props} as prop MERGE (n:Base {objectid:prop.id}) SET n:Computer, n += prop.props WITH n MERGE (m:Group {name:$gname}) WITH n,m MERGE (n)-[:MemberOf]->(m)" ^}

Maybe I have something wrong somewhere.... neo4j package too new ??

Hello @gudgeong, have you used the updated DBcreator.py from this PR?
Otherwise, the error is very self-explanatory. You should be good to go if you use the DBcreator.py from this pull request, or update the parameter syntax by changing "{param}" to "$param" in every query.

@gudgeong
Copy link

yes.. you are correct

Have done so and worked all ok

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants