-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Refactor Network Details to use Search Strategy (#…
…76928) Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
bd38482
commit bfab380
Showing
80 changed files
with
1,664 additions
and
1,199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
...ugins/security_solution/common/search_strategy/security_solution/network/details/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common'; | ||
import { HostEcs } from '../../../../ecs/host'; | ||
import { GeoEcs } from '../../../../ecs/geo'; | ||
import { Inspect, Maybe, TotalValue, Hit, ShardsResponse } from '../../../common'; | ||
import { RequestBasicOptions } from '../..'; | ||
|
||
export interface NetworkDetailsRequestOptions extends Omit<RequestBasicOptions, 'timerange'> { | ||
ip: string; | ||
} | ||
|
||
export interface NetworkDetailsStrategyResponse extends IEsSearchResponse { | ||
networkDetails: { | ||
client?: Maybe<NetworkDetails>; | ||
destination?: Maybe<NetworkDetails>; | ||
host?: HostEcs; | ||
server?: Maybe<NetworkDetails>; | ||
source?: Maybe<NetworkDetails>; | ||
}; | ||
inspect?: Maybe<Inspect>; | ||
} | ||
|
||
export interface NetworkDetails { | ||
firstSeen?: Maybe<string>; | ||
lastSeen?: Maybe<string>; | ||
autonomousSystem: AutonomousSystem; | ||
geo: GeoEcs; | ||
} | ||
|
||
export interface AutonomousSystem { | ||
number?: Maybe<number>; | ||
organization?: Maybe<AutonomousSystemOrganization>; | ||
} | ||
|
||
export interface AutonomousSystemOrganization { | ||
name?: Maybe<string>; | ||
} | ||
|
||
interface ResultHit<T> { | ||
doc_count: number; | ||
results: { | ||
hits: { | ||
total: TotalValue | number; | ||
max_score: number | null; | ||
hits: Array<{ | ||
_source: T; | ||
sort?: [number]; | ||
_index?: string; | ||
_type?: string; | ||
_id?: string; | ||
_score?: number | null; | ||
}>; | ||
}; | ||
}; | ||
} | ||
|
||
export interface NetworkHit { | ||
took?: number; | ||
timed_out?: boolean; | ||
_scroll_id?: string; | ||
_shards?: ShardsResponse; | ||
timeout?: number; | ||
hits?: { | ||
total: number; | ||
hits: Hit[]; | ||
}; | ||
doc_count: number; | ||
geo: ResultHit<object>; | ||
autonomousSystem: ResultHit<object>; | ||
firstSeen: { | ||
value: number; | ||
value_as_string: string; | ||
}; | ||
lastSeen: { | ||
value: number; | ||
value_as_string: string; | ||
}; | ||
} | ||
|
||
export type NetworkDetailsHostHit = ResultHit<object>; | ||
|
||
export interface NetworkDetailsHit { | ||
aggregations: { | ||
destination?: NetworkHit; | ||
source?: NetworkHit; | ||
host: ResultHit<object>; | ||
}; | ||
_shards: { | ||
total: number; | ||
successful: number; | ||
skipped: number; | ||
failed: number; | ||
}; | ||
hits: { | ||
total: { | ||
value: number; | ||
relation: string; | ||
}; | ||
max_score: number | null; | ||
hits: []; | ||
}; | ||
took: number; | ||
timeout: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...plugins/security_solution/common/search_strategy/security_solution/network/users/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common'; | ||
import { CursorType, Inspect, Maybe, PageInfoPaginated, SortField } from '../../../common'; | ||
import { FlowTarget } from '../common'; | ||
import { RequestOptionsPaginated } from '../..'; | ||
|
||
export enum NetworkUsersFields { | ||
name = 'name', | ||
count = 'count', | ||
} | ||
|
||
export interface NetworkUsersRequestOptions extends RequestOptionsPaginated { | ||
ip: string; | ||
sort: SortField<NetworkUsersFields>; | ||
flowTarget: FlowTarget; | ||
} | ||
|
||
export interface NetworkUsersStrategyResponse extends IEsSearchResponse { | ||
edges: NetworkUsersEdges[]; | ||
totalCount: number; | ||
pageInfo: PageInfoPaginated; | ||
inspect?: Maybe<Inspect>; | ||
} | ||
|
||
export interface NetworkUsersEdges { | ||
node: NetworkUsersNode; | ||
cursor: CursorType; | ||
} | ||
|
||
export interface NetworkUsersNode { | ||
_id?: Maybe<string>; | ||
timestamp?: Maybe<string>; | ||
user?: Maybe<NetworkUsersItem>; | ||
} | ||
|
||
export interface NetworkUsersItem { | ||
name?: Maybe<string>; | ||
id?: Maybe<string[] | string>; | ||
groupId?: Maybe<string[] | string>; | ||
groupName?: Maybe<string[] | string>; | ||
count?: Maybe<number>; | ||
} | ||
|
||
export interface NetworkUsersBucketsItem { | ||
key: string; | ||
doc_count: number; | ||
groupName?: NetworkUsersGroupName; | ||
groupId?: NetworkUsersGroupId; | ||
id?: Id; | ||
} | ||
|
||
export interface NetworkUsersGroupName { | ||
doc_count_error_upper_bound: number; | ||
sum_other_doc_count: number; | ||
buckets: NetworkUsersBucketsItem[]; | ||
} | ||
|
||
export interface NetworkUsersGroupId { | ||
doc_count_error_upper_bound: number; | ||
sum_other_doc_count: number; | ||
buckets: NetworkUsersBucketsItem[]; | ||
} | ||
|
||
interface Id { | ||
doc_count_error_upper_bound: number; | ||
sum_other_doc_count: number; | ||
buckets: NetworkUsersBucketsItem[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.