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

[Attack discovery] Add utils for testing #182918

Merged
Merged
Show file tree
Hide file tree
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 May 8, 2024
5b681fd
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski May 8, 2024
0110a1a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine May 8, 2024
1e64c41
fix
patrykkopycinski May 8, 2024
a9d8dd9
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski May 8, 2024
049e172
fix
patrykkopycinski May 10, 2024
dab9460
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 10, 2024
758582b
fix
patrykkopycinski May 10, 2024
70fb039
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski May 10, 2024
2838945
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 14, 2024
7548256
fix
patrykkopycinski May 14, 2024
814b532
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 14, 2024
d31a8b4
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 15, 2024
c0c821a
retries
patrykkopycinski May 15, 2024
6d8f13a
cleanup
patrykkopycinski May 15, 2024
ad70f8c
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski May 16, 2024
7c04dd3
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 17, 2024
1186809
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski May 17, 2024
c4fa7bc
Merge branch 'main' into feat/attack-discovery-e2e
hop-dev Jul 9, 2024
2f96603
Add headers to rules API calls in data generator
hop-dev Jul 10, 2024
deadafa
revert cypress part
patrykkopycinski Jul 12, 2024
4c1d4a2
cleanup
patrykkopycinski Jul 12, 2024
98eeb7b
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski Nov 22, 2024
0255af7
PR reviews
patrykkopycinski Nov 22, 2024
58d8041
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski Nov 25, 2024
77919a3
fix
patrykkopycinski Nov 25, 2024
fbd0f48
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski Dec 19, 2024
d155573
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 19, 2024
b128aae
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski Jan 13, 2025
d1d39da
Merge branch 'main' of github.com:elastic/kibana into feat/attack-dis…
patrykkopycinski Jan 13, 2025
b674d96
move files
patrykkopycinski Jan 13, 2025
75ebd94
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Jan 13, 2025
704f6e5
move it back because of circular dependecies
patrykkopycinski Jan 13, 2025
111b994
Merge branch 'feat/attack-discovery-e2e' of github.com:patrykkopycins…
patrykkopycinski Jan 13, 2025
d0587b3
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 13, 2025
4d55d8a
Merge branch 'main' into feat/attack-discovery-e2e
patrykkopycinski Jan 14, 2025
da54b60
Update index.ts
patrykkopycinski Jan 14, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@kbn/data-views-plugin",
"@kbn/core-analytics-server",
"@kbn/llm-tasks-plugin",
"@kbn/product-doc-base-plugin"
"@kbn/product-doc-base-plugin",
],
"exclude": [
"target/**/*",
Expand Down
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'],
Copy link
Contributor

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?

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)
`,
},
}
);
};
Loading