nicolas-carolo / adsimulator

A realistic simulator of Active Directory domains
https://nicolascarolo.tk/projects/adsimulator/
BSD 3-Clause "New" or "Revised" License
31 stars 2 forks source link

Program crashes when nGroup exceeds 500 #1

Open YMZhang7 opened 2 years ago

YMZhang7 commented 2 years ago

Here are the graph settings:

{
    "ACLs": {
        "ACLPrincipalsPercentage": 50,
        "ACLsProbability": {
            "AddMember": 30,
            "ForceChangePassword": 15,
            "GenericAll": 10,
            "GenericWrite": 15,
            "ReadLAPSPassword": 10,
            "WriteDacl": 15,
            "WriteOwner": 15
        }
    },
    "Computer": {
        "AllowedToDelegateFromComputerPercentage": 10,
        "AllowedToDelegateFromUserPercentage": 10,
        "CanPSRemoteFromGroupPercentage": 10,
        "CanPSRemoteFromUserPercentage": 10,
        "CanRDPFromGroupPercentage": 10,
        "CanRDPFromUserPercentage": 10,
        "ExecuteDCOMFromGroupPercentage": 10,
        "ExecuteDCOMFromUserPercentage": 10,
        "enabled": 90,
        "haslaps": 10,
        "nComputers": 1000,
        "osProbability": {
            "Windows 10 Enterprise": 40,
            "Windows 10 Pro": 30,
            "Windows 7 Enterprise Service Pack 1": 15,
            "Windows 7 Professional Service Pack 1": 7,
            "Windows 7 Ultimate Service Pack 1": 5,
            "Windows XP Professional Service Pack 3": 3
        },
        "unconstraineddelegation": 10
    },
    "DC": {
        "enabled": 90,
        "haslaps": 10,
        "osProbability": {
            "Windows Server 2003 Enterprise Edition": 1,
            "Windows Server 2008 Datacenter": 1,
            "Windows Server 2008 Enterprise": 1,
            "Windows Server 2008 R2 Datacenter": 3,
            "Windows Server 2008 R2 Enterprise": 3,
            "Windows Server 2008 R2 Standard": 2,
            "Windows Server 2008 Standard": 1,
            "Windows Server 2012 Datacenter": 4,
            "Windows Server 2012 R2 Datacenter": 10,
            "Windows Server 2012 R2 Standard": 10,
            "Windows Server 2012 Standard": 4,
            "Windows Server 2016 Datacenter": 25,
            "Windows Server 2016 Standard": 35
        }
    },
    "Domain": {
        "Trusts": {
            "Bidirectional": 1,
            "Inbound": 1,
            "Outbound": 1,
            "SIDFilteringProbability": 50
        },
        "functionalLevelProbability": {
            "2008": 4,
            "2008 R2": 5,
            "2012": 10,
            "2012 R2": 30,
            "2016": 50,
            "Unknown": 1
        }
    },
    "GPO": {
        "nGPOs": 20
    },
    "Group": {
        "departmentProbability": {
            "BIDNESS": 20,
            "HR": 20,
            "IT": 20,
            "MARKETING": 20,
            "OPERATIONS": 20
        },
        "nGroups": 501,
        "nestingGroupProbability": 30
    },
    "OU": {
        "nOUs": 200
    },
    "User": {
        "dontreqpreauth": 5,
        "enabled": 85,
        "hasspn": 10,
        "nUsers": 1000,
        "passwordnotreqd": 5,
        "pwdneverexpires": 50,
        "sidhistory": 10,
        "unconstraineddelegation": 20
    }
}

When I tried to generate the graph with these settings, the following messages were shown:

Database Connection Successful!
Clearing Database
DB Cleared and Schema Set
Starting data generation
Generating the TESTLAB.LOCAL domain
    - Functional level probability:
        - 2008: 4 %
        - 2008 R2: 5 %
        - 2012: 10 %
        - 2012 R2: 30 %
        - 2016: 50 %
        - Unknown: 1 %
