diff --git a/src/components/SearchContainer/Tabs/ComputerNodeData.jsx b/src/components/SearchContainer/Tabs/ComputerNodeData.jsx index d58b5d3..505a172 100644 --- a/src/components/SearchContainer/Tabs/ComputerNodeData.jsx +++ b/src/components/SearchContainer/Tabs/ComputerNodeData.jsx @@ -3,342 +3,355 @@ import NodeALink from './NodeALink' import PropTypes from 'prop-types' export default class ComputerNodeData extends Component { - constructor(){ - super(); + constructor(){ + super(); - this.state = { - label: "", - os: "None", - unconstrained: "None", - explicitAdmins: -1, - unrolledAdmins: -1, - firstDegreeGroupMembership: -1, - unrolledGroupMembership: -1, - firstDegreeLocalAdmin: -1, - groupDelegatedLocalAdmin: -1, - derivativeLocalAdmin: -1, - sessions: -1, - firstdegreeControl: -1, - groupDelegatedControl: -1, - transitiveControl: -1, - derivativeLocalAdmins: -1, - driversessions: [] - } + this.state = { + label: "", + os: "None", + unconstrained: "None", + explicitAdmins: -1, + unrolledAdmins: -1, + firstDegreeGroupMembership: -1, + unrolledGroupMembership: -1, + firstDegreeLocalAdmin: -1, + groupDelegatedLocalAdmin: -1, + derivativeLocalAdmin: -1, + sessions: -1, + firstdegreeControl: -1, + groupDelegatedControl: -1, + transitiveControl: -1, + derivativeLocalAdmins: -1, + driversessions: [] + } - emitter.on('computerNodeClicked', this.getNodeData.bind(this)); - } + emitter.on('computerNodeClicked', this.getNodeData.bind(this)); + } - getNodeData(payload){ - $.each(this.state.driversessions, function(index, record){ - record.close(); - }) - this.setState({ - label: payload, - os: "None", - unconstrained: "None", - explicitAdmins: -1, - unrolledAdmins: -1, - firstDegreeGroupMembership: -1, - unrolledGroupMembership: -1, - sessions: -1, - firstDegreeLocalAdmin: -1, - groupDelegatedLocalAdmin: -1, - derivativeLocalAdmin: -1, - firstdegreeControl: -1, - groupDelegatedControl: -1, - transitiveControl: -1, - derivativeLocalAdmins: -1 - }) + getNodeData(payload){ + $.each(this.state.driversessions, function(index, record){ + record.close(); + }) + this.setState({ + label: payload, + os: "None", + unconstrained: "None", + explicitAdmins: -1, + unrolledAdmins: -1, + firstDegreeGroupMembership: -1, + unrolledGroupMembership: -1, + sessions: -1, + firstDegreeLocalAdmin: -1, + groupDelegatedLocalAdmin: -1, + derivativeLocalAdmin: -1, + firstdegreeControl: -1, + groupDelegatedControl: -1, + transitiveControl: -1, + derivativeLocalAdmins: -1 + }) - var s1 = driver.session() - var s2 = driver.session() - var s3 = driver.session() - var s4 = driver.session() - var s5 = driver.session() - var s6 = driver.session() - var s7 = driver.session() - var s8 = driver.session() - var s9 = driver.session() - var s10 = driver.session() - var s11 = driver.session() - var s12 = driver.session() - var s13 = driver.session() + var s1 = driver.session() + var s2 = driver.session() + var s3 = driver.session() + var s4 = driver.session() + var s5 = driver.session() + var s6 = driver.session() + var s7 = driver.session() + var s8 = driver.session() + var s9 = driver.session() + var s10 = driver.session() + var s11 = driver.session() + var s12 = driver.session() + var s13 = driver.session() - s1.run("MATCH (a)-[b:AdminTo]->(c:Computer {name:{name}}) RETURN count(a)", {name:payload}) - .then(function(result){ - this.setState({'explicitAdmins':result.records[0]._fields[0].low}) - s1.close() - }.bind(this)) + s1.run("MATCH (a)-[b:AdminTo]->(c:Computer {name:{name}}) RETURN count(a)", {name:payload}) + .then(function(result){ + this.setState({'explicitAdmins':result.records[0]._fields[0].low}) + s1.close() + }.bind(this)) - s2.run("MATCH p=(n:User)-[r:MemberOf|AdminTo*1..]->(m:Computer {name:{name}}) RETURN count(distinct(n))", {name:payload}) - .then(function(result){ - this.setState({'unrolledAdmins':result.records[0]._fields[0].low}) - s2.close() - }.bind(this)) + s2.run("MATCH p=(n:User)-[r:MemberOf|AdminTo*1..]->(m:Computer {name:{name}}) RETURN count(distinct(n))", {name:payload}) + .then(function(result){ + this.setState({'unrolledAdmins':result.records[0]._fields[0].low}) + s2.close() + }.bind(this)) - s3.run("MATCH (m:Computer {name:{name}}), (n:Computer), (m)-[r:AdminTo]->(n) RETURN count(distinct(m))", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeLocalAdmin':result.records[0]._fields[0].low}) - s3.close() - }.bind(this)) + s3.run("MATCH (m:Computer {name:{name}}), (n:Computer), (m)-[r:AdminTo]->(n) RETURN count(distinct(m))", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeLocalAdmin':result.records[0]._fields[0].low}) + s3.close() + }.bind(this)) - s4.run("MATCH p=(n:Computer {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AdminTo]->(c2:Computer) RETURN count(c2)", {name:payload}) - .then(function(result){ - this.setState({'groupDelegatedLocalAdmin':result.records[0]._fields[0].low}) - s4.close() - }.bind(this)) + s4.run("MATCH p=(n:Computer {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AdminTo]->(c2:Computer) RETURN count(c2)", {name:payload}) + .then(function(result){ + this.setState({'groupDelegatedLocalAdmin':result.records[0]._fields[0].low}); + s4.close(); + }.bind(this)) - s5.run("MATCH (n:Computer {name:{name}}), (m:Computer), p=shortestPath((n)-[r:AdminTo|MemberOf*1..]->(m)) RETURN count(distinct(m))", {name:payload}) - .then(function(result){ - this.setState({'derivativeLocalAdmin':result.records[0]._fields[0].low}) - s5.close() - }.bind(this)) + s5.run("MATCH (n:Computer {name:{name}}), (m:Computer) WHERE NOT m.name={name} MATCH p=shortestPath((n)-[r:AdminTo|MemberOf*1..]->(m)) RETURN count(distinct(m))", {name:payload}) + .then(function(result){ + this.setState({'derivativeLocalAdmin':result.records[0]._fields[0].low}) + s5.close() + }.bind(this)) - s6.run("MATCH (n:Computer {name:{name}}),(target:Group), (n)-[r:MemberOf]->(target) RETURN count(target)", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}) - s6.close() - }.bind(this)) + s6.run("MATCH (n:Computer {name:{name}}),(target:Group), (n)-[r:MemberOf]->(target) RETURN count(target)", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}) + s6.close() + }.bind(this)) - s7.run("MATCH p = (c:Computer {name:{name}})-[r:MemberOf*1..]->(g:Group) RETURN COUNT(DISTINCT(g))", {name:payload}) - .then(function(result){ - this.setState({'unrolledGroupMembership':result.records[0]._fields[0].low}) - s7.close() - }.bind(this)) + s7.run("MATCH p = (c:Computer {name:{name}})-[r:MemberOf*1..]->(g:Group) RETURN COUNT(DISTINCT(g))", {name:payload}) + .then(function(result){ + this.setState({'unrolledGroupMembership':result.records[0]._fields[0].low}) + s7.close() + }.bind(this)) - s8.run("MATCH (m:Computer {name:{name}})-[r:HasSession]->(n:User) WITH n,r,m WHERE NOT n.name ENDS WITH '$' RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'sessions':result.records[0]._fields[0].low}) - s8.close() - }.bind(this)) + s8.run("MATCH (m:Computer {name:{name}})-[r:HasSession]->(n:User) WITH n,r,m WHERE NOT n.name ENDS WITH '$' RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'sessions':result.records[0]._fields[0].low}) + s8.close() + }.bind(this)) - s9.run("MATCH p = shortestPath((n)-[r:AdminTo|MemberOf|HasSession*1..]->(m:Computer {name:{name}})) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'derivativeLocalAdmins':result.records[0]._fields[0].low}) - s9.close() - }.bind(this)) + s9.run("MATCH (n) WHERE NOT n.name={name} WITH n MATCH p = shortestPath((n)-[r:AdminTo|MemberOf|HasSession*1..]->(m:Computer {name:{name}})) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'derivativeLocalAdmins':result.records[0]._fields[0].low}) + s9.close() + }.bind(this)) - s10.run("MATCH p = (c:Computer {name:{name}})-[r:MemberOf*1..]->(g:Group) WHERE NOT g.domain = c.domain RETURN COUNT(DISTINCT(g))", {name:payload}) - .then(function(result){ - this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}) - s10.close() - }.bind(this)) + s10.run("MATCH p = (c:Computer {name:{name}})-[r:MemberOf*1..]->(g:Group) WHERE NOT g.domain = c.domain RETURN COUNT(DISTINCT(g))", {name:payload}) + .then(function(result){ + this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}) + s10.close() + }.bind(this)) - s11.run("MATCH p = (c:Computer {name:{name}})-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'firstdegreeControl':result.records[0]._fields[0].low}) - s11.close() - }.bind(this)) + s11.run("MATCH p = (c:Computer {name:{name}})-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'firstdegreeControl':result.records[0]._fields[0].low}) + s11.close() + }.bind(this)) - s12.run("MATCH p = (c:Computer {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'groupDelegatedControl':result.records[0]._fields[0].low}) - s12.close() - }.bind(this)) + s12.run("MATCH p = (c:Computer {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'groupDelegatedControl':result.records[0]._fields[0].low}) + s12.close() + }.bind(this)) - s13.run("MATCH p = shortestPath((c:Computer {name:{name}})-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'transitiveControl':result.records[0]._fields[0].low}) - s13.close() - }.bind(this)) - - this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13]}) - } + s13.run("MATCH (n) WHERE NOT n.name={name} WITH n MATCH p = shortestPath((c:Computer {name:{name}})-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'transitiveControl':result.records[0]._fields[0].low}) + s13.close() + }.bind(this)) + + this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13]}) + } - render() { - return ( -
-
-

Node Info

-
- Name -
-
- {this.state.label} -
-
- OS -
-
- {this.state.os} -
-
- Allows Unconstrained Delegation -
-
- {this.state.unconstrained} -
-
- Sessions -
-
- (n:User) WITH n,r,m WHERE NOT n.name ENDS WITH '$' RETURN n,r,m", {name: this.state.label}) - }.bind(this)} /> -
-
-

Local Admins

-
- Explicit Admins -
-
- (m:Computer {name:{name}}) RETURN n,r,m",{name: this.state.label}) - }.bind(this)} /> -
-
- Unrolled Admins -
-
- (g:Group)-[r2:AdminTo]->(c:Computer {name:{name}}) RETURN p", - {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Derivative Local Admins -
-
- (m:Computer {name:{name}})) RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
-

Group Memberships

-
- First Degree Group Membership -
-
- (m) RETURN n,r,m",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
- Unrolled Group Membership -
-
- (m:Group) RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
- Foreign Group Membership -
-
- (g:Group) WHERE NOT g.domain = c.domain RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
-

Local Admin Rights

-
- First Degree Local Admin -
-
- (m) RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
- Group Delegated Local Admin -
-
- (g:Group)-[r2:AdminTo]->(m:Computer) RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
- Derivative Local Admin -
-
- (c:Computer)) RETURN p",{name: this.state.label}, this.state.label) - }.bind(this)} /> -
-
-

