Skip to content

Commit

Permalink
Merge pull request #306 from wazuh/3.2-dev-metrics
Browse files Browse the repository at this point in the history
Dev metrics
  • Loading branch information
havidarou authored Mar 9, 2018
2 parents 80f8ec2 + d14d30f commit 09659b7
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 108 deletions.
34 changes: 23 additions & 11 deletions public/controllers/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ app.controller('agentsController',
scapLastScore : '[vis-id="\'Wazuh-App-Agents-OSCAP-Last-score\'"]',
scapHighestScore: '[vis-id="\'Wazuh-App-Agents-OSCAP-Higher-score-metric\'"]',
scapLowestScore : '[vis-id="\'Wazuh-App-Agents-OSCAP-Lower-score-metric\'"]'
}
}

// Metrics Virustotal
const metricsVirustotal = {
virusMalicious: '[vis-id="\'Wazuh-App-Overview-Virustotal-Total-Malicious\'"]',
virusPositives: '[vis-id="\'Wazuh-App-Overview-Virustotal-Total-Positives\'"]',
virusTotal : '[vis-id="\'Wazuh-App-Overview-Virustotal-Total\'"]'
}

$rootScope.tabVisualizations = {
general : 7,
Expand Down Expand Up @@ -76,16 +83,21 @@ app.controller('agentsController',
const checkMetrics = (tab,subtab) => {
metricService.destroyWatchers();

if(tab === 'audit' && subtab === 'panels'){
metricService.createWatchers(metricsAudit);
}

if(tab === 'vuls' && subtab === 'panels'){
metricService.createWatchers(metricsVulnerability);
}

if(tab === 'oscap' && subtab === 'panels'){
metricService.createWatchers(metricsScap);
if(subtab === 'panels'){
switch (tab) {
case 'audit':
metricService.createWatchers(metricsAudit);
break;
case 'vuls':
metricService.createWatchers(metricsVulnerability);
break;
case 'oscap':
metricService.createWatchers(metricsScap);
break;
case 'virustotal':
metricService.createWatchers(metricsVirustotal);
break;
}
}

if(!$rootScope.$$phase) $rootScope.$digest();
Expand Down
56 changes: 39 additions & 17 deletions public/controllers/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
scapLowestScore : '[vis-id="\'Wazuh-App-Overview-OSCAP-Lowest-score\'"]'
}

// Metrics Virustotal
const metricsVirustotal = {
virusMalicious: '[vis-id="\'Wazuh-App-Overview-Virustotal-Total-Malicious\'"]',
virusPositives: '[vis-id="\'Wazuh-App-Overview-Virustotal-Total-Positives\'"]',
virusTotal : '[vis-id="\'Wazuh-App-Overview-Virustotal-Total\'"]'
}

// Metrics AWS
const metricsAws = {
awsLogins :'[vis-id="\'Wazuh-App-Overview-AWS-Metric-Successful-logins\'"]',
awsMostActiveUser:'[vis-id="\'Wazuh-App-Overview-AWS-Most-active-user\'"]',
awsAuthorized :'[vis-id="\'Wazuh-App-Overview-AWS-Metric-Authorize-security\'"]',
awsRevoked :'[vis-id="\'Wazuh-App-Overview-AWS-Metric-Revoke-security\'"]'
}

// Check the url hash and retrieve the tabView information
if ($location.search().tabView) {
$scope.tabView = $location.search().tabView;
Expand Down Expand Up @@ -90,24 +105,31 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap

const checkMetrics = (tab,subtab) => {
metricService.destroyWatchers();
if(tab === 'general' && subtab === 'panels'){
metricService.createWatchers(metricsGeneral);
}

if(tab === 'fim' && subtab === 'panels'){
metricService.createWatchers(metricsFim);
}

if(tab === 'audit' && subtab === 'panels'){
metricService.createWatchers(metricsAudit);
}

if(tab === 'vuls' && subtab === 'panels'){
metricService.createWatchers(metricsVulnerability);
}

if(tab === 'oscap' && subtab === 'panels'){
metricService.createWatchers(metricsScap);
if(subtab === 'panels'){
switch (tab) {
case 'general':
metricService.createWatchers(metricsGeneral);
break;
case 'fim':
metricService.createWatchers(metricsFim);
break;
case 'audit':
metricService.createWatchers(metricsAudit);
break;
case 'vuls':
metricService.createWatchers(metricsVulnerability);
break;
case 'oscap':
metricService.createWatchers(metricsScap);
break;
case 'virustotal':
metricService.createWatchers(metricsVirustotal);
break;
case 'aws':
metricService.createWatchers(metricsAws);
break;
}
}

if(!$rootScope.$$phase) $rootScope.$digest();
Expand Down
8 changes: 4 additions & 4 deletions public/templates/agents-prev/agents-prev.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
<span class="wz-headline-title">Top</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-padding-top-10">
<p flex ng-click="showAgent(lastAgent)">Last registered agent</p>
<p flex class="text-right cursor-pointer color-pointer" ng-click="showAgent(lastAgent)">{{lastAgent.name}} <i class="fa fa-eye"></i></p>
<p class="manager-status-subtitle" ng-click="showAgent(lastAgent)">Last registered agent</p>
<p class="text-right cursor-pointer color-pointer wz-table-hover" ng-click="showAgent(lastAgent)">{{lastAgent.name}} <i class="fa fa-eye"></i></p>
</div>
<div layout="row" class="wz-padding-top-10">
<p flex ng-click="showAgent(mostActiveAgent)">Higher activity</p>
<p flex class="text-right cursor-pointer color-pointer" ng-click="showAgent(mostActiveAgent)">{{mostActiveAgent.name}} <i class="fa fa-eye"></i></p>
<p class="manager-status-subtitle" ng-click="showAgent(mostActiveAgent)">Higher activity</p>
<p class="text-right cursor-pointer color-pointer wz-table-hover" ng-click="showAgent(mostActiveAgent)">{{mostActiveAgent.name}} <i class="fa fa-eye"></i></p>
</div>
</md-card-content>
</md-card>
Expand Down
26 changes: 12 additions & 14 deletions public/templates/agents/agents-virustotal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@
<!-- View: Panels -->
<div ng-if="resultState === 'ready' && tabView === 'panels'">

<div layout="row" class="height-120">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Malicious'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Positives'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total'"></kbn-vis>
<div layout="row">
<md-card flex class="wz-metric-color wz-md-card">
<md-card-content layout="row" class="wz-padding-metric">
<div flex>Total malicious: <span class="wz-font-weight-bold">{{virusMalicious}}</span></div>
<div flex>Total positives: <span class="wz-font-weight-bold">{{virusPositives}}</span></div>
<div flex>Total: <span class="wz-font-weight-bold">{{virusTotal}}</span></div>
</md-card-content>
</md-card>
</div>

<div class="wz-no-display">
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Malicious'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Positives'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total'"></kbn-vis>
</div>

<div layout="row" class="height-250">
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
Expand Down
6 changes: 3 additions & 3 deletions public/templates/manager/ruleset/ruleset-decoders.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@
<md-chips readonly="true" ng-show="decoders.hasFilter('search') || decoders.hasFilter('file') || decoders.hasFilter('path')">
<md-chip class="wazuh-chip" ng-click="decoders.removeFilter('search', true)" ng-if="decoders.hasFilter('search') && decoders.getFilter('search')">
<span class="bold">Search: {{decoders.getFilter('search')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="decoders.removeFilter('file', true)" ng-if="decoders.hasFilter('file');">
<span class="bold">File: {{decoders.getFilter('file')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="decoders.removeFilter('path', true)" ng-if="decoders.hasFilter('path');">
<span class="bold">Path: {{decoders.getFilter('path')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
</md-chips>
Expand Down
10 changes: 5 additions & 5 deletions public/templates/manager/ruleset/ruleset-rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,27 @@
<md-chips readonly="true" ng-show="rules.hasFilter('level') || rules.hasFilter('search') || rules.hasFilter('file') || rules.hasFilter('group') || rules.hasFilter('pci')">
<md-chip class="wazuh-chip" ng-click="rules.removeFilter('search', true)" ng-if="rules.hasFilter('search') && rules.getFilter('search')">
<span class="bold">Search: {{rules.getFilter('search')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="rules.removeFilter('file', true)" ng-if="rules.hasFilter('file')">
<span class="bold">File: {{rules.getFilter('file')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="rules.removeFilter('level', true)" ng-if="rules.hasFilter('level')">
<span class="bold">Level: {{rules.getFilter('level')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="rules.removeFilter('group', true)" ng-if="rules.hasFilter('group')">
<span class="bold">Group: {{rules.getFilter('group')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
<md-chip class="wazuh-chip" ng-click="rules.removeFilter('pci', true)" ng-if="rules.hasFilter('pci')">
<span>PCI control: {{rules.getFilter('pci')}}
<i class="fa fa-times" aria-hidden="true"></i>
<i class="fa fa-times cursor-pointer" aria-hidden="true"></i>
</span>
</md-chip>
</md-chips>
Expand Down
43 changes: 18 additions & 25 deletions public/templates/overview/overview-aws.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
<!-- View: Panels -->
<div ng-if="resultState === 'ready' && tabView === 'panels'">

<div layout="row">
<md-card flex class="wz-metric-color wz-md-card">
<md-card-content layout="row" class="wz-padding-metric">
<div flex>Successful logins: <span class="wz-font-weight-bold">{{awsLogins}}</span></div>
<div flex>Most active user: <span class="wz-font-weight-bold">{{awsMostActiveUser}}</span></div>
<div flex>Authorized security groups: <span class="wz-font-weight-bold">{{awsAuthorized}}</span></div>
<div flex>Revoked security groups: <span class="wz-font-weight-bold">{{awsRevoked}}</span></div>
</md-card-content>
</md-card>
</div>

<div class="wz-no-display">
<kbn-vis vis-id="'Wazuh-App-Overview-AWS-Metric-Successful-logins'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-AWS-Most-active-user'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-AWS-Metric-Authorize-security'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-AWS-Metric-Revoke-security'"></kbn-vis>
</div>

<div layout="row" layout-align="center stretch" class="height-300">
<div flex layout="column">
<md-card flex class="wz-md-card">
Expand All @@ -13,34 +31,9 @@
</md-card-content>
</md-card>
</div>
<div flex="25" layout="column">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column text-center">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-AWS-Metric-Successful-logins'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column text-center">
<div class="ng-binding">Most active user</div>
<kbn-vis class="kbn-vis-value" vis-id="'Wazuh-App-Overview-AWS-Most-active-user'"></kbn-vis>
</md-card-content>
</md-card>
</div>
</div>

<div layout="row" layout-align="center stretch" class="height-270">
<div flex="25" layout="column">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-AWS-Metric-Authorize-security'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-AWS-Metric-Revoke-security'"></kbn-vis>
</md-card-content>
</md-card>
</div>
<div flex layout="column">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
Expand Down
44 changes: 15 additions & 29 deletions public/templates/overview/overview-virustotal.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
<md-content flex layout="column" ng-if="tab === 'virustotal'" layout-align="start">
<div ng-if="resultState === 'ready' && tabView === 'panels'">
<div layout="row" class="height-360">
<div flex layout="column">
<div flex layout="row">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-Virustotal-Total-Malicious'"></kbn-vis>
</md-card-content>
</md-card>

</div>

<div flex layout="row">
<div layout="row">
<md-card flex class="wz-metric-color wz-md-card">
<md-card-content layout="row" class="wz-padding-metric">
<div flex>Total malicious: <span class="wz-font-weight-bold">{{virusMalicious}}</span></div>
<div flex>Total positives: <span class="wz-font-weight-bold">{{virusPositives}}</span></div>
<div flex>Total: <span class="wz-font-weight-bold">{{virusTotal}}</span></div>
</md-card-content>
</md-card>
</div>

<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-Virustotal-Total-Positives'"></kbn-vis>
</md-card-content>
</md-card>
</div>
<div flex layout="row">
<div class="wz-no-display">
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Malicious'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total-Positives'"></kbn-vis>
<kbn-vis vis-id="'Wazuh-App-Overview-Virustotal-Total'"></kbn-vis>
</div>

<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<kbn-vis class="metric" vis-id="'Wazuh-App-Overview-Virustotal-Total'"></kbn-vis>
</md-card-content>
</md-card>
</div>
</div>
<div layout="row" class="height-360">
<div flex layout="column">
<div flex layout="row">

<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Unique malicious files per agent</span>
Expand All @@ -51,8 +39,6 @@
</md-card>
</div>
</div>


</div>
<div layout="row" class="height-550">
<md-card flex class="wz-md-card">
Expand Down

0 comments on commit 09659b7

Please sign in to comment.