Generating the default domain groups
Generating default GPOs
Generating Domain Controllers OU
Linking Default GPOs
Generating Enterprise Admins ACLs
Generating Administrators ACLs
Generating Domain Admins ACLs
Generating DC groups ACLs
Generating 1000 computers
    - Enabled computer probability: 90 %
    - HasLaps computer probability: 10 %
    - Unconstrained delegation computer probability: 10 %
    - Computer OS probability:
        - Windows XP Professional Service Pack 3: 3 %
        - Windows 7 Professional Service Pack 1: 7 %
        - Windows 7 Ultimate Service Pack 1: 5 %
        - Windows 7 Enterprise Service Pack 1: 15 %
        - Windows 10 Pro: 30 %
        - Windows 10 Enterprise: 40 %
Generating 25 Domain Controllers
    - Enabled DC probability: 90 %
    - HasLaps DC probability: 10 %
    - Domain Controller OS probability:
        - Windows Server 2003 Enterprise Edition: 1 %
        - Windows Server 2008 Standard: 1 %
        - Windows Server 2008 Datacenter: 1 %
        - Windows Server 2008 Enterprise: 1 %
        - Windows Server 2008 R2 Standard: 2 %
        - Windows Server 2008 R2 Datacenter: 3 %
        - Windows Server 2008 R2 Enterprise: 3 %
        - Windows Server 2012 Standard: 4 %
        - Windows Server 2012 Datacenter: 4 %
        - Windows Server 2012 R2 Standard: 10 %
        - Windows Server 2012 R2 Datacenter: 10 %
        - Windows Server 2016 Standard: 35 %
        - Windows Server 2016 Datacenter: 25 %
Generating default users
Generating 1000 users
    - Enabled user probability: 85 %
    - Dontreqpreauth user probability: 5 %
    - Dontreqpreauth user probability: 5 %
    - Hasspn user probability: 10 %
    - Passwordnotreqd user probability: 5 %
    - Pwdneverexpires user probability: 50 %
    - Unconstrained delegation user probability: 20 %
    - User has SID History probability: 10 %
Generating groups
    - Department probability:
        - IT: 20 %
        - HR: 20 %
        - MARKETING: 20 %
        - OPERATIONS: 20 %
        - BIDNESS: 20 %
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/adsimulator", line 33, in <module>
    sys.exit(load_entry_point('adsimulator==1.1.0', 'console_scripts', 'adsimulator')())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/adsimulator-1.1.0-py3.10.egg/adsimulator/main.py", line 37, in main
    MainMenu().cmdloop()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/adsimulator-1.1.0-py3.10.egg/adsimulator/DBCreator.py", line 118, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/cmd.py", line 217, in onecmd
    return func(arg)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/adsimulator-1.1.0-py3.10.egg/adsimulator/DBCreator.py", line 282, in do_generate
    self.generate_data()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/adsimulator-1.1.0-py3.10.egg/adsimulator/DBCreator.py", line 364, in generate_data
    group_properties_list, groups, ridcount = generate_groups(session, self.domain, self.base_sid, domain_dn, num_groups, groups, ridcount, self.parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/adsimulator-1.1.0-py3.10.egg/adsimulator/generators/groups.py", line 95, in generate_groups
    session.run(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/work/simple.py", line 215, in run
    self._autoResult._run(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/work/result.py", line 114, in _run
    self._attach()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/work/result.py", line 203, in _attach
    self._connection.fetch_message()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/io/_common.py", line 186, in inner
    func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/io/_bolt4.py", line 309, in fetch_message
    response.on_failure(summary_metadata or {})
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/neo4j/io/_common.py", line 244, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.ClientError: {code: Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): prop}

This happens when nGroups is any value larger than 500. Thank you.

nicolas-carolo commented 2 years ago

Hi, I have fixed this bug in version 1.1.1 I have just released. Thanks for the bug reporting!