Outbound Object Control

-
- First Degree Object Control -
-
- (n) RETURN p", {name:this.state.label}) - }.bind(this)} /> -
-
- Group Delegated Object Control -
-
- (g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Transitive Object Control -
-
- (n)) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-
- ); - } + render() { + return ( +
+
+

Node Info

+
+ Name +
+
+ {this.state.label} +
+
+ OS +
+
+ {this.state.os} +
+
+ Allows Unconstrained Delegation +
+
+ {this.state.unconstrained} +
+
+ Sessions +
+
+ (n:User) WITH n,r,m WHERE NOT n.name ENDS WITH '$' RETURN n,r,m", {name: this.state.label}) + }.bind(this)} + /> +
+
+

Local Admins

+
+ Explicit Admins +
+
+ (m:Computer {name:{name}}) RETURN n,r,m",{name: this.state.label}) + }.bind(this)} + /> +
+
+ Unrolled Admins +
+
+ (g:Group)-[r2:AdminTo]->(c:Computer {name:{name}}) RETURN p", + {name: this.state.label}, + this.state.label) + }.bind(this)} + /> +
+
+ Derivative Local Admins +
+
+ (m:Computer {name:{name}})) RETURN p",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+

Group Memberships

+
+ First Degree Group Membership +
+
+ (m) RETURN n,r,m",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+ Unrolled Group Membership +
+
+ (m:Group) RETURN p",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+ Foreign Group Membership +
+
+ (g:Group) WHERE NOT g.domain = c.domain RETURN p",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+

Local Admin Rights

+
+ First Degree Local Admin +
+
+ (m) RETURN p",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+ Group Delegated Local Admin +
+
+ (g:Group)-[r2:AdminTo]->(m:Computer) RETURN p",{name: this.state.label}, this.state.label) + }.bind(this)} + /> +
+
+ Derivative Local Admin +
+
+ (c)) RETURN p",{name: this.state.label}, this.state.label); + }.bind(this)} + /> +
+
+

Outbound Object Control

