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

Added registry_value to inventory fim #2908

Merged
2 commits merged into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to the Wazuh app project will be documented in this file.
### Changed

- Support new fields of Windows Registry at FIM inventory panel [#2679](https://github.com/wazuh/wazuh-kibana-app/issues/2679)
- Added on FIM Inventory Windows Registry registry_key and registry_value items from syscheck [#2908](https://github.com/wazuh/wazuh-kibana-app/issues/2908)


## Wazuh v4.0.4 - Kibana 7.10.0 , 7.10.2 - Revision 4017
Expand All @@ -31,6 +32,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Solaris should not show vulnerabilities module [#2829](https://github.com/wazuh/wazuh-kibana-app/issues/2829)
- Fix the settings of statistics indices creation [#2858](https://github.com/wazuh/wazuh-kibana-app/issues/2858)
- Update agents' info in Management Status after changing cluster node selected [#2828](https://github.com/wazuh/wazuh-kibana-app/issues/2828)
- Fix error when applying filter in rules from events [#2877](https://github.com/wazuh/wazuh-kibana-app/issues/2877)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion common/csv-key-equivalence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const KeyEquivalence: {[key: string]: string} = {
result: 'Result',
directory: 'Path(s)',
rationale: 'Rationale',
registry: 'Registry_key',
registry: 'Registry',
date: 'Date',
value: 'Value',
location: 'Location',
Expand Down
12 changes: 6 additions & 6 deletions public/components/agents/fim/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Inventory extends Component {
_isMount = false;
state: {
filters: []
selectedTabId: 'files' | 'registry_key'
selectedTabId: 'files' | 'registry'
totalItemsFile: number
totalItemsRegistry: number
isLoading: Boolean
Expand Down Expand Up @@ -90,7 +90,7 @@ export class Inventory extends Component {
async loadAgent() {
const agentPlatform = ((this.props.agent || {}).os || {}).platform;
const {totalItemsFile, syscheck} = await this.getItemNumber('file');
const totalItemsRegistry = agentPlatform === 'windows' ? await this.getItemNumber('registry_key') : 0;
const totalItemsRegistry = agentPlatform === 'windows' ? await this.getItemNumber('registry') : 0;
const isConfigured = await this.isConfigured();
if (this._isMount){
this.setState({ totalItemsFile, totalItemsRegistry, syscheck, isLoading: false, isConfigured });
Expand All @@ -117,7 +117,7 @@ export class Inventory extends Component {
const platform = (this.props.agent.os || {}).platform || "other";
platform === 'windows' ? auxTabs.push(
{
id: 'registry_key',
id: 'registry',
name: `Windows Registry ${this.state.isLoading === true ? '' : '(' + this.state.totalItemsRegistry + ')'}`,
disabled: false,
},
Expand Down Expand Up @@ -154,13 +154,13 @@ export class Inventory extends Component {
const filter = {
...filters,
limit: type === 'file' ? '15' : '1',
type,
...(type === 'registry' ? {q: 'type=registry_key,type=registry_value'} : {type}),
...(type === 'file' && {sort: '+file'})
};
return filter;
}

async getItemNumber(type: 'file' | 'registry_key') {
async getItemNumber(type: 'file' | 'registry') {
const agentID = this.props.agent.id;
const response = await WzRequest.apiReq(
'GET',
Expand Down Expand Up @@ -267,7 +267,7 @@ export class Inventory extends Component {
onFiltersChange={this.onFiltersChange}
onTotalItemsChange={this.onTotalItemsChange}/>
}
{selectedTabId === 'registry_key' &&
{selectedTabId === 'registry' &&
<RegistryTable
{...this.props}
filters={filters}
Expand Down
6 changes: 3 additions & 3 deletions public/components/agents/fim/inventory/filterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ export class FilterBar extends Component {
...(((this.props.agent || {}).os || {}).platform !== 'windows' ? [{type: 'q', label: 'inode', description:"Inode of the file", operators:['=','!=', '~'], values: async (value) => getFilterValues('inode', value, this.props.agent.id)}]: []),
{type: 'q', label: 'size', description:"Size of the file in Bytes", values: async (value) => getFilterValues('size', value, this.props.agent.id)},
],
registry_key: [
{type: 'q', label: 'file', description:"Name of the registry", operators:['=','!=', '~'], values: async (value) => getFilterValues('file', value, this.props.agent.id, {type:'registry_key'})},
registry: [
{type: 'q', label: 'file', description:"Name of the registry_key or registry_value", operators:['=','!=', '~'], values: async (value) => getFilterValues('file', value, this.props.agent.id, {q:'type=registry_key,type=registry_value'})},
]
}

props!:{
onFiltersChange(filters:IFilter[]): void
selectView: 'files' | 'registry_key'
selectView: 'files' | 'registry'
agent: {id: string, agentPlatform: string}
onChangeCustomBadges?(customBadges: ICustomBadges[]): void
customBadges?: ICustomBadges[]
Expand Down
2 changes: 1 addition & 1 deletion public/components/agents/fim/inventory/flyout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class FlyoutDetail extends Component {
clusterFilter: {}
isLoading: boolean
error: boolean
type: 'file' | 'registry_key'
type: 'file' | 'registry_key' | 'registry_value'
}

props!: {
Expand Down
16 changes: 11 additions & 5 deletions public/components/agents/fim/inventory/registry-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export class RegistryTable extends Component {
sortDirection: Direction
isLoading: boolean
currentFile: {
file: string
file: string,
type: string
},
syscheckItem: {}
};
Expand All @@ -60,7 +61,8 @@ export class RegistryTable extends Component {
isLoading: true,
isFlyoutVisible: false,
currentFile: {
file: ""
file: "",
type: '',
},
syscheckItem: {}
}
Expand Down Expand Up @@ -106,7 +108,11 @@ export class RegistryTable extends Component {
if (!redirect)
window.location.href = window.location.href += `&file=${file}`;
//if a flyout is opened, we close it and open a new one, so the components are correctly updated on start.
this.setState({ isFlyoutVisible: false }, () => this.setState({ isFlyoutVisible: true, currentFile: file, syscheckItem: item }));
const currentFile = {
file,
type: item.type
}
this.setState({ isFlyoutVisible: false }, () => this.setState({ isFlyoutVisible: true, currentFile, syscheckItem: item }));
}

async getSyscheck() {
Expand Down Expand Up @@ -147,7 +153,7 @@ export class RegistryTable extends Component {
offset: pageIndex * pageSize,
limit: pageSize,
sort: this.buildSortFilter(),
type: 'registry_key'
q: 'type=registry_key,type=registry_value'
};

return filter;
Expand Down Expand Up @@ -242,7 +248,7 @@ export class RegistryTable extends Component {
agentId={this.props.agent.id}
item={this.state.syscheckItem}
closeFlyout={() => this.closeFlyout()}
type='registry_key'
type= {this.state.currentFile.type}
view='inventory'
{...this.props} />
</EuiOverlayMask>
Expand Down
2 changes: 1 addition & 1 deletion public/components/agents/sca/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class Inventory extends Component {
{ type: 'params', label: 'result', description: 'Filter by check result', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["result"]).filter(item => item && item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'status', description: 'Filter by check status', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["status"]).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'rationale', description: 'Filter by check rationale', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["rationale"]).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'registry_key', description: 'Filter by check registry', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["registry"] || {}).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'registry', description: 'Filter by check registry', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["registry"] || {}).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'description', description: 'Filter by check description', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["description"]).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'remediation', description: 'Filter by check remediation', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["remediation"]).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
{ type: 'params', label: 'reason', description: 'Filter by check reason', operators: ['=', '!=',], values: (value) => { return Object.keys(distinctFields["reason"]).filter(item => item && item.toLowerCase().includes(value.toLowerCase())) } },
Expand Down