mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Yarn prettier executed
This commit is contained in:
parent
3d651837b8
commit
96e6ac5a76
@ -54,7 +54,7 @@ class AgentsPreviewController {
|
||||
this.groups = [];
|
||||
this.nodes = [];
|
||||
this.node_name = 'all';
|
||||
this.selectedGroup = 'all'
|
||||
this.selectedGroup = 'all';
|
||||
this.mostActiveAgent = {
|
||||
name: '',
|
||||
id: ''
|
||||
@ -75,7 +75,7 @@ class AgentsPreviewController {
|
||||
this.load();
|
||||
}
|
||||
|
||||
search (term) {
|
||||
search(term) {
|
||||
this.$scope.$broadcast('wazuhSearch', { term });
|
||||
}
|
||||
|
||||
@ -122,11 +122,7 @@ class AgentsPreviewController {
|
||||
const pattern = this.appState.getCurrentPattern();
|
||||
|
||||
const data = await Promise.all([
|
||||
this.genericReq.request(
|
||||
'GET',
|
||||
'/api/agents-unique/' + api,
|
||||
{}
|
||||
),
|
||||
this.genericReq.request('GET', '/api/agents-unique/' + api, {}),
|
||||
this.genericReq.request(
|
||||
'GET',
|
||||
`/elastic/top/${firstUrlParam}/${secondUrlParam}/agent.name/${pattern}`
|
||||
@ -141,10 +137,8 @@ class AgentsPreviewController {
|
||||
this.osPlatforms = unique.osPlatforms;
|
||||
this.lastAgent = unique.lastAgent;
|
||||
this.agentsCountActive = unique.summary.agentsCountActive;
|
||||
this.agentsCountDisconnected =
|
||||
unique.summary.agentsCountDisconnected;
|
||||
this.agentsCountNeverConnected =
|
||||
unique.summary.agentsCountNeverConnected;
|
||||
this.agentsCountDisconnected = unique.summary.agentsCountDisconnected;
|
||||
this.agentsCountNeverConnected = unique.summary.agentsCountNeverConnected;
|
||||
this.agentsCountTotal = unique.summary.agentsCountTotal;
|
||||
this.agentsCoverity = unique.summary.agentsCoverity;
|
||||
|
||||
|
@ -17,4 +17,4 @@ import './agent/agents';
|
||||
import './settings';
|
||||
import './dev-tools';
|
||||
import './misc';
|
||||
import './monitoring'
|
||||
import './monitoring';
|
||||
|
@ -48,14 +48,7 @@ const colors = [
|
||||
const app = uiModules.get('app/wazuh', []);
|
||||
|
||||
class DecodersController {
|
||||
constructor(
|
||||
$scope,
|
||||
$sce,
|
||||
errorHandler,
|
||||
appState,
|
||||
csvReq,
|
||||
wzTableFilter
|
||||
) {
|
||||
constructor($scope, $sce, errorHandler, appState, csvReq, wzTableFilter) {
|
||||
this.$scope = $scope;
|
||||
this.$sce = $sce;
|
||||
this.errorHandler = errorHandler;
|
||||
@ -72,7 +65,7 @@ class DecodersController {
|
||||
this.viewingDetail = false;
|
||||
this.typeFilter = 'all';
|
||||
this.isArray = Array.isArray;
|
||||
|
||||
|
||||
// Reloading event listener
|
||||
this.$scope.$on('rulesetIsReloaded', () => {
|
||||
this.viewingDetail = false;
|
||||
|
@ -76,7 +76,9 @@ class Logs {
|
||||
'CSV'
|
||||
);
|
||||
const currentApi = JSON.parse(this.appState.getCurrentAPI()).id;
|
||||
const path = this.selectedNode ? `/cluster/${this.selectedNode}/logs` : '/manager/logs';
|
||||
const path = this.selectedNode
|
||||
? `/cluster/${this.selectedNode}/logs`
|
||||
: '/manager/logs';
|
||||
const output = await this.csvReq.fetch(
|
||||
path,
|
||||
currentApi,
|
||||
@ -96,16 +98,18 @@ class Logs {
|
||||
this.type_log = 'all';
|
||||
this.category = 'all';
|
||||
this.selectedNode = node;
|
||||
this.$scope.$broadcast('wazuhUpdateInstancePath', { path: `/cluster/${node}/logs` });
|
||||
this.$scope.$broadcast('wazuhUpdateInstancePath', {
|
||||
path: `/cluster/${node}/logs`
|
||||
});
|
||||
const summary = await this.apiReq.request(
|
||||
'GET',
|
||||
`/cluster/${node}/logs/summary`,
|
||||
{}
|
||||
)
|
||||
);
|
||||
const daemons = summary.data.data;
|
||||
this.daemons = Object.keys(daemons).map(item => ({ title: item }));
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Logs');
|
||||
}
|
||||
}
|
||||
@ -115,30 +119,46 @@ class Logs {
|
||||
*/
|
||||
async initialize() {
|
||||
try {
|
||||
const clusterStatus = await this.apiReq.request('GET','/cluster/status',{});
|
||||
const clusterEnabled = clusterStatus && clusterStatus.data && clusterStatus.data.data && clusterStatus.data.data.running === 'yes' && clusterStatus.data.data.enabled === 'yes'
|
||||
|
||||
if(clusterEnabled) {
|
||||
const nodeList = await this.apiReq.request('GET','/cluster/nodes',{});
|
||||
if(nodeList && nodeList.data && nodeList.data.data && Array.isArray(nodeList.data.data.items)){
|
||||
this.nodeList = nodeList.data.data.items.map(item => item.name).reverse();
|
||||
this.selectedNode = nodeList.data.data.items.filter(item => item.type === 'master')[0].name
|
||||
}
|
||||
}
|
||||
|
||||
this.logsPath = clusterEnabled ? `/cluster/${this.selectedNode}/logs` : '/manager/logs'
|
||||
|
||||
const data = clusterEnabled ?
|
||||
await this.apiReq.request(
|
||||
const clusterStatus = await this.apiReq.request(
|
||||
'GET',
|
||||
`/cluster/${this.selectedNode}/logs/summary`,
|
||||
{}
|
||||
):
|
||||
await this.apiReq.request(
|
||||
'GET',
|
||||
'/manager/logs/summary',
|
||||
'/cluster/status',
|
||||
{}
|
||||
);
|
||||
const clusterEnabled =
|
||||
clusterStatus &&
|
||||
clusterStatus.data &&
|
||||
clusterStatus.data.data &&
|
||||
clusterStatus.data.data.running === 'yes' &&
|
||||
clusterStatus.data.data.enabled === 'yes';
|
||||
|
||||
if (clusterEnabled) {
|
||||
const nodeList = await this.apiReq.request('GET', '/cluster/nodes', {});
|
||||
if (
|
||||
nodeList &&
|
||||
nodeList.data &&
|
||||
nodeList.data.data &&
|
||||
Array.isArray(nodeList.data.data.items)
|
||||
) {
|
||||
this.nodeList = nodeList.data.data.items
|
||||
.map(item => item.name)
|
||||
.reverse();
|
||||
this.selectedNode = nodeList.data.data.items.filter(
|
||||
item => item.type === 'master'
|
||||
)[0].name;
|
||||
}
|
||||
}
|
||||
|
||||
this.logsPath = clusterEnabled
|
||||
? `/cluster/${this.selectedNode}/logs`
|
||||
: '/manager/logs';
|
||||
|
||||
const data = clusterEnabled
|
||||
? await this.apiReq.request(
|
||||
'GET',
|
||||
`/cluster/${this.selectedNode}/logs/summary`,
|
||||
{}
|
||||
)
|
||||
: await this.apiReq.request('GET', '/manager/logs/summary', {});
|
||||
const daemons = data.data.data;
|
||||
this.daemons = Object.keys(daemons).map(item => ({ title: item }));
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
|
@ -22,18 +22,14 @@ class Management {
|
||||
this.rulesetTab = 'rules';
|
||||
this.tabNames = TabNames;
|
||||
this.wazuhManagementTabs = ['ruleset', 'groups'];
|
||||
this.statusReportsTabs = [
|
||||
'status',
|
||||
'logs',
|
||||
'reporting'
|
||||
];
|
||||
this.statusReportsTabs = ['status', 'logs', 'reporting'];
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
const location = this.$location.search();
|
||||
if (location && location.tab) {
|
||||
this.tab = location.tab;
|
||||
this.switchTab(this.tab)
|
||||
this.switchTab(this.tab);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,12 +39,12 @@ class Management {
|
||||
|
||||
switchTab(tab) {
|
||||
this.tab = tab;
|
||||
|
||||
if(this.tab === 'groups') {
|
||||
|
||||
if (this.tab === 'groups') {
|
||||
this.$scope.$broadcast('groupsIsReloaded');
|
||||
}
|
||||
|
||||
if(this.tab === 'ruleset') {
|
||||
|
||||
if (this.tab === 'ruleset') {
|
||||
this.$scope.$broadcast('rulesetIsReloaded');
|
||||
this.globalRuleSet = 'ruleset';
|
||||
this.globalRulesetTab = this.rulesetTab;
|
||||
@ -64,7 +60,6 @@ class Management {
|
||||
this.rulesetTab = tab;
|
||||
this.globalRulesetTab = this.rulesetTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.controller('managementController', Management);
|
||||
|
@ -148,4 +148,4 @@ class StatusController {
|
||||
}
|
||||
}
|
||||
|
||||
app.controller('managerStatusController', StatusController);
|
||||
app.controller('managerStatusController', StatusController);
|
||||
|
@ -55,7 +55,7 @@ class HealthCheck {
|
||||
this.$scope.totalChecks = 0;
|
||||
}
|
||||
|
||||
handleError(error) {
|
||||
handleError(error) {
|
||||
this.$scope.errors.push(
|
||||
this.errorHandler.handle(error, 'Health Check', false, true)
|
||||
);
|
||||
|
@ -276,7 +276,8 @@ class OverviewController {
|
||||
async getSummary() {
|
||||
try {
|
||||
const data = await this.apiReq.request('GET', '/agents/summary', {});
|
||||
const result = data && data.data && data.data.data ? data.data.data : false;
|
||||
const result =
|
||||
data && data.data && data.data.data ? data.data.data : false;
|
||||
if (result) {
|
||||
const active = result.Active - 1;
|
||||
const total = result.Total - 1;
|
||||
|
@ -473,7 +473,7 @@ app.controller('settingsController', function(
|
||||
if (!$scope.$$phase) $scope.$digest();
|
||||
return;
|
||||
} catch (error) {
|
||||
if(!wzMisc.getApiIsDown()) printError(error);
|
||||
if (!wzMisc.getApiIsDown()) printError(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -10,4 +10,4 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import './wz-table-filter-service';
|
||||
import './wz-table-directive';
|
||||
import './wz-table-directive';
|
||||
|
@ -49,7 +49,9 @@ export function clickAction(
|
||||
} else if (instance.path === '/agents/groups') {
|
||||
$scope.$emit('wazuhShowGroup', { group: item });
|
||||
} else if (
|
||||
new RegExp(/^\/agents\/groups\/[a-zA-Z0-9_\-\.]*\/files$/).test(instance.path)
|
||||
new RegExp(/^\/agents\/groups\/[a-zA-Z0-9_\-\.]*\/files$/).test(
|
||||
instance.path
|
||||
)
|
||||
) {
|
||||
$scope.$emit('wazuhShowGroupFile', {
|
||||
groupName: instance.path.split('groups/')[1].split('/files')[0],
|
||||
|
@ -28,14 +28,13 @@ export async function searchData(
|
||||
$scope.wazuh_table_loading = false;
|
||||
} catch (error) {
|
||||
$scope.wazuh_table_loading = false;
|
||||
$scope.error = `Error searching - ${error.message ||
|
||||
error}.`;
|
||||
$scope.error = `Error searching - ${error.message || error}.`;
|
||||
errorHandler.handle(
|
||||
`Error searching. ${error.message || error}`,
|
||||
'Data factory'
|
||||
);
|
||||
}
|
||||
if(!$scope.$$phase) $scope.$digest();
|
||||
if (!$scope.$$phase) $scope.$digest();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,6 +72,6 @@ export async function filterData(
|
||||
'Data factory'
|
||||
);
|
||||
}
|
||||
if(!$scope.$$phase) $scope.$digest();
|
||||
if (!$scope.$$phase) $scope.$digest();
|
||||
return;
|
||||
}
|
||||
|
@ -52,8 +52,7 @@ export async function initTable(
|
||||
$scope.wazuh_table_loading = false;
|
||||
} catch (error) {
|
||||
$scope.wazuh_table_loading = false;
|
||||
$scope.error = `Error while init table - ${error.message ||
|
||||
error}.`;
|
||||
$scope.error = `Error while init table - ${error.message || error}.`;
|
||||
errorHandler.handle(
|
||||
`Error while init table. ${error.message || error}`,
|
||||
'Data factory'
|
||||
|
@ -13,7 +13,11 @@
|
||||
export async function nextPage(currentPage, $scope, errorHandler, fetch) {
|
||||
try {
|
||||
$scope.error = false;
|
||||
if (!currentPage && currentPage !== 0 && $scope.currentPage < $scope.pagedItems.length - 1) {
|
||||
if (
|
||||
!currentPage &&
|
||||
currentPage !== 0 &&
|
||||
$scope.currentPage < $scope.pagedItems.length - 1
|
||||
) {
|
||||
$scope.currentPage++;
|
||||
}
|
||||
if ($scope.pagedItems[currentPage || $scope.currentPage].includes(null)) {
|
||||
@ -27,8 +31,7 @@ export async function nextPage(currentPage, $scope, errorHandler, fetch) {
|
||||
}
|
||||
} catch (error) {
|
||||
$scope.wazuh_table_loading = false;
|
||||
$scope.error = `Error paginating table - ${error.message ||
|
||||
error}.`;
|
||||
$scope.error = `Error paginating table - ${error.message || error}.`;
|
||||
errorHandler.handle(
|
||||
`Error paginating table due to ${error.message || error}`,
|
||||
'Data factory'
|
||||
|
@ -95,8 +95,13 @@ app.directive('wzTable', function() {
|
||||
$scope.searchTable();
|
||||
return;
|
||||
} catch (error) {
|
||||
if(error && !error.data && error.status === -1 && error.xhrStatus === 'abort') {
|
||||
return Promise.reject('Request took too long, aborted')
|
||||
if (
|
||||
error &&
|
||||
!error.data &&
|
||||
error.status === -1 &&
|
||||
error.xhrStatus === 'abort'
|
||||
) {
|
||||
return Promise.reject('Request took too long, aborted');
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export class ShareAgent {
|
||||
}
|
||||
|
||||
setTargetLocation(loc) {
|
||||
if(!loc || typeof loc !== 'object') return;
|
||||
if (!loc || typeof loc !== 'object') return;
|
||||
this.targetLocation = {};
|
||||
Object.assign(this.targetLocation, loc);
|
||||
}
|
||||
|
@ -583,11 +583,11 @@ function discoverController(
|
||||
if (!filters || !filters.length) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.opts.fetch = $scope.fetch = function() {
|
||||
// Wazuh filters are not ready yet
|
||||
if(!filtersAreReady()) return;
|
||||
if (!filtersAreReady()) return;
|
||||
|
||||
// ignore requests to fetch before the app inits
|
||||
if (!init.complete) return;
|
||||
@ -615,8 +615,8 @@ function discoverController(
|
||||
$state.filters = [];
|
||||
}*/
|
||||
// Wazuh filters are not ready yet
|
||||
if(!filtersAreReady()) return;
|
||||
|
||||
if (!filtersAreReady()) return;
|
||||
|
||||
discoverPendingUpdates.removeAll();
|
||||
discoverPendingUpdates.addItem($state.query, queryFilter.getFilters());
|
||||
$rootScope.$broadcast('updateVis');
|
||||
|
@ -181,7 +181,9 @@ app.directive('kbnVis', function() {
|
||||
|
||||
if (currentCompleted >= 100) {
|
||||
$rootScope.rendered = true;
|
||||
} else if ($scope.visID !== 'Wazuh-App-Overview-General-Agents-status') {
|
||||
} else if (
|
||||
$scope.visID !== 'Wazuh-App-Overview-General-Agents-status'
|
||||
) {
|
||||
$rootScope.rendered = false;
|
||||
}
|
||||
// Forcing a digest cycle
|
||||
|
@ -144,10 +144,7 @@ export class CommonData {
|
||||
async getGDPR() {
|
||||
try {
|
||||
const gdprTabs = [];
|
||||
const data = await this.genericReq.request(
|
||||
'GET',
|
||||
'/api/gdpr/all'
|
||||
);
|
||||
const data = await this.genericReq.request('GET', '/api/gdpr/all');
|
||||
if (!data.data) return [];
|
||||
for (const key in data.data) {
|
||||
gdprTabs.push({ title: key, content: data.data[key] });
|
||||
@ -161,10 +158,7 @@ export class CommonData {
|
||||
async getPCI() {
|
||||
try {
|
||||
const pciTabs = [];
|
||||
const data = await this.genericReq.request(
|
||||
'GET',
|
||||
'/api/pci/all'
|
||||
);
|
||||
const data = await this.genericReq.request('GET', '/api/pci/all');
|
||||
if (!data.data) return [];
|
||||
for (const key in data.data) {
|
||||
pciTabs.push({ title: key, content: data.data[key] });
|
||||
|
@ -26,11 +26,11 @@ export class CSVRequest {
|
||||
*/
|
||||
async fetch(path, id, filters = null) {
|
||||
try {
|
||||
const output = await this.genericReq.request(
|
||||
'POST',
|
||||
'/api/csv',
|
||||
{ path, id, filters }
|
||||
);
|
||||
const output = await this.genericReq.request('POST', '/api/csv', {
|
||||
path,
|
||||
id,
|
||||
filters
|
||||
});
|
||||
return output.data;
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
|
@ -70,11 +70,7 @@ export class ReportingService {
|
||||
isAgents
|
||||
};
|
||||
|
||||
await this.genericReq.request(
|
||||
'POST',
|
||||
'/reports',
|
||||
data
|
||||
);
|
||||
await this.genericReq.request('POST', '/reports', data);
|
||||
|
||||
this.$rootScope.reportBusy = false;
|
||||
this.$rootScope.reportStatus = false;
|
||||
|
@ -11,10 +11,7 @@
|
||||
*/
|
||||
export async function checkTimestamp(appState, genericReq, $location, wzMisc) {
|
||||
try {
|
||||
const data = await genericReq.request(
|
||||
'GET',
|
||||
'/elastic/timestamp'
|
||||
);
|
||||
const data = await genericReq.request('GET', '/elastic/timestamp');
|
||||
const current = appState.getCreatedAt();
|
||||
if (data && data.data) {
|
||||
if (!current) appState.setCreatedAt(data.data.lastRestart);
|
||||
|
@ -41,11 +41,7 @@ export async function getWzConfig($q, genericReq, errorHandler, wazuhConfig) {
|
||||
};
|
||||
|
||||
try {
|
||||
const config = await genericReq.request(
|
||||
'GET',
|
||||
'/utils/configuration',
|
||||
{}
|
||||
);
|
||||
const config = await genericReq.request('GET', '/utils/configuration', {});
|
||||
|
||||
if (!config || !config.data || !config.data.data)
|
||||
throw new Error('No config available');
|
||||
|
@ -32,7 +32,7 @@ import discoverTemplate from '../templates/discover/discover.jade';
|
||||
import settingsTemplate from '../templates/settings/settings.jade';
|
||||
import blankScreenTemplate from '../templates/error-handler/blank-screen.html';
|
||||
import devToolsTemplate from '../templates/dev-tools/dev-tools.html';
|
||||
import monitoringTemplate from '../templates/monitoring/monitoring.jade'
|
||||
import monitoringTemplate from '../templates/monitoring/monitoring.jade';
|
||||
|
||||
const assignPreviousLocation = ($rootScope, $location) => {
|
||||
const path = $location.path();
|
||||
@ -83,7 +83,7 @@ function nestedResolve(
|
||||
assignPreviousLocation($rootScope, $location);
|
||||
const location = $location.path();
|
||||
return getWzConfig($q, genericReq, errorHandler, wazuhConfig).then(() =>
|
||||
settingsWizard(
|
||||
settingsWizard(
|
||||
$location,
|
||||
$q,
|
||||
$window,
|
||||
@ -110,7 +110,7 @@ function savedSearch(
|
||||
return getSavedSearch(
|
||||
redirectWhenMissing,
|
||||
$location,
|
||||
$window,
|
||||
$window,
|
||||
savedSearches,
|
||||
$route
|
||||
);
|
||||
|
@ -18,8 +18,7 @@ import simpleTail from 'simple-tail';
|
||||
import path from 'path';
|
||||
|
||||
export class WazuhUtilsCtrl {
|
||||
constructor() {
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
getConfigurationFile(req, reply) {
|
||||
try {
|
||||
|
@ -21,4 +21,16 @@ import virustotal from './agents-virustotal';
|
||||
import vuls from './agents-vuls';
|
||||
import osquery from './agents-osquery';
|
||||
|
||||
export { audit, fim, general, oscap, ciscat, pci, gdpr, pm, virustotal, vuls, osquery };
|
||||
export {
|
||||
audit,
|
||||
fim,
|
||||
general,
|
||||
oscap,
|
||||
ciscat,
|
||||
pci,
|
||||
gdpr,
|
||||
pm,
|
||||
virustotal,
|
||||
vuls,
|
||||
osquery
|
||||
};
|
||||
|
@ -80,7 +80,8 @@ export default [
|
||||
_type: 'visualization',
|
||||
_source: {
|
||||
title: 'Agents reporting',
|
||||
"visState": "{\"title\":\"Agents reporting\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":true},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":60}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"agent.id\"}}]}",
|
||||
visState:
|
||||
'{"title":"Agents reporting","type":"metric","params":{"addTooltip":true,"addLegend":false,"type":"metric","metric":{"percentageMode":false,"useRanges":false,"colorSchema":"Green to Red","metricColorMode":"None","colorsRange":[{"from":0,"to":10000}],"labels":{"show":true},"invertColors":false,"style":{"bgFill":"#000","bgColor":false,"labelColor":false,"subText":"","fontSize":60}}},"aggs":[{"id":"1","enabled":true,"type":"cardinality","schema":"metric","params":{"field":"agent.id"}}]}',
|
||||
uiStateJSON: '{}',
|
||||
description: '',
|
||||
version: 1,
|
||||
|
@ -77,6 +77,7 @@ export const TabDescription = {
|
||||
},
|
||||
osquery: {
|
||||
title: 'Osquery',
|
||||
description: 'Osquery can be used to expose an operating system as a high-performance relational database.'
|
||||
description:
|
||||
'Osquery can be used to expose an operating system as a high-performance relational database.'
|
||||
}
|
||||
};
|
||||
|
@ -86,5 +86,4 @@ export function WazuhApiRoutes(server) {
|
||||
return ctrl.getAgentsFieldsUniqueCount(req, res);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -252,7 +252,12 @@ const audit = async agentID => {
|
||||
|
||||
describe('Elasticsearch', () => {
|
||||
it('GET /_cat/indices', async () => {
|
||||
const res = await needle('get', `${elasticServer}:9200/_cat/indices`, {}, headers);
|
||||
const res = await needle(
|
||||
'get',
|
||||
`${elasticServer}:9200/_cat/indices`,
|
||||
{},
|
||||
headers
|
||||
);
|
||||
res.statusCode.should.be.eql(200);
|
||||
res.body.should.be.a('string');
|
||||
});
|
||||
|
@ -11,12 +11,7 @@ let API_ID = null;
|
||||
|
||||
describe('wazuh-api-elastic', () => {
|
||||
before(async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/elastic/apis`,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/elastic/apis`, {}, {});
|
||||
if (!res.body || !res.body.length) {
|
||||
/* eslint-disable */
|
||||
console.log('There are no APIs stored in Elasticsearch, exiting...');
|
||||
@ -93,12 +88,7 @@ describe('wazuh-api-elastic', () => {
|
||||
});
|
||||
|
||||
it('GET /elastic/apis', async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/elastic/apis`,
|
||||
{},
|
||||
headers
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/elastic/apis`, {}, headers);
|
||||
res.body.should.be.a('array');
|
||||
res.body.length.should.be.gt(0);
|
||||
});
|
||||
|
@ -14,12 +14,7 @@ let API_USER = null;
|
||||
|
||||
describe('wazuh-api', () => {
|
||||
before(async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/elastic/apis`,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/elastic/apis`, {}, {});
|
||||
|
||||
/* eslint-disable */
|
||||
if (!res.body || !res.body.length) {
|
||||
@ -90,12 +85,7 @@ describe('wazuh-api', () => {
|
||||
});
|
||||
|
||||
it('GET /api/pci/{requirement}', async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/api/pci/all`,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/api/pci/all`, {}, {});
|
||||
res.body.should.be.a('object');
|
||||
res.body['1.1.1'].should.be.eql(
|
||||
'A formal process for approving and testing all network connections and changes to the firewall and router configurations'
|
||||
@ -103,12 +93,7 @@ describe('wazuh-api', () => {
|
||||
});
|
||||
|
||||
it('GET /api/gdpr/{requirement}', async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/api/gdpr/all`,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/api/gdpr/all`, {}, {});
|
||||
res.body.should.be.a('object');
|
||||
res.body['II_5.1.f'].should.be.eql(
|
||||
'Ensure the ongoing confidentiality, integrity, availability and resilience of processing systems and services, verifying its modifications, accesses, locations and guarantee the safety of them.<br>File sharing protection and file sharing technologies that meet the requirements of data protection.'
|
||||
@ -154,12 +139,7 @@ describe('wazuh-api', () => {
|
||||
});
|
||||
|
||||
it('GET /utils/logs', async () => {
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/utils/logs`,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
const res = await needle('get', `localhost:5601/utils/logs`, {}, {});
|
||||
res.body.should.be.a('object');
|
||||
res.body.lastLogs.should.be.a('array');
|
||||
res.body.error.should.be.eql(0);
|
||||
|
@ -12,7 +12,12 @@ const headers = {
|
||||
describe('wazuh-elastic', () => {
|
||||
describe('Checking index patterns', () => {
|
||||
it('GET /elastic/index-patterns', async () => {
|
||||
const res = await needle('get', `localhost:5601/elastic/index-patterns`, {}, headers);
|
||||
const res = await needle(
|
||||
'get',
|
||||
`localhost:5601/elastic/index-patterns`,
|
||||
{},
|
||||
headers
|
||||
);
|
||||
res.body.data.should.be.a('array');
|
||||
res.body.data.length.should.be.gt(0);
|
||||
res.body.data[0].should.be.a('object');
|
||||
|
Loading…
Reference in New Issue
Block a user