+
+ First Degree Object Control +
+
+ (n) RETURN p", {name:this.state.label}) + }.bind(this)} + /> +
+
+ Group Delegated Object Control +
+
+ (g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} + ,this.state.label) + }.bind(this)} + /> +
+
+ Transitive Object Control +
+
+ (n)) RETURN p", {name:this.state.label} + ,this.state.label) + }.bind(this)} + /> +
+
+
+ ); + } } ComputerNodeData.propTypes= { - visible : React.PropTypes.bool.isRequired + visible : React.PropTypes.bool.isRequired } diff --git a/src/components/SearchContainer/Tabs/DomainNodeData.jsx b/src/components/SearchContainer/Tabs/DomainNodeData.jsx index 8c28cb9..4a9c386 100644 --- a/src/components/SearchContainer/Tabs/DomainNodeData.jsx +++ b/src/components/SearchContainer/Tabs/DomainNodeData.jsx @@ -1,233 +1,243 @@ import React, { Component } from 'react'; -import NodeALink from './NodeALink.jsx' -import LoadLabel from './LoadLabel.jsx' -import PropTypes from 'prop-types' +import NodeALink from './NodeALink.jsx'; +import LoadLabel from './LoadLabel.jsx'; +import PropTypes from 'prop-types'; export default class DomainNodeData extends Component { - constructor(){ - super(); + constructor(){ + super(); - this.state = { - label: "", - users: -1, - groups: -1, - computers: -1, - foreignGroups: -1, - foreignUsers: -1, - firstDegreeOutboundTrusts: -1, - effectiveOutboundTrusts: -1, - firstDegreeInboundTrusts: -1, - effectiveInboundTrusts: -1, - driversessions: [] - } + this.state = { + label: "", + users: -1, + groups: -1, + computers: -1, + foreignGroups: -1, + foreignUsers: -1, + firstDegreeOutboundTrusts: -1, + effectiveOutboundTrusts: -1, + firstDegreeInboundTrusts: -1, + effectiveInboundTrusts: -1, + driversessions: [] + }; - emitter.on('domainNodeClicked', this.getNodeData.bind(this)); - } + emitter.on('domainNodeClicked', this.getNodeData.bind(this)); + } - getNodeData(payload){ - $.each(this.state.driversessions, function(index, record){ - record.close(); - }) - this.setState({ - label: payload, - users: -1, - groups: -1, - computers: -1, - foreignGroups: -1, - foreignUsers: -1, - firstDegreeOutboundTrusts: -1, - effectiveOutboundTrusts: -1, - firstDegreeInboundTrusts: -1, - effectiveInboundTrusts: -1 - }) + getNodeData(payload){ + $.each(this.state.driversessions, function(index, record){ + record.close(); + }); + this.setState({ + label: payload, + users: -1, + groups: -1, + computers: -1, + foreignGroups: -1, + foreignUsers: -1, + firstDegreeOutboundTrusts: -1, + effectiveOutboundTrusts: -1, + firstDegreeInboundTrusts: -1, + effectiveInboundTrusts: -1 + }); - var s1 = driver.session() - var s2 = driver.session() - var s3 = driver.session() - var s4 = driver.session() - var s5 = driver.session() - var s6 = driver.session() - var s7 = driver.session() - var s8 = driver.session() - var s9 = driver.session() + var s1 = driver.session(); + var s2 = driver.session(); + var s3 = driver.session(); + var s4 = driver.session(); + var s5 = driver.session(); + var s6 = driver.session(); + var s7 = driver.session(); + var s8 = driver.session(); + var s9 = driver.session(); - s1.run("MATCH (a:User) WHERE a.name ENDS WITH ('@' + {name}) RETURN COUNT(a)", {name:payload}) - .then(function(result){ - this.setState({'users':result.records[0]._fields[0].low}) - s1.close() - }.bind(this)) + s1.run("MATCH (a:User) WHERE a.name ENDS WITH ('@' + {name}) RETURN COUNT(a)", {name:payload}) + .then(function(result){ + this.setState({'users':result.records[0]._fields[0].low}); + s1.close(); + }.bind(this)); - s2.run("MATCH (a:Group) WHERE a.name ENDS WITH ('@' + {name}) RETURN COUNT(a)", {name:payload}) - .then(function(result){ - this.setState({'groups':result.records[0]._fields[0].low}) - s2.close() - }.bind(this)) + s2.run("MATCH (a:Group) WHERE a.name ENDS WITH ('@' + {name}) RETURN COUNT(a)", {name:payload}) + .then(function(result){ + this.setState({'groups':result.records[0]._fields[0].low}); + s2.close(); + }.bind(this)); - s3.run("MATCH (n:Computer) WHERE n.name ENDS WITH {name} WITH n WHERE size(split(n.name,'.')) - size(split({name},'.')) = 1 RETURN count(n)", {name:payload}) - .then(function(result){ - this.setState({'computers':result.records[0]._fields[0].low}) - s3.close() - }.bind(this)) + s3.run("MATCH (n:Computer) WHERE n.name ENDS WITH {name} WITH n WHERE size(split(n.name,'.')) - size(split({name},'.')) = 1 RETURN count(n)", {name:payload}) + .then(function(result){ + this.setState({'computers':result.records[0]._fields[0].low}); + s3.close(); + }.bind(this)); - s4.run("MATCH (a:Group) WHERE NOT a.name ENDS WITH ('@' + {name}) WITH a MATCH (b:Group) WHERE b.name ENDS WITH ('@' + {name}) WITH a,b MATCH (a)-[r:MemberOf]->(b) RETURN count(a)", {name:payload}) - .then(function(result){ - this.setState({'foreignGroups':result.records[0]._fields[0].low}) - s4.close() - }.bind(this)) + s4.run("MATCH (a:Group) WHERE NOT a.name ENDS WITH ('@' + {name}) WITH a MATCH (b:Group) WHERE b.name ENDS WITH ('@' + {name}) WITH a,b MATCH (a)-[r:MemberOf]->(b) RETURN count(a)", {name:payload}) + .then(function(result){ + this.setState({'foreignGroups':result.records[0]._fields[0].low}); + s4.close(); + }.bind(this)); - s5.run("MATCH (a:User) WHERE NOT a.name ENDS WITH ('@' + {name}) WITH a MATCH (b:Group) WHERE b.name ENDS WITH ('@' + {name}) WITH a,b MATCH (a)-[r:MemberOf]->(b) RETURN count(a)", {name:payload}) - .then(function(result){ - this.setState({'foreignUsers':result.records[0]._fields[0].low}) - s5.close() - }.bind(this)) + s5.run("MATCH (a:User) WHERE NOT a.name ENDS WITH ('@' + {name}) WITH a MATCH (b:Group) WHERE b.name ENDS WITH ('@' + {name}) WITH a,b MATCH (a)-[r:MemberOf]->(b) RETURN count(a)", {name:payload}) + .then(function(result){ + this.setState({'foreignUsers':result.records[0]._fields[0].low}); + s5.close(); + }.bind(this)); - s6.run("MATCH (a:Domain {name:{name}})<-[r:TrustedBy]-(b:Domain) RETURN count(b)", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeInboundTrusts':result.records[0]._fields[0].low}) - s6.close() - }.bind(this)) + s6.run("MATCH (a:Domain {name:{name}})<-[r:TrustedBy]-(b:Domain) RETURN count(b)", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeInboundTrusts':result.records[0]._fields[0].low}); + s6.close(); + }.bind(this)); - s7.run("MATCH (a:Domain {name:{name}})-[r:TrustedBy]->(b:Domain) RETURN count(b)", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeOutboundTrusts':result.records[0]._fields[0].low}) - s7.close() - }.bind(this)) + s7.run("MATCH (a:Domain {name:{name}})-[r:TrustedBy]->(b:Domain) RETURN count(b)", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeOutboundTrusts':result.records[0]._fields[0].low}); + s7.close(); + }.bind(this)); - s8.run("MATCH p=shortestPath((a:Domain {name:{name}})<-[r:TrustedBy*1..]-(b:Domain)) RETURN count(b)", {name:payload}) - .then(function(result){ - this.setState({'effectiveInboundTrusts':result.records[0]._fields[0].low}) - s8.close() - }.bind(this)) + s8.run("MATCH (b:Domain) WHERE NOT b.name={name} WITH b MATCH p=shortestPath((a:Domain {name:{name}})<-[r:TrustedBy*1..]-(b)) RETURN count(b)", {name:payload}) + .then(function(result){ + this.setState({'effectiveInboundTrusts':result.records[0]._fields[0].low}); + s8.close(); + }.bind(this)); - s9.run("MATCH p=shortestPath((a:Domain {name:{name}})-[r:TrustedBy*1..]->(b:Domain)) RETURN count(b)", {name:payload}) - .then(function(result){ - this.setState({'effectiveOutboundTrusts':result.records[0]._fields[0].low}) - s9.close() - }.bind(this)) - - this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9]}) - } + s9.run("MATCH (b:Domain) WHERE NOT b.name={name} MATCH p=shortestPath((a:Domain {name:{name}})-[r:TrustedBy*1..]->(b)) RETURN count(b)", {name:payload}) + .then(function(result){ + this.setState({'effectiveOutboundTrusts':result.records[0]._fields[0].low}); + s9.close(); + }.bind(this)); + + this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9]}); + } - render() { - return ( -
-
-
- Node -
-
- {this.state.label} -
-
-
- Users -
-
- -
-
- Groups -
-
- -
-
- Computers -
-
- -
-
-
- Foreign Users -
-
- -
-
- Foreign Groups -
-
- -
-
- Foreign Admins -
-
- -
-
-
- Inbound Trusts -
-
- -
-
- Effective Inbound Trusts -
-
- -
-
- Outbound Trusts -
-
- (b:Domain) RETURN a,r,b", {domain: this.state.label}) - }.bind(this)} /> -
-
- Effective Outbound Trusts -
-
- (b:Domain)) RETURN p", {domain: this.state.label}) - }.bind(this)} /> -
-
-
- ); - } + render() { + return ( +
+
+
+ Node +
+
+ {this.state.label} +
+
+
+ Users +
+
+ +
+
+ Groups +
+
+ +
+
+ Computers +
+
+ +
+
+
+ Foreign Users +
+
+ +
+
+ Foreign Groups +
+
+ +
+
+ Foreign Admins +
+
+ +
+
+
+ Inbound Trusts +
+
+ +
+
+ Effective Inbound Trusts +
+
+ +
+
+ Outbound Trusts +
+
+ (b:Domain) RETURN a,r,b", {domain: this.state.label}); + }.bind(this)} + /> +
+
+ Effective Outbound Trusts +
+
+ (b:Domain)) RETURN p", {domain: this.state.label}); + }.bind(this)} + /> +
+
+
+ ); + } } DomainNodeData.propTypes = { - visible : React.PropTypes.bool.isRequired -} \ No newline at end of file + visible : React.PropTypes.bool.isRequired +}; \ No newline at end of file diff --git a/src/components/SearchContainer/Tabs/GroupNodeData.jsx b/src/components/SearchContainer/Tabs/GroupNodeData.jsx index d3d2c72..96168c4 100644 --- a/src/components/SearchContainer/Tabs/GroupNodeData.jsx +++ b/src/components/SearchContainer/Tabs/GroupNodeData.jsx @@ -1,394 +1,410 @@ import React, { Component } from 'react'; -import NodeALink from './NodeALink' -import PropTypes from 'prop-types' +import NodeALink from './NodeALink'; +import PropTypes from 'prop-types'; export default class GroupNodeData extends Component { - constructor(){ - super(); + constructor(){ + super(); - this.state = { - label: "", - directMembers: -1, - unrolledMembers: -1, - directAdminTo: -1, - derivativeAdminTo: -1, - unrolledMemberOf: -1, - sessions: -1, - foreignGroupMembership: -1, - foreignGroupMembers: -1, - firstDegreeGroupMembership: -1, - groupDelegatedAdmin: -1, - firstdegreeControl: -1, - groupDelegatedControl: -1, - transitiveControl: -1, - firstDegreeControllers: -1, - unrolledControllers: -1, - transitiveControllers: -1, - driversessions: [] - } + this.state = { + label: "", + directMembers: -1, + unrolledMembers: -1, + directAdminTo: -1, + derivativeAdminTo: -1, + unrolledMemberOf: -1, + sessions: -1, + foreignGroupMembership: -1, + foreignGroupMembers: -1, + firstDegreeGroupMembership: -1, + groupDelegatedAdmin: -1, + firstdegreeControl: -1, + groupDelegatedControl: -1, + transitiveControl: -1, + firstDegreeControllers: -1, + unrolledControllers: -1, + transitiveControllers: -1, + driversessions: [] + }; - emitter.on('groupNodeClicked', this.getNodeData.bind(this)); - } + emitter.on('groupNodeClicked', this.getNodeData.bind(this)); + } - getNodeData(payload){ - $.each(this.state.driversessions, function(index, record){ - record.close(); - }) + getNodeData(payload){ + $.each(this.state.driversessions, function(index, record){ + record.close(); + }); - this.setState({ - label: payload, - directMembers: -1, - unrolledMembers: -1, - directAdminTo: -1, - derivativeAdminTo: -1, - unrolledMemberOf: -1, - sessions: -1, - foreignGroupMembership: -1, - foreignGroupMembers: -1, - firstDegreeGroupMembership: -1, - groupDelegatedAdmin: -1, - firstdegreeControl: -1, - groupDelegatedControl: -1, - transitiveControl: -1, - firstDegreeControllers: -1, - unrolledControllers: -1, - transitiveControllers: -1 - }) + this.setState({ + label: payload, + directMembers: -1, + unrolledMembers: -1, + directAdminTo: -1, + derivativeAdminTo: -1, + unrolledMemberOf: -1, + sessions: -1, + foreignGroupMembership: -1, + foreignGroupMembers: -1, + firstDegreeGroupMembership: -1, + groupDelegatedAdmin: -1, + firstdegreeControl: -1, + groupDelegatedControl: -1, + transitiveControl: -1, + firstDegreeControllers: -1, + unrolledControllers: -1, + transitiveControllers: -1 + }); - var domain = '@' + payload.split('@').last() - var s1 = driver.session() - var s2 = driver.session() - var s3 = driver.session() - var s4 = driver.session() - var s5 = driver.session() - var s6 = driver.session() - var s7 = driver.session() - var s8 = driver.session() - var s9 = driver.session() - var s10 = driver.session() - var s11 = driver.session() - var s12 = driver.session() - var s13 = driver.session() - var s14 = driver.session() - var s15 = driver.session() - var s16 = driver.session() + var domain = '@' + payload.split('@').last(); + var s1 = driver.session(); + var s2 = driver.session(); + var s3 = driver.session(); + var s4 = driver.session(); + var s5 = driver.session(); + var s6 = driver.session(); + var s7 = driver.session(); + var s8 = driver.session(); + var s9 = driver.session(); + var s10 = driver.session(); + var s11 = driver.session(); + var s12 = driver.session(); + var s13 = driver.session(); + var s14 = driver.session(); + var s15 = driver.session(); + var s16 = driver.session(); - s1.run("MATCH (a)-[b:MemberOf]->(c:Group {name:{name}}) RETURN count(a)", {name:payload}) - .then(function(result){ - this.setState({'directMembers':result.records[0]._fields[0].low}) - s1.close() - }.bind(this)) + s1.run("MATCH (a)-[b:MemberOf]->(c:Group {name:{name}}) RETURN count(a)", {name:payload}) + .then(function(result){ + this.setState({'directMembers':result.records[0]._fields[0].low}); + s1.close(); + }.bind(this)); - s2.run("MATCH p = (n)-[r:MemberOf*1..]->(g:Group {name:{name}}) RETURN COUNT(n)", {name:payload}) - .then(function(result){ - this.setState({'unrolledMembers':result.records[0]._fields[0].low}) - s2.close() - }.bind(this)) + s2.run("MATCH p = (n)-[r:MemberOf*1..]->(g:Group {name:{name}}) RETURN COUNT(n)", {name:payload}) + .then(function(result){ + this.setState({'unrolledMembers':result.records[0]._fields[0].low}); + s2.close(); + }.bind(this)); - s3.run("MATCH (n:Group {name:{name}})-[r:AdminTo]->(m:Computer) RETURN count(distinct(m))", {name:payload}) - .then(function(result){ - this.setState({'directAdminTo':result.records[0]._fields[0].low}) - s3.close() - }.bind(this)) + s3.run("MATCH (n:Group {name:{name}})-[r:AdminTo]->(m:Computer) RETURN count(distinct(m))", {name:payload}) + .then(function(result){ + this.setState({'directAdminTo':result.records[0]._fields[0].low}); + s3.close(); + }.bind(this)); - s4.run("MATCH p = shortestPath((g:Group {name:{name}})-[r:MemberOf|AdminTo|HasSession*1..]->(c:Computer)) RETURN COUNT(DISTINCT(c))", {name:payload}) - .then(function(result){ - this.setState({'derivativeAdminTo':result.records[0]._fields[0].low}) - s4.close() - }.bind(this)) + s4.run("MATCH (c:Computer) WHERE NOT c.name={name} WITH c MATCH p = shortestPath((g:Group {name:{name}})-[r:MemberOf|AdminTo|HasSession*1..]->(c)) RETURN COUNT(DISTINCT(c))", {name:payload}) + .then(function(result){ + this.setState({'derivativeAdminTo':result.records[0]._fields[0].low}); + s4.close(); + }.bind(this)); - s5.run("MATCH p = (g1:Group {name:{name}})-[r:MemberOf*1..]->(g2:Group) RETURN COUNT(DISTINCT(g2))", {name:payload}) - .then(function(result){ - this.setState({'unrolledMemberOf':result.records[0]._fields[0].low}) - s5.close() - }.bind(this)) + s5.run("MATCH p = (g1:Group {name:{name}})-[r:MemberOf*1..]->(g2:Group) RETURN COUNT(DISTINCT(g2))", {name:payload}) + .then(function(result){ + this.setState({'unrolledMemberOf':result.records[0]._fields[0].low}); + s5.close(); + }.bind(this)); - s6.run("MATCH p = (c:Computer)-[r1:HasSession]->(u:User)-[r2:MemberOf*1..]->(g:Group {name: {name}}) RETURN COUNT(r1)", {name:payload}) - .then(function(result){ - this.setState({'sessions':result.records[0]._fields[0].low}) - s6.close() - }.bind(this)) + s6.run("MATCH p = (c:Computer)-[r1:HasSession]->(u:User)-[r2:MemberOf*1..]->(g:Group {name: {name}}) RETURN COUNT(r1)", {name:payload}) + .then(function(result){ + this.setState({'sessions':result.records[0]._fields[0].low}); + s6.close(); + }.bind(this)); - s7.run("MATCH (n:Group) WHERE NOT n.name ENDS WITH {domain} WITH n MATCH (m:Group {name:{name}}) MATCH (m)-[r:MemberOf]->(n) RETURN count(n)", {name:payload, domain:domain}) - .then(function(result){ - this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}) - s7.close() - }.bind(this)) + s7.run("MATCH (n:Group) WHERE NOT n.name ENDS WITH {domain} WITH n MATCH (m:Group {name:{name}}) MATCH (m)-[r:MemberOf]->(n) RETURN count(n)", {name:payload, domain:domain}) + .then(function(result){ + this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}); + s7.close(); + }.bind(this)); - s8.run("MATCH p = (n)-[r:MemberOf*1..]->(g:Group {name:{name}}) WHERE NOT g.domain = n.domain RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'foreignGroupMembers':result.records[0]._fields[0].low}) - s8.close() - }.bind(this)) + s8.run("MATCH p = (n)-[r:MemberOf*1..]->(g:Group {name:{name}}) WHERE NOT g.domain = n.domain RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'foreignGroupMembers':result.records[0]._fields[0].low}); + s8.close(); + }.bind(this)); - s9.run("MATCH p = (g1:Group {name:{name}})-[r:MemberOf]->(g2:Group) RETURN COUNT(DISTINCT(g2))", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}) - s9.close() - }.bind(this)) + s9.run("MATCH p = (g1:Group {name:{name}})-[r:MemberOf]->(g2:Group) RETURN COUNT(DISTINCT(g2))", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}); + s9.close(); + }.bind(this)); - s10.run("MATCH p = (g1:Group {name:{name}})-[r1:MemberOf*1..]->(g2:Group)-[r2:AdminTo]->(c:Computer) RETURN COUNT(DISTINCT(c))", {name:payload}) - .then(function(result){ - this.setState({'groupDelegatedAdmin':result.records[0]._fields[0].low}) - s10.close() - }.bind(this)) + s10.run("MATCH p = (g1:Group {name:{name}})-[r1:MemberOf*1..]->(g2:Group)-[r2:AdminTo]->(c:Computer) RETURN COUNT(DISTINCT(c))", {name:payload}) + .then(function(result){ + this.setState({'groupDelegatedAdmin':result.records[0]._fields[0].low}); + s10.close(); + }.bind(this)); - s11.run("MATCH p = (g:Group {name:{name}})-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'firstdegreeControl':result.records[0]._fields[0].low}) - s11.close() - }.bind(this)) + s11.run("MATCH p = (g:Group {name:{name}})-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'firstdegreeControl':result.records[0]._fields[0].low}); + s11.close(); + }.bind(this)); - s12.run("MATCH p = (g1:Group {name:{name}})-[r1:MemberOf*1..]->(g2:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'groupDelegatedControl':result.records[0]._fields[0].low}) - s12.close() - }.bind(this)) + s12.run("MATCH p = (g1:Group {name:{name}})-[r1:MemberOf*1..]->(g2:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'groupDelegatedControl':result.records[0]._fields[0].low}); + s12.close(); + }.bind(this)); - s13.run("MATCH p = shortestPath((g:Group {name:{name}})-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'transitiveControl':result.records[0]._fields[0].low}) - s13.close() - }.bind(this)) + s13.run("MATCH (n) WHERE NOT n.name={name} WITH n MATCH p = shortestPath((g:Group {name:{name}})-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'transitiveControl':result.records[0]._fields[0].low}); + s13.close(); + }.bind(this)); - s14.run("MATCH p = (n)-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g:Group {name:{name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeControllers':result.records[0]._fields[0].low}) - s14.close() - }.bind(this)) + s14.run("MATCH p = (n)-[r:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g:Group {name:{name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeControllers':result.records[0]._fields[0].low}); + s14.close(); + }.bind(this)); - s15.run("MATCH p = (n1)-[r:MemberOf*1..]->(g1:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g2:Group {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = g2.name) AND NOT n1.name = g2.name RETURN COUNT(DISTINCT(n1))", {name:payload}) - .then(function(result){ - this.setState({'unrolledControllers':result.records[0]._fields[0].low}) - s15.close() - }.bind(this)) + s15.run("MATCH p = (n1)-[r:MemberOf*1..]->(g1:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g2:Group {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = g2.name) AND NOT n1.name = g2.name RETURN COUNT(DISTINCT(n1))", {name:payload}) + .then(function(result){ + this.setState({'unrolledControllers':result.records[0]._fields[0].low}); + s15.close(); + }.bind(this)); - s16.run("MATCH p = shortestPath((n)-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(g:Group {name:{name}})) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'transitiveControllers':result.records[0]._fields[0].low}) - s16.close() - }.bind(this)) - - this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16]}) - } + s16.run("MATCH (n) WHERE NOT n.name={name} WITH n MATCH p = shortestPath((n)-[r:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(g:Group {name:{name}})) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'transitiveControllers':result.records[0]._fields[0].low}); + s16.close(); + }.bind(this)); + + this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16]}); + } - render() { - var domain = '@' + this.state.label.split('@') - return ( -
-
-

Node Info

-
- Name -
-
- {this.state.label} -
-
- Sessions -
-
- (u:User)-[r2:MemberOf*1..]->(g:Group {name: {name}}) RETURN p", {name: this.state.label}, - "",this.state.label) - }.bind(this)} /> -
-
-

Group Members

-
- Direct Members -
-
- (m:Group {name:{name}}) RETURN n,r,m", {name: this.state.label}) - }.bind(this)} /> -
-
- Unrolled Members -
-
- (g:Group {name:{name}}) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Foreign Members -
-
- (g:Group {name:{name}}) WHERE NOT g.domain = n.domain RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
-

Group Membership

-
- First Degree Group Membership -
-
- (g2:Group) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Unrolled Member Of -
-
- (g2:Group) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Foreign Group Membership -
-
- (n) RETURN m,r,n", {name: this.state.label, domain: domain}) - }.bind(this)} /> -
-
-

Local Admin Rights

-
- First Degree Local Admin -
-
- (c:Computer) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Group Delegated Local Admin Rights -
-
- (g2:Group)-[r2:AdminTo]->(c:Computer) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Derivative Local Admin Rights -
-
- (c:Computer)) RETURN p", {name: this.state.label}, - this.state.label) - }.bind(this)} /> -
-
-

Outbound Object Control

-
- First Degree Object Control -
-
- (n) RETURN p", {name:this.state.label}) - }.bind(this)} /> -
-
- Group Delegated Object Control -
-
- (g2:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Transitive Object Control -
-
- (n)) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-

Inbound Object Control

-
- Explicit Object Controllers -
-
- (g:Group {name: {name}}) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Unrolled Object Controllers -
-
- (g1:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g2:Group {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = g2.name) AND NOT n1.name = g2.name RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Transitive Object Controllers -
-
- (g:Group {name: {name}})) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-
- ); - } + render() { + var domain = '@' + this.state.label.split('@'); + return ( +
+
+

Node Info

+
+ Name +
+
+ {this.state.label} +
+
+ Sessions +
+
+ (u:User)-[r2:MemberOf*1..]->(g:Group {name: {name}}) RETURN p", {name: this.state.label}, + "",this.state.label); + }.bind(this)} + /> +
+
+

Group Members

+
+ Direct Members +
+
+ (m:Group {name:{name}}) RETURN n,r,m", {name: this.state.label}); + }.bind(this)} + /> +
+
+ Unrolled Members +
+
+ (g:Group {name:{name}}) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Foreign Members +
+
+ (g:Group {name:{name}}) WHERE NOT g.domain = n.domain RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+

Group Membership

+
+ First Degree Group Membership +
+
+ (g2:Group) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Unrolled Member Of +
+
+ (g2:Group) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Foreign Group Membership +
+
+ (n) RETURN m,r,n", {name: this.state.label, domain: domain}); + }.bind(this)} + /> +
+
+

Local Admin Rights

+
+ First Degree Local Admin +
+
+ (c:Computer) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Group Delegated Local Admin Rights +
+
+ (g2:Group)-[r2:AdminTo]->(c:Computer) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Derivative Local Admin Rights +
+
+ (c)) RETURN p", {name: this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+

Outbound Object Control

+
+ First Degree Object Control +
+
+ (n) RETURN p", {name:this.state.label}); + }.bind(this)} + /> +
+
+ Group Delegated Object Control +
+
+ (g2:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Transitive Object Control +
+
+ (n)) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+

Inbound Object Control

+
+ Explicit Object Controllers +
+
+ (g:Group {name: {name}}) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Unrolled Object Controllers +
+
+ (g1:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(g2:Group {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = g2.name) AND NOT n1.name = g2.name RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Transitive Object Controllers +
+
+ (g:Group {name: {name}})) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+
+ ); + } } GroupNodeData.propTypes = { - visible : React.PropTypes.bool.isRequired -} \ No newline at end of file + visible : React.PropTypes.bool.isRequired +}; \ No newline at end of file diff --git a/src/components/SearchContainer/Tabs/UserNodeData.jsx b/src/components/SearchContainer/Tabs/UserNodeData.jsx index e4e6e0b..087ec27 100644 --- a/src/components/SearchContainer/Tabs/UserNodeData.jsx +++ b/src/components/SearchContainer/Tabs/UserNodeData.jsx @@ -1,363 +1,376 @@ import React, { Component } from 'react'; -import NodeALink from './NodeALink' -import PropTypes from 'prop-types' +import NodeALink from './NodeALink'; +import PropTypes from 'prop-types'; export default class UserNodeData extends Component { - constructor(){ - super(); + constructor(){ + super(); - this.state = { - label: "", - samAccountName: "None", - displayName: "None", - pwdLastChanged: "None", - firstDegreeGroupMembership: -1, - unrolledGroupMembership: -1, - foreignGroupMembership: -1, - firstDegreeLocalAdmin: -1, - groupDelegatedLocalAdmin: -1, - derivativeLocalAdmin: -1, - sessions: -1, - firstdegreeControllers: -1, - unrolledControllers: -1, - transitiveControllers: -1, - firstdegreeControl: -1, - unrolledControl: -1, - transitiveControl: -1, - driversessions : [] - } + this.state = { + label: "", + samAccountName: "None", + displayName: "None", + pwdLastChanged: "None", + firstDegreeGroupMembership: -1, + unrolledGroupMembership: -1, + foreignGroupMembership: -1, + firstDegreeLocalAdmin: -1, + groupDelegatedLocalAdmin: -1, + derivativeLocalAdmin: -1, + sessions: -1, + firstdegreeControllers: -1, + unrolledControllers: -1, + transitiveControllers: -1, + firstdegreeControl: -1, + unrolledControl: -1, + transitiveControl: -1, + driversessions : [] + }; - emitter.on('userNodeClicked', this.getNodeData.bind(this)); - } + emitter.on('userNodeClicked', this.getNodeData.bind(this)); + } - getNodeData(payload){ - $.each(this.state.driversessions,function(index, record){ - record.close(); - }) + getNodeData(payload){ + $.each(this.state.driversessions,function(index, record){ + record.close(); + }); - this.setState({ - label: payload, - samAccountName: "None", - displayName: "None", - pwdLastChanged: "None", - firstDegreeGroupMembership: -1, - unrolledGroupMembership: -1, - foreignGroupMembership: -1, - firstDegreeLocalAdmin: -1, - groupDelegatedLocalAdmin: -1, - derivativeLocalAdmin: -1, - sessions: -1, - firstdegreeControllers: -1, - unrolledControllers: -1, - transitiveControllers: -1, - firstdegreeControl: -1, - unrolledControl: -1, - transitiveControl: -1 - }) + this.setState({ + label: payload, + samAccountName: "None", + displayName: "None", + pwdLastChanged: "None", + firstDegreeGroupMembership: -1, + unrolledGroupMembership: -1, + foreignGroupMembership: -1, + firstDegreeLocalAdmin: -1, + groupDelegatedLocalAdmin: -1, + derivativeLocalAdmin: -1, + sessions: -1, + firstdegreeControllers: -1, + unrolledControllers: -1, + transitiveControllers: -1, + firstdegreeControl: -1, + unrolledControl: -1, + transitiveControl: -1 + }); - var domain = '@' + payload.split('@').last() - - var s1 = driver.session() - var s2 = driver.session() - var s3 = driver.session() - var s4 = driver.session() - var s5 = driver.session() - var s6 = driver.session() - var s7 = driver.session() - var s8 = driver.session() - var s9 = driver.session() - var s10 = driver.session() - var s11 = driver.session() - var s12 = driver.session() - var s13 = driver.session() + var domain = '@' + payload.split('@').last(); + + var s1 = driver.session(); + var s2 = driver.session(); + var s3 = driver.session(); + var s4 = driver.session(); + var s5 = driver.session(); + var s6 = driver.session(); + var s7 = driver.session(); + var s8 = driver.session(); + var s9 = driver.session(); + var s10 = driver.session(); + var s11 = driver.session(); + var s12 = driver.session(); + var s13 = driver.session(); - s1.run("MATCH (n:Group) WHERE NOT n.name ENDS WITH {domain} WITH n MATCH (m:User {name:{name}}) MATCH (m)-[r:MemberOf*1..]->(n) RETURN count(n)", {name:payload, domain: domain}) - .then(function(result){ - this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}) - s1.close() - }.bind(this)) + s1.run("MATCH (n:Group) WHERE NOT n.name ENDS WITH {domain} WITH n MATCH (m:User {name:{name}}) MATCH (m)-[r:MemberOf*1..]->(n) RETURN count(n)", {name:payload, domain: domain}) + .then(function(result){ + this.setState({'foreignGroupMembership':result.records[0]._fields[0].low}); + s1.close(); + }.bind(this)); - s2.run("MATCH (n:User {name:{name}}), (m:Group), p=(n)-[:MemberOf]->(m) RETURN count(m)", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}) - s2.close() - }.bind(this)) + s2.run("MATCH (n:User {name:{name}}), (m:Group), p=(n)-[:MemberOf]->(m) RETURN count(m)", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeGroupMembership':result.records[0]._fields[0].low}); + s2.close(); + }.bind(this)); - s3.run("MATCH p = (n:User {name:{name}})-[r:MemberOf*1..]->(g:Group) RETURN COUNT(DISTINCT(g))", {name:payload}) - .then(function(result){ - this.setState({'unrolledGroupMembership':result.records[0]._fields[0].low}) - s3.close() - }.bind(this)) + s3.run("MATCH p = (n:User {name:{name}})-[r:MemberOf*1..]->(g:Group) RETURN COUNT(DISTINCT(g))", {name:payload}) + .then(function(result){ + this.setState({'unrolledGroupMembership':result.records[0]._fields[0].low}); + s3.close(); + }.bind(this)); - s4.run("MATCH p = (n:User {name:{name}})-[r:AdminTo]->(c:Computer) RETURN COUNT(DISTINCT(c))", {name:payload}) - .then(function(result){ - this.setState({'firstDegreeLocalAdmin':result.records[0]._fields[0].low}) - s4.close() - }.bind(this)) + s4.run("MATCH p = (n:User {name:{name}})-[r:AdminTo]->(c:Computer) RETURN COUNT(DISTINCT(c))", {name:payload}) + .then(function(result){ + this.setState({'firstDegreeLocalAdmin':result.records[0]._fields[0].low}); + s4.close(); + }.bind(this)); - s5.run("MATCH p=(n:User {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AdminTo]->(c:Computer) RETURN count(distinct(c))", {name:payload}) - .then(function(result){ - this.setState({'groupDelegatedLocalAdmin':result.records[0]._fields[0].low}) - s5.close() - }.bind(this)) + s5.run("MATCH p=(n:User {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AdminTo]->(c:Computer) RETURN count(distinct(c))", {name:payload}) + .then(function(result){ + this.setState({'groupDelegatedLocalAdmin':result.records[0]._fields[0].low}); + s5.close(); + }.bind(this)); - s6.run("MATCH p = shortestPath((n:User {name:{name}})-[r:HasSession|AdminTo|MemberOf*1..]->(c:Computer)) RETURN COUNT(c)", {name:payload}) - .then(function(result){ - this.setState({'derivativeLocalAdmin':result.records[0]._fields[0].low}) - s6.close() - }.bind(this)) + s6.run("MATCH (c:Computer) WHERE NOT c.name={name} WITH c MATCH p = shortestPath((n:User {name:{name}})-[r:HasSession|AdminTo|MemberOf*1..]->(c)) RETURN COUNT(c)", {name:payload}) + .then(function(result){ + this.setState({'derivativeLocalAdmin':result.records[0]._fields[0].low}); + s6.close(); + }.bind(this)); - s7.run("MATCH p = (n:Computer)-[r:HasSession]->(m:User {name:{name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'sessions':result.records[0]._fields[0].low}) - s7.close() - }.bind(this)) + s7.run("MATCH p = (n:Computer)-[r:HasSession]->(m:User {name:{name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'sessions':result.records[0]._fields[0].low}); + s7.close(); + }.bind(this)); - s8.run("MATCH p = (n)-[r:AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u1:User {name: {name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'firstdegreeControllers':result.records[0]._fields[0].low}) - s8.close() - }.bind(this)) + s8.run("MATCH p = (n)-[r:AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u1:User {name: {name}}) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'firstdegreeControllers':result.records[0]._fields[0].low}); + s8.close(); + }.bind(this)); - s9.run("MATCH p = (n1)-[r:MemberOf*1..]->(g:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u:User {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = u.name) AND NOT n1.name = u.name RETURN COUNT(DISTINCT(n1))", {name:payload}) - .then(function(result){ - this.setState({'unrolledControllers':result.records[0]._fields[0].low}) - s9.close() - }.bind(this)) + s9.run("MATCH p = (n1)-[r:MemberOf*1..]->(g:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u:User {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = u.name) AND NOT n1.name = u.name RETURN COUNT(DISTINCT(n1))", {name:payload}) + .then(function(result){ + this.setState({'unrolledControllers':result.records[0]._fields[0].low}); + s9.close(); + }.bind(this)); - s10.run("MATCH p = shortestPath((n1)-[r1:MemberOf|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(u1:User {name: {name}})) RETURN COUNT(DISTINCT(n1))", {name:payload}) - .then(function(result){ - this.setState({'transitiveControllers':result.records[0]._fields[0].low}) - s10.close() - }.bind(this)) + s10.run("MATCH (n1) WHERE NOT n1.name={name} WITH n1 MATCH p = shortestPath((n1)-[r1:MemberOf|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(u1:User {name: {name}})) RETURN COUNT(DISTINCT(n1))", {name:payload}) + .then(function(result){ + this.setState({'transitiveControllers':result.records[0]._fields[0].low}); + s10.close(); + }.bind(this)); - s11.run("MATCH p = (u:User {name:{name}})-[r1:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'firstdegreeControl':result.records[0]._fields[0].low}) - s11.close() - }.bind(this)) + s11.run("MATCH p = (u:User {name:{name}})-[r1:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'firstdegreeControl':result.records[0]._fields[0].low}); + s11.close(); + }.bind(this)); - s12.run("MATCH p = (u:User {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'unrolledControl':result.records[0]._fields[0].low}) - s12.close() - }.bind(this)) + s12.run("MATCH p = (u:User {name:{name}})-[r1:MemberOf*1..]->(g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'unrolledControl':result.records[0]._fields[0].low}); + s12.close(); + }.bind(this)); - s13.run("MATCH p = shortestPath((u:User {name:{name}})-[r1:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) - .then(function(result){ - this.setState({'transitiveControl':result.records[0]._fields[0].low}) - s13.close() - }.bind(this)) - - this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13]}) - } + s13.run("MATCH (n) WHERE NOT n.name={name} WITH n MATCH p = shortestPath((u:User {name:{name}})-[r1:MemberOf|AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner*1..]->(n)) RETURN COUNT(DISTINCT(n))", {name:payload}) + .then(function(result){ + this.setState({'transitiveControl':result.records[0]._fields[0].low}); + s13.close(); + }.bind(this)); + + this.setState({'driversessions': [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13]}); + } - render() { - var domain = '@' + this.state.label.split('@').last() - return ( -
-
+ render() { + var domain = '@' + this.state.label.split('@').last(); + return ( +
+

Node Info

-
- Name -
-
- {this.state.label} -
-
- SAMAccountName -
-
- {this.state.samAccountName} -
-
- Display Name -
-
- {this.state.displayName} -
-
- Password Last Changed -
-
- {this.state.pwdLastChanged} -
-
- Sessions -
-
- (m:User {name:{name}}) RETURN n,r,m", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-

Group Membership

-
- First Degree Group Memberships -
-
- (g:Group) RETURN p", {name:this.state.label} - ) - }.bind(this)} /> -
-
- Unrolled Group Memberships -
-
- (g:Group) RETURN p", {name:this.state.label}, - this.state.label) - }.bind(this)} /> -
-
- Foreign Group Membership -
-
- (n) RETURN p", {name: this.state.label, domain: domain}) - }.bind(this)} /> -
-
-

- Local Admin Rights -

-
- First Degree Local Admin -
-
- (c:Computer) RETURN p", {name:this.state.label}) - }.bind(this)} /> -
-
- Group Delegated Local Admin Rights -
-
- (g:Group)-[r2:AdminTo]->(c:Computer) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Derivative Local Admin Rights -
-
- (c:Computer)) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-

- Outbound Object Control -

-
- First Degree Object Control -
-
- (n) RETURN p", {name:this.state.label}) - }.bind(this)} /> -
-
- Group Delegated Object Control -
-
- (g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Transitive Object Control -
-
- (n)) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-

Inbound Object Control

-
- Explicit Object Controllers -
-
- (u1:User {name: {name}}) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Unrolled Object Controllers -
-
- (g:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u:User {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = u.name) AND NOT n1.name = u.name RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
- Transitive Object Controllers -
-
- (u1:User {name: {name}})) RETURN p", {name:this.state.label} - ,this.state.label) - }.bind(this)} /> -
-
-
- ); - } +
+ Name +
+
+ {this.state.label} +
+
+ SAMAccountName +
+
+ {this.state.samAccountName} +
+
+ Display Name +
+
+ {this.state.displayName} +
+
+ Password Last Changed +
+
+ {this.state.pwdLastChanged} +
+
+ Sessions +
+
+ (m:User {name:{name}}) RETURN n,r,m", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+

