-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Attack discovery] Add utils for testing #182918
Merged
patrykkopycinski
merged 37 commits into
elastic:main
from
patrykkopycinski:feat/attack-discovery-e2e
Jan 14, 2025
+116,346
−1
Merged
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
957e0b0
Add e2e for Attack discovery
patrykkopycinski 5b681fd
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski 0110a1a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 1e64c41
fix
patrykkopycinski a9d8dd9
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski 049e172
fix
patrykkopycinski dab9460
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski 758582b
fix
patrykkopycinski 70fb039
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski 2838945
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski 7548256
fix
patrykkopycinski 814b532
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski d31a8b4
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski c0c821a
retries
patrykkopycinski 6d8f13a
cleanup
patrykkopycinski ad70f8c
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski 7c04dd3
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski 1186809
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski c4fa7bc
Merge branch 'main' into feat/attack-discovery-e2e
hop-dev 2f96603
Add headers to rules API calls in data generator
hop-dev deadafa
revert cypress part
patrykkopycinski 4c1d4a2
cleanup
patrykkopycinski 98eeb7b
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski 0255af7
PR reviews
patrykkopycinski 58d8041
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski 77919a3
fix
patrykkopycinski fbd0f48
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski d155573
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine b128aae
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski d1d39da
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski b674d96
move files
patrykkopycinski 75ebd94
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine 704f6e5
move it back because of circular dependecies
patrykkopycinski 111b994
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski d0587b3
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 4d55d8a
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski da54b60
Update index.ts
patrykkopycinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
64 changes: 64 additions & 0 deletions
64
x-pack/solutions/security/plugins/security_solution/scripts/attack_discovery/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,64 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { run } from '@kbn/dev-cli-runner'; | ||
import { createEsClient, createKbnClient } from '../endpoint/common/stack_services'; | ||
import { HORIZONTAL_LINE } from '../endpoint/common/constants'; | ||
import { createToolingLogger } from '../../common/endpoint/data_loaders/utils'; | ||
import { loadAttackDiscoveryData } from './load'; | ||
|
||
export const cli = () => { | ||
run( | ||
async (cliContext) => { | ||
createToolingLogger.setDefaultLogLevelFromCliFlags(cliContext.flags); | ||
|
||
const log = cliContext.log; | ||
const kbnClient = createKbnClient({ | ||
log, | ||
url: cliContext.flags.kibanaUrl as string, | ||
username: cliContext.flags.username as string, | ||
password: cliContext.flags.password as string, | ||
}); | ||
const esClient = createEsClient({ | ||
log, | ||
url: cliContext.flags.elasticsearchUrl as string, | ||
username: cliContext.flags.username as string, | ||
password: cliContext.flags.password as string, | ||
}); | ||
|
||
log.info(`${HORIZONTAL_LINE} | ||
Environment Data Loader | ||
${HORIZONTAL_LINE} | ||
`); | ||
log.info(`Loading data to: ${kbnClient.resolveUrl('')}`); | ||
|
||
await loadAttackDiscoveryData({ kbnClient, esClient, log }); | ||
}, | ||
|
||
// Options | ||
{ | ||
description: `Loads data into a environment for testing/development`, | ||
flags: { | ||
string: ['kibanaUrl', 'username', 'password'], | ||
default: { | ||
kibanaUrl: 'http://127.0.0.1:5601', | ||
elasticsearchUrl: 'http://127.0.0.1:9200', | ||
username: 'elastic', | ||
password: 'changeme', | ||
}, | ||
allowUnexpected: false, | ||
help: ` | ||
--username User name to be used for auth against elasticsearch and | ||
kibana (Default: elastic). | ||
--password User name Password (Default: changeme) | ||
--kibanaUrl The url to Kibana (Default: http://127.0.0.1:5601) | ||
--elasticsearchUrl The url to Elasticsearch (Default: http://127.0.0.1:9200) | ||
`, | ||
}, | ||
} | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we have
elasticsearchUrl
here?