diff --git a/src/components/Menu/MenuContainer.jsx b/src/components/Menu/MenuContainer.jsx index cb187209e..50eb3dfe0 100644 --- a/src/components/Menu/MenuContainer.jsx +++ b/src/components/Menu/MenuContainer.jsx @@ -308,14 +308,31 @@ const MenuContainer = () => { } } } else { - for (let key in processedData) { - let props = processedData[key].props; - if (props.length === 0) continue; - let chunked = props.chunk(); - let statement = processedData[key].statement; - - for (let chunk of chunked) { - await uploadData(statement, chunk); + if (Array.isArray(processedData)) { + for (let data in processedData) { + data = processedData[data]; + for (let key in data) { + let props = data[key].props; + if (props.length === 0) continue; + let chunked = props.chunk(); + let statement = data[key].statement; + + for (let chunk of chunked) { + await uploadData(statement, chunk); + } + } + } + } + else { + for (let key in processedData) { + let props = processedData[key].props; + if (props.length === 0) continue; + let chunked = props.chunk(); + let statement = processedData[key].statement; + + for (let chunk of chunked) { + await uploadData(statement, chunk); + } } } } diff --git a/src/js/ingestion_types.js b/src/js/ingestion_types.js index c8984cbc8..422c73056 100644 --- a/src/js/ingestion_types.js +++ b/src/js/ingestion_types.js @@ -115,6 +115,18 @@ * @property {Array.} DcomUsers * @property {Array.} PSRemoteUsers * @property {Array.} AffectedComputers + * @property {boolean} BlockInheritance + * @property {LinkType} Unenforced + * @property {LinkType} Enforced + */ + +/** + * @typedef {Object} LinkType + * @property {Dictionary.} PasswordPolicies + * @property {Dictionary.} LockoutPolicies + * @property {Dictionary.} SMBSigning + * @property {Dictionary.} LDAPSigning + * @property {Dictionary.} LMAuthenticationLevel */ /** diff --git a/src/js/newingestion.js b/src/js/newingestion.js index 3cc024c8e..dc0b7103e 100644 --- a/src/js/newingestion.js +++ b/src/js/newingestion.js @@ -1,5 +1,7 @@ import { groupBy } from 'lodash/collection'; +let unenforcedDomainProperties = {}; +let enforcedDomainPropertyKeys = {}; const TRUST_DIRECTION_INBOUND = 'Inbound'; const TRUST_DIRECTION_OUTBOUND = 'Outbound'; const TRUST_DIRECTION_BIDIRECTIONAL = 'Bidirectional'; @@ -34,6 +36,12 @@ export const ADLabels = { Contains: 'Contains', GPLink: 'GPLink', TrustedBy: 'TrustedBy', + PasswordPolicies: 'PasswordPolicies', + LockoutPolicies: 'LockoutPolicies', + SMBSigning: 'SMBSigning', + LDAPSigning: 'LDAPSigning', + LMAuthenticationLevel: 'LMAuthenticationLevel', + GPOChanges: 'GPOChanges', }; const AzureApplicationAdministratorRoleId = @@ -527,7 +535,7 @@ export function buildContainerJsonNew(chunk) { /** * @param {Array.} chunk * @return {{}} - */ +*/ export function buildOuJsonNew(chunk) { let queries = {}; queries.properties = { @@ -535,6 +543,17 @@ export function buildOuJsonNew(chunk) { props: [], }; + let computerStatement = PROP_QUERY.format(ADLabels.Computer); + let computerQuery = {}; + let computerProperties = []; + let blockInheritanceComputers = []; + + // sort OU from the children to the parent using the length of the distinguished name + chunk.sort((a,b) => { + return b.Properties.distinguishedname.length - a.Properties.distinguishedname.length; + }); + + // OU are processed from the bottom up, so the default behavior is to not override already set properties for (let ou of chunk) { let properties = ou.Properties; let links = ou.Links; @@ -543,6 +562,7 @@ export function buildOuJsonNew(chunk) { let identifier = ou.ObjectIdentifier.toUpperCase(); properties.objectid = identifier; let aces = ou.Aces; + let blockInheritance = ou.GPOChanges.BlockInheritance; processAceArrayNew(aces, identifier, 'OU', queries); @@ -551,6 +571,104 @@ export function buildOuJsonNew(chunk) { map: properties, }); + // add GPOChanges properties to the affected computers + let computers = ou.GPOChanges.AffectedComputers; + let ouProperties = {"unenforced": {}, "enforced": {}}; + let linkType = [ou.GPOChanges.Unenforced, ou.GPOChanges.Enforced]; + + // add enforced and unenforced properties separatly + for (let index=0;index domainProperties["enforced"][key] !== undefined); + } processAceArrayNew(aces, identifier, 'Domain', queries); @@ -721,8 +908,6 @@ export function buildDomainJsonNew(chunk) { }); insertNew(queries, format, props); - let computers = domain.GPOChanges.AffectedComputers; - format = [ '', ADLabels.Computer, @@ -861,7 +1046,14 @@ export function buildDomainJsonNew(chunk) { } } - return queries; + computerQuery = { + properties: { + statement: computerStatement, + props: computerProperties, + } + }; + + return [queries, computerQuery]; } const baseInsertStatement =