Skip to content

Commit

Permalink
Merge pull request #160 from BloodHoundAD/1.5
Browse files Browse the repository at this point in the history
Update to 1.5
  • Loading branch information
rvazarkar authored Mar 28, 2018
2 parents 1455854 + 352847a commit 1ee97da
Show file tree
Hide file tree
Showing 25 changed files with 1,100 additions and 373 deletions.
Binary file added Ingestors/DebugBuilds/Sharphound_Debug.exe
Binary file not shown.
Binary file added Ingestors/DebugBuilds/Sharphound_Debug.pdb
Binary file not shown.
Binary file modified Ingestors/SharpHound.exe
Binary file not shown.
10 changes: 7 additions & 3 deletions Ingestors/SharpHound.ps1

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bloodhound",
"version": "1.4.1",
"version": "1.5.0",
"description": "Graph Theory for Active Directory",
"keywords": [
"Graph",
Expand Down
28 changes: 24 additions & 4 deletions src/components/Float/QueryNodeSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ export default class QueryNodeSelect extends Component {
session.run(query.query, query.props)
.then(function (results) {
var y = $.map(results.records, function (x) {
return x._fields[0];
let a = x.keys.map(function (e, i) {
let obj = {};
obj[e.split('.')[1]] = x._fields[i];
return obj;
});
let b = {};
$.each(a, function (index, o) {
Object.assign(b, o);
});

return b;
});
this.setState({ data: y });
session.close();
Expand All @@ -51,7 +61,7 @@ export default class QueryNodeSelect extends Component {
var query = appStore.prebuiltQuery.shift();
if (query.final) {
let start = typeof query.startNode !== 'undefined' ? query.startNode.format(querydata) : "";
let end = typeof query.endNode !== 'undefined' ? query.startNode.format(querydata) : "";
let end = typeof query.endNode !== 'undefined' ? query.endNode.format(querydata) : "";
emitter.emit('query',
query.query,
{"result":querydata},
Expand All @@ -68,7 +78,17 @@ export default class QueryNodeSelect extends Component {
session.run(query.query, {"result":querydata})
.then(function (results) {
var y = $.map(results.records, function (x) {
return x._fields[0];
let a = x.keys.map(function(e, i){
let obj = {};
obj[e.split('.')[1]] = x._fields[i];
return obj;
});
let b = {};
$.each(a, function(index, o){
Object.assign(b, o);
});

return b;
});
if (y.length === 0){
emitter.emit('showAlert', "No data returned from query");
Expand Down Expand Up @@ -110,7 +130,7 @@ export default class QueryNodeSelect extends Component {
<ListGroup ref="list">
{
this.state.data.map(function(key){
var x = <QueryNodeSelectItem key={key} label={key} />;
var x = <QueryNodeSelectItem key={key.name} label={key.name} extraProps={key} />;
return x;
}.bind(this))
}
Expand Down
42 changes: 40 additions & 2 deletions src/components/Float/QueryNodeSelectItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,51 @@ import React, { Component } from 'react';
import { ListGroupItem } from 'react-bootstrap'

export default class QueryNodeSelectItem extends Component {
convertToDisplayProp() {
var str = "";
$.each(Object.keys(this.props.extraProps), function(index, prop){
if (prop === "name"){
return;
}

let obj = this.props.extraProps[prop];
var type = typeof obj;
let val = null;
if (type === 'undefined') {
val = null;
} else if (obj.hasOwnProperty('low')) {
var t = obj.low;
if (t === 0) {
val = "Never";
} else {
val = new Date(obj.low * 1000).toUTCString();
}
} else if (type === 'boolean') {
val = obj.toString().toTitleCase();
} else if (obj === "") {
val = null;
} else {
val = obj;
}
if (val !== null){
str += prop + ": " + val + "\n";
}

}.bind(this));
return str;
}

render() {
let c = function () {
emitter.emit("prebuiltQueryStep", this.props.label);
}.bind(this);
let str = this.convertToDisplayProp();
if (this.props.extraProps.hasOwnProperty("PwdLastSet")){
var pwd = new Date(this.props.extraProps.PwdLastSet.low * 1000).toUTCString();
}
return (
<ListGroupItem href="#" onClick={c}>
{this.props.label}
<ListGroupItem className="queryNodeItemPreWrap" href="#" onClick={c} header={this.props.label}>
{str}
</ListGroupItem>
);
}
Expand Down
28 changes: 18 additions & 10 deletions src/components/Graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export default class GraphContainer extends Component {
s4.run("CREATE CONSTRAINT ON (c:Domain) ASSERT c.name IS UNIQUE")
.then(function(){
s4.close();
s5.run("CREATE CONSTRAINT on (c:Ou) ASSERT c.name IS UNIQUE")
s5.run("CREATE CONSTRAINT on (c:OU) ASSERT c.guid IS UNIQUE")
.then(function() {
s5.close();
s6.run("CREATE CONSTRAINT on (c:Gpo) ASSERT c.name is UNIQUE")
s6.run("CREATE CONSTRAINT on (c:GPO) ASSERT c.guid is UNIQUE")
.then(function(){
s6.close();
})
Expand Down Expand Up @@ -128,6 +128,7 @@ export default class GraphContainer extends Component {
this.doQueryNative({
statement: 'MATCH (n:Group) WHERE n.name =~ "(?i).*DOMAIN ADMINS.*" WITH n MATCH (n)<-[r:MemberOf*1..]-(m) RETURN n,r,m',
//statement: 'MATCH (n)-[r]->(m) RETURN n,r,m',
//statement: 'MATCH p=(n:Domain)-[r]-(m:Domain) RETURN p',
allowCollapse: false,
props: {}
});
Expand Down Expand Up @@ -294,7 +295,7 @@ export default class GraphContainer extends Component {

$.each(this.state.sigmaInstance.graph.edges(), function(index, edge){
if (edge.hasOwnProperty('enforced')){
if (edge.enforced === 'False'){
if (edge.enforced === false){
edge.type = 'dashed';
}
}
Expand All @@ -310,7 +311,7 @@ export default class GraphContainer extends Component {

$.each(this.state.sigmaInstance.graph.adjacentEdges(node.id), function(index, edge){
if (targets.includes(edge.target)){
edge.type = 'dashed';
edge.type = 'dotted';
}
});
}
Expand Down Expand Up @@ -553,9 +554,16 @@ export default class GraphContainer extends Component {
y: Math.random()
};

if (data.hasOwnProperty('properties') && data.properties.hasOwnProperty('blocksInheritance')){
node.blocksInheritance = data.properties.blocksInheritance;
if (data.hasOwnProperty('properties')){
if (data.properties.hasOwnProperty('blocksInheritance')) {
node.blocksInheritance = data.properties.blocksInheritance;
}

if (data.properties.hasOwnProperty('guid')){
node.guid = data.properties.guid;
}
}


if (label === params.start){
node.start = true;
Expand Down Expand Up @@ -592,10 +600,10 @@ export default class GraphContainer extends Component {
case "Domain":
node.type_domain = true;
break;
case "Gpo":
case "GPO":
node.type_gpo = true;
break;
case "Ou":
case "OU":
node.type_ou = true;
break;
}
Expand Down Expand Up @@ -688,9 +696,9 @@ export default class GraphContainer extends Component {
}else if (n.data.node.type_domain){
emitter.emit('domainNodeClicked', n.data.node.label);
}else if (n.data.node.type_gpo){
emitter.emit('gpoNodeClicked', n.data.node.label);
emitter.emit('gpoNodeClicked', n.data.node.label, n.data.node.guid);
}else if (n.data.node.type_ou){
emitter.emit('ouNodeClicked', n.data.node.label);
emitter.emit('ouNodeClicked', n.data.node.label, n.data.node.guid, n.data.node.blocksInheritance);
}
}else{
this.setState({dragged: false});
Expand Down
2 changes: 0 additions & 2 deletions src/components/Menu/MenuContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,11 @@ export default class MenuContainer extends Component {
await session.run(query, {props:currentChunk});
}else if (filetype === 'structure'){
processed = buildStructureProps(currentChunk);

for (let skey in processed){
await session.run(processed[skey].statement, { props: processed[skey].props });
}
}else if (filetype === 'gplink'){
processed = buildGplinkProps(currentChunk);

for (let gkey in processed) {
await session.run(processed[gkey].statement, { props: processed[gkey].props });
}
Expand Down
Loading

0 comments on commit 1ee97da

Please sign in to comment.