Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New table for syscheck agent files #1032

Merged
merged 16 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions public/controllers/agent/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ export class AgentsController {
this.$scope.goGroups = (agent, group) => this.goGroups(agent, group);
this.$scope.analyzeAgents = async searchTerm =>
this.analyzeAgents(searchTerm);
this.$scope.downloadCsv = async data_path => this.downloadCsv(data_path);
this.$scope.downloadCsv = async (path, fileName) => this.downloadCsv(path, fileName);

this.$scope.search = (term, specificPath) =>
this.$scope.$broadcast('wazuhSearch', { term, specificPath });

this.$scope.searchSyscheckFile = (term) =>
this.$scope.$broadcast('wazuhSearch', { term });

this.$scope.startVis2Png = () => this.startVis2Png();

this.$scope.$on('$destroy', () => {
Expand Down Expand Up @@ -417,7 +420,7 @@ export class AgentsController {
this.$scope.syscollector = {
hardware:
typeof hardwareResponse === 'object' &&
Object.keys(hardwareResponse).length
Object.keys(hardwareResponse).length
? { ...hardwareResponse }
: false,
os:
Expand Down Expand Up @@ -516,23 +519,22 @@ export class AgentsController {
return;
}

async downloadCsv(data_path) {
async downloadCsv(path, fileName) {
try {
this.errorHandler.info(
'Your download should begin automatically...',
'CSV'
);
const currentApi = JSON.parse(this.appState.getCurrentAPI()).id;
const output = await this.csvReq.fetch(
data_path,
path,
currentApi,
this.wzTableFilter.get()
);
const blob = new Blob([output], { type: 'text/csv' }); // eslint-disable-line

FileSaver.saveAs(blob, 'packages.csv');
FileSaver.saveAs(blob, fileName);

return;
} catch (error) {
this.errorHandler.handle(error, 'Download CSV');
}
Expand Down
130 changes: 77 additions & 53 deletions public/templates/agents/agents-fim.html
Original file line number Diff line number Diff line change
@@ -1,72 +1,96 @@
<md-content flex layout="column" ng-if="tab === 'fim' && tabView === 'panels'" ng-class="{'no-opacity': resultState !== 'ready' || !rendered}" layout-align="start">
<md-content flex layout="column" ng-if="tab === 'fim' && tabView === 'panels'" ng-class="{'no-opacity': resultState !== 'ready' || !rendered}"
layout-align="start">

<!-- View: Panels -->


<div layout="row" class="height-230">
<div layout="column" flex>
<div layout="row" class="height-230">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Users</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Users" vis-id="'Wazuh-App-Agents-FIM-Users'">
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Permissions</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Permissions" vis-id="'Wazuh-App-Agents-FIM-Permissions'">
</md-card-content>
</md-card>
</div>
</div>
<div layout="column" flex>
<div layout="row" class="height-230">
<div layout="column" flex>
<div layout="row" class="height-230">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Events</span>
<span class="wz-headline-title">Users</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Events" vis-id="'Wazuh-App-Agents-FIM-Events'"></kbn-vis>
<kbn-vis id="Wazuh-App-Agents-FIM-Users" vis-id="'Wazuh-App-Agents-FIM-Users'">
</md-card-content>
</md-card>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Permissions</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Permissions" vis-id="'Wazuh-App-Agents-FIM-Permissions'">
</md-card-content>
</md-card>
</div>
</div>

<div layout="row" class="height-230">
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files added</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-added" vis-id="'Wazuh-App-Agents-FIM-Files-added'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files modified</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-modified" vis-id="'Wazuh-App-Agents-FIM-Files-modified'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files deleted</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-deleted" vis-id="'Wazuh-App-Agents-FIM-Files-deleted'"></kbn-vis>
</md-card-content>
</md-card>
</div>

<div layout="row" layout-align="space-between stretch" class="height-570">
<div layout="column" flex>
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Alerts summary</span>
<span class="wz-headline-title">Events</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis vis-id="'Wazuh-App-Agents-FIM-Alerts-summary'"></kbn-vis>
<kbn-vis id="Wazuh-App-Agents-FIM-Events" vis-id="'Wazuh-App-Agents-FIM-Events'"></kbn-vis>
</md-card-content>
</md-card>
</div>

</div>
</div>

<div layout="row" class="height-230">
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files added</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-added" vis-id="'Wazuh-App-Agents-FIM-Files-added'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files modified</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-modified" vis-id="'Wazuh-App-Agents-FIM-Files-modified'"></kbn-vis>
</md-card-content>
</md-card>
<md-card flex="33" class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Files deleted</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis id="Wazuh-App-Agents-FIM-Files-deleted" vis-id="'Wazuh-App-Agents-FIM-Files-deleted'"></kbn-vis>
</md-card-content>
</md-card>
</div>

<div layout="row" layout-align="space-between stretch" class="height-570">
<md-card flex class="wz-md-card">
<md-card-content class="wazuh-column">
<span class="wz-headline-title">Alerts summary</span>
<md-divider class="wz-margin-top-10"></md-divider>
<kbn-vis vis-id="'Wazuh-App-Agents-FIM-Alerts-summary'"></kbn-vis>
</md-card-content>
</md-card>
</div>
</md-content>

<div layout="row" class="wz-padding-top-0">
<md-card flex="" class="wz-md-card _md flex">
<md-card-content>
<span class="wz-headline-title"><i class="fa fa-fw fa-file"></i> Syscheck files</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-margin-top-10">
<input placeholder="Filter files..." ng-model="filesSearch" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid height-30"
aria-invalid="false" wz-enter="searchSyscheckFile(filesSearch)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-30" ng-click="searchSyscheckFile(filesSearch)">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</div>
<div layout="row" ng-if="agent && !load" class="wz-margin-top-10 wz-margin-bottom-40-inv">
<wz-table flex path="'/syscheck/' + agent.id" row-sizes="[10,8,6,3]" extra-limit="true" keys="['file','size', 'perm', 'date']">
jesusgn90 marked this conversation as resolved.
Show resolved Hide resolved
</wz-table>
</div>
<div layout="row" class="wz-margin-top-10 wz-padding-top-10">Export:&nbsp;
<a class="small" id="btnDownload" ng-click="downloadCsv('/syscheck/' + agent.id, 'files.csv')">Formatted
<i aria-hidden="true" class="fa fa-download"></i>
</a>
<span flex></span>
</div>
</md-card-content>
</md-card>
</div>
5 changes: 4 additions & 1 deletion util/csv-key-equivalence.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@ export const KeyEquivalenece = {
'local.ip': 'Local',
'remote.ip': 'Remote',
euser: 'Effective user',
nice: 'Priority'
nice: 'Priority',
size: 'Size',
perm: 'Permissions',
date: 'Date'
};