Group Membership

+
+ First Degree Group Memberships +
+
+ (g:Group) RETURN p", {name:this.state.label} + ); + }.bind(this)} + /> +
+
+ Unrolled Group Memberships +
+
+ (g:Group) RETURN p", {name:this.state.label}, + this.state.label); + }.bind(this)} + /> +
+
+ Foreign Group Membership +
+
+ (n) RETURN p", {name: this.state.label, domain: domain}); + }.bind(this)} + /> +
+
+

+ Local Admin Rights +

+
+ First Degree Local Admin +
+
+ (c:Computer) RETURN p", {name:this.state.label}); + }.bind(this)} + /> +
+
+ Group Delegated Local Admin Rights +
+
+ (g:Group)-[r2:AdminTo]->(c:Computer) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Derivative Local Admin Rights +
+
+ (c)) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+

+ Outbound Object Control +

+
+ First Degree Object Control +
+
+ (n) RETURN p", {name:this.state.label}); + }.bind(this)} + /> +
+
+ Group Delegated Object Control +
+
+ (g:Group)-[r2:AddMembers|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(n) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Transitive Object Control +
+
+ (n)) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+

Inbound Object Control

+
+ Explicit Object Controllers +
+
+ (u1:User {name: {name}}) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Unrolled Object Controllers +
+
+ (g:Group)-[r1:AddMembers|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner]->(u:User {name: {name}}) WITH LENGTH(p) as pathLength, p, n1 WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.name = u.name) AND NOT n1.name = u.name RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+ Transitive Object Controllers +
+
+ (u1:User {name: {name}})) RETURN p", {name:this.state.label} + ,this.state.label); + }.bind(this)} + /> +
+
+
+ ); + } } UserNodeData.propTypes = { - visible : React.PropTypes.bool.isRequired -} \ No newline at end of file + visible : React.PropTypes.bool.isRequired +}; \ No newline at end of file