Skip to content

Commit

Permalink
Link artifacts to open a modal with description. (Velocidex#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette authored Apr 22, 2021
1 parent 352fec8 commit 0dddaf7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
7 changes: 6 additions & 1 deletion crypto/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ func NewClientCryptoManager(config_obj *config_proto.Config, client_private_key_
return nil, errors.New("failed to parse CA certificate")
}

lru_size := int64(100)
if config_obj.Frontend != nil {
lru_size = config_obj.Frontend.Resources.ExpectedClients
}

return &ClientCryptoManager{CryptoManager{
config: config_obj,
ClientId: client_id,
private_key: private_key,
source: client_id,
Resolver: NewInMemoryPublicKeyResolver(),
cipher_lru: NewCipherLRU(config_obj.Frontend.Resources.ExpectedClients),
cipher_lru: NewCipherLRU(lru_size),
caPool: roots,
logger: logger,
}}, nil
Expand Down
57 changes: 57 additions & 0 deletions gui/velociraptor/src/components/artifacts/artifacts-link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import PropTypes from 'prop-types';
import Button from 'react-bootstrap/Button';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import VeloReportViewer from "../artifacts/reporting.js";
import Modal from 'react-bootstrap/Modal';

export default class ArtifactLink extends React.Component {
static propTypes = {
artifact: PropTypes.string,
};

state = {
artifact_definition: {},
showInspector: false,
}

render() {
return (
<>
{ this.state.showInspector &&
<Modal show={true}
size="lg"
enforceFocus={false}
scrollable={true}
onHide={() => this.setState({showInspector: false})} >
<Modal.Header closeButton>
<Modal.Title>Artifact details</Modal.Title>
</Modal.Header>
<Modal.Body>
<VeloReportViewer
artifact={this.props.artifact}
type="ARTIFACT_DESCRIPTION"
/>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary"
onClick={() => this.setState({
showInspector: false,
})}>
Close
</Button>
</Modal.Footer>
</Modal>
}
<Button size="sm" className="client-link"
onClick={()=>this.setState({
showInspector: true,
})}
variant="outline-info">
<FontAwesomeIcon icon="external-link-alt"/>
<span className="button-label">{ this.props.artifact }</span>
</Button>
</>
);
}
};
6 changes: 4 additions & 2 deletions gui/velociraptor/src/components/flows/flow-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import VeloTimestamp from "../utils/time.js";
import VeloValueRenderer from "../utils/value.js";

import ArtifactLink from '../artifacts/artifacts-link.js';
import CardDeck from 'react-bootstrap/CardDeck';
import Card from 'react-bootstrap/Card';
import Dropdown from 'react-bootstrap/Dropdown';
Expand Down Expand Up @@ -103,7 +103,9 @@ export default class FlowOverview extends React.Component {
<dt className="col-4">Artifact Names</dt>
<dd className="col-8">
{ _.map(artifacts, function(v, idx) {
return <div key={idx}>{v}</div>;
return <ArtifactLink
artifact={v}
key={idx}>{v}</ArtifactLink>;
})}
</dd>

Expand Down
6 changes: 4 additions & 2 deletions gui/velociraptor/src/components/hunts/hunt-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import _ from 'lodash';

import VeloTimestamp from "../utils/time.js";
import VeloValueRenderer from "../utils/value.js";

import ArtifactLink from '../artifacts/artifacts-link.js';
import CardDeck from 'react-bootstrap/CardDeck';
import Card from 'react-bootstrap/Card';
import Dropdown from 'react-bootstrap/Dropdown';
Expand Down Expand Up @@ -106,7 +106,9 @@ export default class HuntOverview extends React.Component {
<dt className="col-4">Artifact Names</dt>
<dd className="col-8">
{ _.map(artifacts, (v, idx) => {
return <div key={idx}>{v}</div>;
return <ArtifactLink
artifact={v}
key={idx}>{v}</ArtifactLink>;
})}
</dd>

Expand Down

0 comments on commit 0dddaf7

Please sign in to comment.