pidsmaker 5.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pidsmaker/__init__.py +1 -0
- pidsmaker/cli.py +81 -0
- pidsmaker/config/__init__.py +2 -0
- pidsmaker/config/config.py +2100 -0
- pidsmaker/config/pipeline.py +1824 -0
- pidsmaker/config/schemas.py +1032 -0
- pidsmaker/datasets.py +323 -0
- pidsmaker/debug_tests.py +30 -0
- pidsmaker/decoders/__init__.py +5 -0
- pidsmaker/decoders/custom_edge_mlp_decoder.py +17 -0
- pidsmaker/decoders/custom_mlp_decoder.py +10 -0
- pidsmaker/decoders/edge_linear_decoder.py +16 -0
- pidsmaker/decoders/inner_product_decoder.py +18 -0
- pidsmaker/decoders/nodlink_decoder.py +56 -0
- pidsmaker/detection/__init__.py +0 -0
- pidsmaker/detection/evaluation_methods/__init__.py +9 -0
- pidsmaker/detection/evaluation_methods/edge_evaluation.py +255 -0
- pidsmaker/detection/evaluation_methods/evaluation_utils.py +1788 -0
- pidsmaker/detection/evaluation_methods/host_two_stage_evaluation.py +115 -0
- pidsmaker/detection/evaluation_methods/node_evaluation.py +459 -0
- pidsmaker/detection/evaluation_methods/node_tw_evaluation.py +196 -0
- pidsmaker/detection/evaluation_methods/plot.py +192 -0
- pidsmaker/detection/evaluation_methods/queue_evaluation.py +456 -0
- pidsmaker/detection/evaluation_methods/tw_evaluation.py +93 -0
- pidsmaker/detection/flash_detection.py +162 -0
- pidsmaker/detection/magic_knn.py +190 -0
- pidsmaker/detection/node_scoring.py +52 -0
- pidsmaker/detection/threatrace_detection.py +65 -0
- pidsmaker/detection/training_methods/__init__.py +1 -0
- pidsmaker/detection/training_methods/inference_loop.py +287 -0
- pidsmaker/detection/training_methods/ocrapt_early_stop.py +165 -0
- pidsmaker/detection/training_methods/threatrace_training.py +168 -0
- pidsmaker/detection/training_methods/training_loop.py +383 -0
- pidsmaker/encoders/__init__.py +22 -0
- pidsmaker/encoders/argus_encoder.py +69 -0
- pidsmaker/encoders/custom_mlp.py +75 -0
- pidsmaker/encoders/custom_mlp_encoder.py +10 -0
- pidsmaker/encoders/egraphsage_encoder.py +56 -0
- pidsmaker/encoders/gat.py +67 -0
- pidsmaker/encoders/gcn.py +27 -0
- pidsmaker/encoders/gin.py +48 -0
- pidsmaker/encoders/glstm.py +298 -0
- pidsmaker/encoders/graph_attention.py +63 -0
- pidsmaker/encoders/gru.py +29 -0
- pidsmaker/encoders/hetero/__init__.py +4 -0
- pidsmaker/encoders/hetero/ancestor_encoder.py +98 -0
- pidsmaker/encoders/hetero/entity_encoder.py +33 -0
- pidsmaker/encoders/hetero/event_encoder.py +81 -0
- pidsmaker/encoders/hetero/hetero_graph_transformer.py +40 -0
- pidsmaker/encoders/lares_encoder.py +68 -0
- pidsmaker/encoders/linear_encoder.py +16 -0
- pidsmaker/encoders/magic_encoder.py +161 -0
- pidsmaker/encoders/rcaid_encoder.py +81 -0
- pidsmaker/encoders/rgcn.py +75 -0
- pidsmaker/encoders/sage.py +51 -0
- pidsmaker/encoders/shadewatcher_encoder.py +149 -0
- pidsmaker/encoders/sum_aggregation.py +20 -0
- pidsmaker/encoders/temporal_wrappers.py +80 -0
- pidsmaker/encoders/textrcnn.py +82 -0
- pidsmaker/encoders/tgn_encoder.py +193 -0
- pidsmaker/experiments/tuning.py +102 -0
- pidsmaker/experiments/uncertainty.py +261 -0
- pidsmaker/factory.py +1456 -0
- pidsmaker/featurization/__init__.py +0 -0
- pidsmaker/featurization/feat_inference_methods/__init__.py +7 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_HFH.py +30 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_TRW.py +65 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_alacarte.py +14 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_doc2vec.py +53 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_fasttext.py +37 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_flash.py +69 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_graph2vec.py +84 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_ocrapt_features.py +95 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_pretrained.py +1728 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_word2vec.py +55 -0
- pidsmaker/featurization/featurization_methods/__init__.py +0 -0
- pidsmaker/featurization/featurization_methods/build_trw.py +66 -0
- pidsmaker/featurization/featurization_methods/featurization_alacarte.py +747 -0
- pidsmaker/featurization/featurization_methods/featurization_doc2vec.py +98 -0
- pidsmaker/featurization/featurization_methods/featurization_fasttext.py +74 -0
- pidsmaker/featurization/featurization_methods/featurization_flash.py +201 -0
- pidsmaker/featurization/featurization_methods/featurization_graph2vec.py +242 -0
- pidsmaker/featurization/featurization_methods/featurization_trw.py +114 -0
- pidsmaker/featurization/featurization_methods/featurization_word2vec.py +89 -0
- pidsmaker/featurization/featurization_utils.py +275 -0
- pidsmaker/featurization/utils/build_random_walks.py +66 -0
- pidsmaker/featurization/utils/trw.py +203 -0
- pidsmaker/hetero.py +81 -0
- pidsmaker/losses.py +170 -0
- pidsmaker/main.py +478 -0
- pidsmaker/mimicry.py +284 -0
- pidsmaker/model.py +382 -0
- pidsmaker/objectives/__init__.py +16 -0
- pidsmaker/objectives/autoencode_edge_emb.py +43 -0
- pidsmaker/objectives/deep_graph_infomax.py +94 -0
- pidsmaker/objectives/detect_few_shot.py +21 -0
- pidsmaker/objectives/one_class.py +75 -0
- pidsmaker/objectives/predict_edge_contrastive.py +165 -0
- pidsmaker/objectives/predict_edge_supervised.py +77 -0
- pidsmaker/objectives/predict_edge_type.py +28 -0
- pidsmaker/objectives/predict_masked_struct.py +49 -0
- pidsmaker/objectives/predict_node_type.py +36 -0
- pidsmaker/objectives/predict_process_tag.py +169 -0
- pidsmaker/objectives/predict_snapshot_embedding.py +97 -0
- pidsmaker/objectives/reconstruct_edge_emb.py +16 -0
- pidsmaker/objectives/reconstruct_masked_feat.py +51 -0
- pidsmaker/objectives/reconstruct_node_emb.py +13 -0
- pidsmaker/objectives/reconstruct_node_feat.py +13 -0
- pidsmaker/objectives/validation_wrapper.py +55 -0
- pidsmaker/preprocessing/__init__.py +0 -0
- pidsmaker/preprocessing/build_graph_methods/__init__.py +1 -0
- pidsmaker/preprocessing/build_graph_methods/build_default_graphs.py +825 -0
- pidsmaker/preprocessing/build_graph_methods/build_magic_graphs.py +216 -0
- pidsmaker/preprocessing/cleaning.py +258 -0
- pidsmaker/preprocessing/transformation_methods/__init__.py +2 -0
- pidsmaker/preprocessing/transformation_methods/attack_generation/synthetic_attack_naive.py +194 -0
- pidsmaker/preprocessing/transformation_methods/transformation_dag.py +28 -0
- pidsmaker/preprocessing/transformation_methods/transformation_merge_edges.py +136 -0
- pidsmaker/preprocessing/transformation_methods/transformation_rcaid_pseudo_graph.py +510 -0
- pidsmaker/preprocessing/transformation_methods/transformation_undirected.py +24 -0
- pidsmaker/preprocessing/transformation_methods/transformation_utils.py +36 -0
- pidsmaker/pretrained/__init__.py +5 -0
- pidsmaker/pretrained/data/__init__.py +4 -0
- pidsmaker/pretrained/data/behavior_signatures.py +548 -0
- pidsmaker/pretrained/data/canonical_tokens.py +1035 -0
- pidsmaker/pretrained/data/edge_filter.py +381 -0
- pidsmaker/pretrained/data/entity_classes.py +476 -0
- pidsmaker/pretrained/data/sampler.py +926 -0
- pidsmaker/pretrained/data/tokenizer_bpe.py +1659 -0
- pidsmaker/pretrained/detect.py +1427 -0
- pidsmaker/pretrained/embedding_generator.py +252 -0
- pidsmaker/pretrained/finetune.py +1434 -0
- pidsmaker/pretrained/models/__init__.py +20 -0
- pidsmaker/pretrained/models/behavior.py +348 -0
- pidsmaker/pretrained/models/bert.py +286 -0
- pidsmaker/pretrained/models/deepwalk.py +128 -0
- pidsmaker/pretrained/models/dgi.py +120 -0
- pidsmaker/pretrained/models/gae.py +114 -0
- pidsmaker/pretrained/models/gnn_distill.py +475 -0
- pidsmaker/pretrained/models/graphmae.py +373 -0
- pidsmaker/pretrained/models/hf_pretrained.py +213 -0
- pidsmaker/pretrained/models/llama.py +110 -0
- pidsmaker/pretrained/models/modernbert.py +567 -0
- pidsmaker/pretrained/models/roberta.py +147 -0
- pidsmaker/pretrained/models/rope_utils.py +99 -0
- pidsmaker/pretrained/models/ropebert.py +322 -0
- pidsmaker/pretrained/models/spider.py +204 -0
- pidsmaker/pretrained/models/tgn.py +770 -0
- pidsmaker/pretrained/pretrain/__init__.py +3 -0
- pidsmaker/pretrained/pretrain/pretrain_behavior_cluster.py +513 -0
- pidsmaker/pretrained/pretrain/pretrain_common.py +585 -0
- pidsmaker/pretrained/pretrain/pretrain_deepwalk.py +31 -0
- pidsmaker/pretrained/pretrain/pretrain_dgi.py +143 -0
- pidsmaker/pretrained/pretrain/pretrain_gae.py +143 -0
- pidsmaker/pretrained/pretrain/pretrain_gnn_distill.py +438 -0
- pidsmaker/pretrained/pretrain/pretrain_graphmae.py +151 -0
- pidsmaker/pretrained/pretrain/pretrain_hf.py +169 -0
- pidsmaker/pretrained/pretrain/pretrain_main.py +275 -0
- pidsmaker/pretrained/pretrain/pretrain_mlm.py +491 -0
- pidsmaker/pretrained/pretrain/pretrain_spider.py +502 -0
- pidsmaker/pretrained/training_utils.py +157 -0
- pidsmaker/process_reapr_gt.py +101 -0
- pidsmaker/resources/config/anomal_e.yml +25 -0
- pidsmaker/resources/config/argus.yml +56 -0
- pidsmaker/resources/config/attack_edges/cadets_e3.yml +435 -0
- pidsmaker/resources/config/attack_edges/cadets_e5.yml +407 -0
- pidsmaker/resources/config/attack_edges/theia_e3.yml +382 -0
- pidsmaker/resources/config/attack_edges/theia_e5.yml +387 -0
- pidsmaker/resources/config/attack_edges/trace_e3.yml +415 -0
- pidsmaker/resources/config/attack_edges/trace_e5.yml +417 -0
- pidsmaker/resources/config/default.yml +315 -0
- pidsmaker/resources/config/egraphsage.yml +95 -0
- pidsmaker/resources/config/euler.yml +104 -0
- pidsmaker/resources/config/eval/eval_set_clustering.json +3170 -0
- pidsmaker/resources/config/experiments/tuning/components/tuning_featurization_methods.yml +29 -0
- pidsmaker/resources/config/experiments/tuning/systems/clearscope_e5/tuning_orthrus.yml +14 -0
- pidsmaker/resources/config/experiments/tuning/systems/default/tuning_default_baselines.yml +13 -0
- pidsmaker/resources/config/experiments/tuning/systems/default/tuning_orthrus_fixed.yml +16 -0
- pidsmaker/resources/config/experiments/uncertainty/none.yml +5 -0
- pidsmaker/resources/config/experiments/uncertainty/run_n_times.yml +12 -0
- pidsmaker/resources/config/experiments/uncertainty/run_n_times_hyperparameters.yml +12 -0
- pidsmaker/resources/config/experiments/uncertainty/uncertainty.yml +22 -0
- pidsmaker/resources/config/flash.yml +79 -0
- pidsmaker/resources/config/jbeil.yml +65 -0
- pidsmaker/resources/config/kairos.yml +121 -0
- pidsmaker/resources/config/lares.yml +115 -0
- pidsmaker/resources/config/magic.yml +86 -0
- pidsmaker/resources/config/nodlink.yml +79 -0
- pidsmaker/resources/config/ocrapt.yml +91 -0
- pidsmaker/resources/config/orthrus.yml +126 -0
- pidsmaker/resources/config/orthrus_fixed.yml +17 -0
- pidsmaker/resources/config/pretrained/README.md +101 -0
- pidsmaker/resources/config/pretrained/cybergfm/cybergfm.yml +49 -0
- pidsmaker/resources/config/pretrained/pretrained.yml +190 -0
- pidsmaker/resources/config/pretrained/pretrained_flash.yml +9 -0
- pidsmaker/resources/config/pretrained/pretrained_kairos.yml +12 -0
- pidsmaker/resources/config/pretrained/pretrained_magic.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_nodlink.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_orthrus.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_supervised.yml +13 -0
- pidsmaker/resources/config/pretrained/pretrained_threatrace.yml +8 -0
- pidsmaker/resources/config/pretrained/pretrained_velox.yml +14 -0
- pidsmaker/resources/config/prographer.yml +136 -0
- pidsmaker/resources/config/rcaid.yml +88 -0
- pidsmaker/resources/config/shadewatcher.yml +146 -0
- pidsmaker/resources/config/tests.yml +10 -0
- pidsmaker/resources/config/threatrace.yml +73 -0
- pidsmaker/resources/config/tuned_baselines/optc_net/tuned_argus.yml +4 -0
- pidsmaker/resources/config/tuned_baselines/optc_net/tuned_lares.yml +13 -0
- pidsmaker/resources/config/velox.yml +10 -0
- pidsmaker/resources/config/viz_config.yml +10 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CADETS/node_Nginx_Backdoor_06.csv +8 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CADETS/node_Nginx_Backdoor_11.csv +4 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CADETS/node_Nginx_Backdoor_12.csv +43 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CADETS/node_Nginx_Backdoor_13.csv +24 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0411.csv +41 -0
- pidsmaker/resources/ground_truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0412.csv +0 -0
- pidsmaker/resources/ground_truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_browser_0412.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +63 -0
- pidsmaker/resources/ground_truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +56 -0
- pidsmaker/resources/ground_truth/orthrus/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +61 -0
- pidsmaker/resources/ground_truth/orthrus/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +58 -0
- pidsmaker/resources/ground_truth/orthrus/E3-TRACE/node_trace_e3_firefox_0410.csv +11 -0
- pidsmaker/resources/ground_truth/orthrus/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +11 -0
- pidsmaker/resources/ground_truth/orthrus/E3-TRACE/node_trace_e3_pine_0413.csv +14 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT.csv +19 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT_17.csv +107 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_appstarter_0515.csv +26 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_firefox_0517.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_lockwatch_0517.csv +17 -0
- pidsmaker/resources/ground_truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_tester_0517.csv +8 -0
- pidsmaker/resources/ground_truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_bits_0515.csv +54 -0
- pidsmaker/resources/ground_truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_copykatz_0509.csv +87 -0
- pidsmaker/resources/ground_truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_dns_0517.csv +11 -0
- pidsmaker/resources/ground_truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_drakon_0517.csv +6 -0
- pidsmaker/resources/ground_truth/orthrus/E5-THEIA/node_THEIA_1_Firefox_Drakon_APT_BinFmt_Elevate_Inject.csv +70 -0
- pidsmaker/resources/ground_truth/orthrus/E5-TRACE/node_Trace_Firefox_Drakon.csv +71 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m1.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m2.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m3.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m4.csv +5 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m5.csv +23 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_m6.csv +18 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_s1.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_s2.csv +1 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_s3.csv +16 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_edr/atlasv2_edr_s4.csv +22 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m1.csv +126 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m2.csv +105 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m3.csv +94 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m4.csv +139 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m5.csv +228 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_m6.csv +131 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_s1.csv +118 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_s2.csv +89 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_s3.csv +133 -0
- pidsmaker/resources/ground_truth/orthrus/atlasv2_h1/node_h1_s4.csv +135 -0
- pidsmaker/resources/ground_truth/orthrus/carbanakv2_edr/carbanakv2_edr.csv +2453 -0
- pidsmaker/resources/ground_truth/orthrus/h051/node_h051_0925.csv +114 -0
- pidsmaker/resources/ground_truth/orthrus/h201/node_h201_0923.csv +2905 -0
- pidsmaker/resources/ground_truth/orthrus/h501/node_h501_0924.csv +749 -0
- pidsmaker/resources/ground_truth/orthrus/readme.md +98 -0
- pidsmaker/resources/ground_truth/reapr/E3-CADETS/node_Nginx_Backdoor_06.csv +3 -0
- pidsmaker/resources/ground_truth/reapr/E3-CADETS/node_Nginx_Backdoor_12.csv +655 -0
- pidsmaker/resources/ground_truth/reapr/E3-CADETS/node_Nginx_Backdoor_13.csv +770 -0
- pidsmaker/resources/ground_truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +0 -0
- pidsmaker/resources/ground_truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +18 -0
- pidsmaker/resources/ground_truth/reapr/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +42 -0
- pidsmaker/resources/ground_truth/reapr/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +81 -0
- pidsmaker/resources/ground_truth/reapr/E3-TRACE/node_trace_e3_firefox_0410.csv +37 -0
- pidsmaker/resources/ground_truth/reapr/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +9 -0
- pidsmaker/resources/ground_truth/reapr/E3-TRACE/node_trace_e3_pine_0413.csv +40 -0
- pidsmaker/resources/ground_truth/threatrace/E3-CADETS/ground_truth.txt +12858 -0
- pidsmaker/resources/ground_truth/threatrace/E3-FIVEDIRECTIONS/ground_truth.txt +18420 -0
- pidsmaker/resources/ground_truth/threatrace/E3-THEIA/ground_truth.txt +25363 -0
- pidsmaker/resources/ground_truth/threatrace/E3-TRACE/ground_truth.txt +68265 -0
- pidsmaker/resources/ground_truth/threatrace/README.md +123 -0
- pidsmaker/tasks/__init__.py +10 -0
- pidsmaker/tasks/batching.py +47 -0
- pidsmaker/tasks/construction.py +31 -0
- pidsmaker/tasks/evaluation.py +241 -0
- pidsmaker/tasks/feat_inference.py +413 -0
- pidsmaker/tasks/featurization.py +43 -0
- pidsmaker/tasks/training.py +17 -0
- pidsmaker/tasks/transformation.py +306 -0
- pidsmaker/tasks/triage.py +143 -0
- pidsmaker/tgn.py +635 -0
- pidsmaker/tokenization/__init__.py +112 -0
- pidsmaker/tokenization/base.py +58 -0
- pidsmaker/tokenization/bpe_tokenizer.py +83 -0
- pidsmaker/tokenization/hf_tokenizer.py +61 -0
- pidsmaker/tokenization/hierarchical_tokenizer.py +44 -0
- pidsmaker/tokenization/label_tokenizer.py +24 -0
- pidsmaker/tokenization/nltk_tokenizer.py +84 -0
- pidsmaker/tokenization/substitution.py +295 -0
- pidsmaker/triage/__init__.py +0 -0
- pidsmaker/triage/tracing_methods/__init__.py +1 -0
- pidsmaker/triage/tracing_methods/depimpact.py +213 -0
- pidsmaker/triage/tracing_methods/depimpact_utils.py +537 -0
- pidsmaker/triage/tracing_methods/ocrapt_subgraph.py +267 -0
- pidsmaker/utils/__init__.py +0 -0
- pidsmaker/utils/cache_utils.py +256 -0
- pidsmaker/utils/console.py +282 -0
- pidsmaker/utils/data_utils.py +1742 -0
- pidsmaker/utils/database.py +150 -0
- pidsmaker/utils/dataset_utils.py +413 -0
- pidsmaker/utils/dataset_writer.py +570 -0
- pidsmaker/utils/graph_store.py +634 -0
- pidsmaker/utils/labelling.py +445 -0
- pidsmaker/utils/loss_files.py +193 -0
- pidsmaker/utils/process_tags.py +44 -0
- pidsmaker/utils/utils.py +712 -0
- pidsmaker/vizgen/__init__.py +1 -0
- pidsmaker/vizgen/backfill_manifests.py +100 -0
- pidsmaker/vizgen/dimensionality_reduction.py +249 -0
- pidsmaker/vizgen/embed_exporter.py +467 -0
- pidsmaker/vizgen/exporter.py +493 -0
- pidsmaker/vizgen/html_builder.py +936 -0
- pidsmaker/vizgen/web/__init__.py +1 -0
- pidsmaker/vizgen/web/export.py +62 -0
- pidsmaker/vizgen/web/static/css/app.css +250 -0
- pidsmaker/vizgen/web/static/index.html +182 -0
- pidsmaker/vizgen/web/static/js/app.js +627 -0
- pidsmaker/vizgen/web/static/js/campaign.js +123 -0
- pidsmaker/vizgen/web/static/js/data.js +119 -0
- pidsmaker/vizgen/web/static/js/dialogs.js +240 -0
- pidsmaker/vizgen/web/static/js/jobs.js +75 -0
- pidsmaker/vizgen/web/static/js/scene.js +651 -0
- pidsmaker/vizgen/web/static/js/ui.js +370 -0
- pidsmaker/vizgen/web/static/vendor/OrbitControls.js +1045 -0
- pidsmaker/vizgen/web/static/vendor/d3.v4.min.js +2 -0
- pidsmaker/vizgen/web/static/vendor/three.min.js +6 -0
- pidsmaker/vizgen/web/viz_server.py +2176 -0
- pidsmaker-5.0.0.dist-info/METADATA +597 -0
- pidsmaker-5.0.0.dist-info/RECORD +339 -0
- pidsmaker-5.0.0.dist-info/WHEEL +5 -0
- pidsmaker-5.0.0.dist-info/entry_points.txt +2 -0
- pidsmaker-5.0.0.dist-info/licenses/LICENSE +201 -0
- pidsmaker-5.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2100 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from datetime import date, timedelta
|
|
4
|
+
|
|
5
|
+
from .schemas import SCHEMAS
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _date_range(start, end):
|
|
9
|
+
"""Dates from `start` to `end` included, as YYYY-MM-DD strings."""
|
|
10
|
+
first, last = date.fromisoformat(start), date.fromisoformat(end)
|
|
11
|
+
return [str(first + timedelta(days=i)) for i in range((last - first).days + 1)]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
DATASET_DEFAULT_CONFIG = {
|
|
15
|
+
"THEIA_E5": {
|
|
16
|
+
"raw_dir": "",
|
|
17
|
+
"database": "theia_e5",
|
|
18
|
+
"database_all_file": "theia_e5",
|
|
19
|
+
"schema": "darpa_tc",
|
|
20
|
+
"timezone": "US/Eastern",
|
|
21
|
+
"start_date": "2019-05-08",
|
|
22
|
+
"end_date": "2019-05-18",
|
|
23
|
+
"train_dates": ["2019-05-08", "2019-05-09", "2019-05-10"],
|
|
24
|
+
"val_dates": ["2019-05-11"],
|
|
25
|
+
"test_dates": ["2019-05-14", "2019-05-15"],
|
|
26
|
+
"unused_dates": ["2019-05-12", "2019-05-13", "2019-05-16", "2019-05-17"],
|
|
27
|
+
"ground_truth_relative_path": [
|
|
28
|
+
"E5-THEIA/node_THEIA_1_Firefox_Drakon_APT_BinFmt_Elevate_Inject.csv"
|
|
29
|
+
],
|
|
30
|
+
"attack_to_time_window": [
|
|
31
|
+
[
|
|
32
|
+
"E5-THEIA/node_THEIA_1_Firefox_Drakon_APT_BinFmt_Elevate_Inject.csv",
|
|
33
|
+
"2019-05-15 14:47:00",
|
|
34
|
+
"2019-05-15 15:08:00",
|
|
35
|
+
],
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
"THEIA_E3": {
|
|
39
|
+
"raw_dir": "",
|
|
40
|
+
"database": "theia_e3",
|
|
41
|
+
"database_all_file": "theia_e3",
|
|
42
|
+
"schema": "darpa_tc",
|
|
43
|
+
"timezone": "US/Eastern",
|
|
44
|
+
"start_date": "2018-04-02",
|
|
45
|
+
"end_date": "2018-04-14",
|
|
46
|
+
"train_dates": [
|
|
47
|
+
"2018-04-02",
|
|
48
|
+
"2018-04-03",
|
|
49
|
+
"2018-04-04",
|
|
50
|
+
"2018-04-05",
|
|
51
|
+
"2018-04-06",
|
|
52
|
+
"2018-04-07",
|
|
53
|
+
"2018-04-08",
|
|
54
|
+
],
|
|
55
|
+
"val_dates": ["2018-04-09"],
|
|
56
|
+
"test_dates": ["2018-04-10", "2018-04-12", "2018-04-13"],
|
|
57
|
+
"unused_dates": ["2018-04-11"],
|
|
58
|
+
"ground_truth_relative_path": [
|
|
59
|
+
"E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv",
|
|
60
|
+
"E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv",
|
|
61
|
+
# "E3-THEIA/node_Phishing_E_mail_Executable_Attachment.csv", # attack failed so we don't use it
|
|
62
|
+
# "E3-THEIA/node_Phishing_E_mail_Link.csv" # attack only at network level, not system
|
|
63
|
+
],
|
|
64
|
+
"attack_to_time_window": [
|
|
65
|
+
[
|
|
66
|
+
"E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv",
|
|
67
|
+
"2018-04-12 12:40:00",
|
|
68
|
+
"2018-04-12 13:30:00",
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv",
|
|
72
|
+
"2018-04-10 14:30:00",
|
|
73
|
+
"2018-04-10 15:00:00",
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
"CADETS_E5": {
|
|
78
|
+
"raw_dir": "",
|
|
79
|
+
"database": "cadets_e5",
|
|
80
|
+
"database_all_file": "cadets_e5",
|
|
81
|
+
"schema": "darpa_tc",
|
|
82
|
+
"timezone": "US/Eastern",
|
|
83
|
+
"start_date": "2019-05-08",
|
|
84
|
+
"end_date": "2019-05-18",
|
|
85
|
+
"train_dates": ["2019-05-08", "2019-05-09", "2019-05-11"],
|
|
86
|
+
"val_dates": ["2019-05-12"],
|
|
87
|
+
"test_dates": ["2019-05-16", "2019-05-17"],
|
|
88
|
+
"unused_dates": ["2019-05-15", "2019-05-10", "2019-05-13", "2019-05-14"],
|
|
89
|
+
"ground_truth_relative_path": [
|
|
90
|
+
"E5-CADETS/node_Nginx_Drakon_APT.csv",
|
|
91
|
+
"E5-CADETS/node_Nginx_Drakon_APT_17.csv",
|
|
92
|
+
],
|
|
93
|
+
"attack_to_time_window": [
|
|
94
|
+
["E5-CADETS/node_Nginx_Drakon_APT.csv", "2019-05-16 09:31:00", "2019-05-16 10:12:00"],
|
|
95
|
+
[
|
|
96
|
+
"E5-CADETS/node_Nginx_Drakon_APT_17.csv",
|
|
97
|
+
"2019-05-17 10:15:00",
|
|
98
|
+
"2019-05-17 15:33:00",
|
|
99
|
+
],
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
"CADETS_E3": {
|
|
103
|
+
"raw_dir": "",
|
|
104
|
+
"database": "cadets_e3",
|
|
105
|
+
"database_all_file": "cadets_e3",
|
|
106
|
+
"schema": "darpa_tc",
|
|
107
|
+
"timezone": "US/Eastern",
|
|
108
|
+
"start_date": "2018-04-02",
|
|
109
|
+
"end_date": "2018-04-14",
|
|
110
|
+
"train_dates": [
|
|
111
|
+
"2018-04-02",
|
|
112
|
+
"2018-04-03",
|
|
113
|
+
"2018-04-04",
|
|
114
|
+
"2018-04-05",
|
|
115
|
+
"2018-04-07",
|
|
116
|
+
"2018-04-08",
|
|
117
|
+
"2018-04-09",
|
|
118
|
+
],
|
|
119
|
+
"val_dates": ["2018-04-10"],
|
|
120
|
+
"test_dates": ["2018-04-06", "2018-04-11", "2018-04-12", "2018-04-13"],
|
|
121
|
+
"unused_dates": [],
|
|
122
|
+
"ground_truth_relative_path": [
|
|
123
|
+
# "E3-CADETS/node_E_mail_Server.csv",
|
|
124
|
+
"E3-CADETS/node_Nginx_Backdoor_06.csv",
|
|
125
|
+
# "E3-CADETS/node_Nginx_Backdoor_11.csv",
|
|
126
|
+
"E3-CADETS/node_Nginx_Backdoor_12.csv",
|
|
127
|
+
"E3-CADETS/node_Nginx_Backdoor_13.csv",
|
|
128
|
+
],
|
|
129
|
+
"attack_to_time_window": [
|
|
130
|
+
["E3-CADETS/node_Nginx_Backdoor_06.csv", "2018-04-06 11:20:00", "2018-04-06 12:09:00"],
|
|
131
|
+
# ["E3-CADETS/node_Nginx_Backdoor_11.csv" , '2018-04-11 15:07:00', '2018-04-11 15:16:00'],
|
|
132
|
+
["E3-CADETS/node_Nginx_Backdoor_12.csv", "2018-04-12 13:59:00", "2018-04-12 14:39:00"],
|
|
133
|
+
["E3-CADETS/node_Nginx_Backdoor_13.csv", "2018-04-13 09:03:00", "2018-04-13 09:16:00"],
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
"CLEARSCOPE_E5": {
|
|
137
|
+
"raw_dir": "",
|
|
138
|
+
"database": "clearscope_e5",
|
|
139
|
+
"database_all_file": "clearscope_e5",
|
|
140
|
+
"schema": "darpa_tc",
|
|
141
|
+
"timezone": "US/Eastern",
|
|
142
|
+
"start_date": "2019-05-08",
|
|
143
|
+
"end_date": "2019-05-18",
|
|
144
|
+
"train_dates": ["2019-05-08", "2019-05-09", "2019-05-10", "2019-05-11", "2019-05-12"],
|
|
145
|
+
"val_dates": ["2019-05-13"],
|
|
146
|
+
"test_dates": ["2019-05-14", "2019-05-15", "2019-05-17"],
|
|
147
|
+
"unused_dates": ["2019-05-16"],
|
|
148
|
+
"ground_truth_relative_path": [
|
|
149
|
+
"E5-CLEARSCOPE/node_clearscope_e5_appstarter_0515.csv",
|
|
150
|
+
# "E5-CLEARSCOPE/node_clearscope_e5_firefox_0517.csv",
|
|
151
|
+
# "E5-CLEARSCOPE/node_clearscope_e5_lockwatch_0517.csv",
|
|
152
|
+
"E5-CLEARSCOPE/node_clearscope_e5_tester_0517.csv",
|
|
153
|
+
],
|
|
154
|
+
"attack_to_time_window": [
|
|
155
|
+
[
|
|
156
|
+
"E5-CLEARSCOPE/node_clearscope_e5_appstarter_0515.csv",
|
|
157
|
+
"2019-05-15 15:38:00",
|
|
158
|
+
"2019-05-15 16:19:00",
|
|
159
|
+
],
|
|
160
|
+
# ["E5-CLEARSCOPE/node_clearscope_e5_firefox_0517.csv", '2019-05-17 11:49:00', '2019-05-17 15:32:00'],
|
|
161
|
+
# ["E5-CLEARSCOPE/node_clearscope_e5_lockwatch_0517.csv", "2019-05-17 15:48:00", "2019-05-17 16:01:00"],
|
|
162
|
+
[
|
|
163
|
+
"E5-CLEARSCOPE/node_clearscope_e5_tester_0517.csv",
|
|
164
|
+
"2019-05-17 16:20:00",
|
|
165
|
+
"2019-05-17 16:28:00",
|
|
166
|
+
],
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
"CLEARSCOPE_E3": {
|
|
170
|
+
"raw_dir": "",
|
|
171
|
+
"database": "clearscope_e3",
|
|
172
|
+
"database_all_file": "clearscope_e3",
|
|
173
|
+
"schema": "darpa_tc",
|
|
174
|
+
"timezone": "US/Eastern",
|
|
175
|
+
"start_date": "2018-04-02",
|
|
176
|
+
"end_date": "2018-04-14",
|
|
177
|
+
"train_dates": [
|
|
178
|
+
"2018-04-03",
|
|
179
|
+
"2018-04-04",
|
|
180
|
+
"2018-04-05",
|
|
181
|
+
"2018-04-07",
|
|
182
|
+
"2018-04-08",
|
|
183
|
+
"2018-04-09",
|
|
184
|
+
"2018-04-10",
|
|
185
|
+
],
|
|
186
|
+
"val_dates": ["2018-04-02"],
|
|
187
|
+
"test_dates": ["2018-04-11", "2018-04-12"],
|
|
188
|
+
"unused_dates": ["2018-04-06", "2018-04-13"],
|
|
189
|
+
"ground_truth_relative_path": [
|
|
190
|
+
"E3-CLEARSCOPE/node_clearscope_e3_firefox_0411.csv",
|
|
191
|
+
# "E3-CLEARSCOPE/node_clearscope_e3_firefox_0412.csv", # due to malicious file downloaded but failed to exec and feture missing, there is no malicious nodes found in database
|
|
192
|
+
],
|
|
193
|
+
"attack_to_time_window": [
|
|
194
|
+
[
|
|
195
|
+
"E3-CLEARSCOPE/node_clearscope_e3_firefox_0411.csv",
|
|
196
|
+
"2018-04-11 13:54:00",
|
|
197
|
+
"2018-04-11 14:48:00",
|
|
198
|
+
],
|
|
199
|
+
# ["E3-CLEARSCOPE/node_clearscope_e3_firefox_0412.csv", '2018-04-12 15:18:00', '2018-04-12 15:25:00'],
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
"optc_h201": {
|
|
203
|
+
"raw_dir": "",
|
|
204
|
+
"database": "optc_201",
|
|
205
|
+
"database_all_file": "optc_201",
|
|
206
|
+
"schema": "optc",
|
|
207
|
+
"timezone": "Etc/GMT+4",
|
|
208
|
+
"start_date": "2019-09-15",
|
|
209
|
+
"end_date": "2019-09-26",
|
|
210
|
+
"train_dates": ["2019-09-19", "2019-09-20", "2019-09-21"],
|
|
211
|
+
"val_dates": ["2019-09-22"],
|
|
212
|
+
"test_dates": ["2019-09-23", "2019-09-24", "2019-09-25"],
|
|
213
|
+
"unused_dates": ["2019-09-16", "2019-09-17", "2019-09-18"],
|
|
214
|
+
"ground_truth_relative_path": [
|
|
215
|
+
"h201/node_h201_0923.csv",
|
|
216
|
+
],
|
|
217
|
+
"attack_to_time_window": [
|
|
218
|
+
["h201/node_h201_0923.csv", "2019-09-23 11:23:00", "2019-09-23 13:25:00"],
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
"optc_h501": {
|
|
222
|
+
"raw_dir": "",
|
|
223
|
+
"database": "optc_501",
|
|
224
|
+
"database_all_file": "optc_501",
|
|
225
|
+
"schema": "optc",
|
|
226
|
+
"timezone": "Etc/GMT+4",
|
|
227
|
+
"start_date": "2019-09-15",
|
|
228
|
+
"end_date": "2019-09-26",
|
|
229
|
+
"train_dates": ["2019-09-19", "2019-09-20", "2019-09-21"],
|
|
230
|
+
"val_dates": ["2019-09-22"],
|
|
231
|
+
"test_dates": ["2019-09-23", "2019-09-24", "2019-09-25"],
|
|
232
|
+
"unused_dates": ["2019-09-16", "2019-09-17", "2019-09-18"],
|
|
233
|
+
"ground_truth_relative_path": [
|
|
234
|
+
"h501/node_h501_0924.csv",
|
|
235
|
+
],
|
|
236
|
+
"attack_to_time_window": [
|
|
237
|
+
["h501/node_h501_0924.csv", "2019-09-24 10:28:00", "2019-09-24 15:29:00"],
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
"optc_h051": {
|
|
241
|
+
"raw_dir": "",
|
|
242
|
+
"database": "optc_051",
|
|
243
|
+
"database_all_file": "optc_051",
|
|
244
|
+
"schema": "optc",
|
|
245
|
+
"timezone": "Etc/GMT+4",
|
|
246
|
+
"start_date": "2019-09-15",
|
|
247
|
+
"end_date": "2019-09-26",
|
|
248
|
+
"train_dates": ["2019-09-19", "2019-09-20", "2019-09-21"],
|
|
249
|
+
"val_dates": ["2019-09-22"],
|
|
250
|
+
"test_dates": ["2019-09-23", "2019-09-24", "2019-09-25"],
|
|
251
|
+
"unused_dates": ["2019-09-16", "2019-09-17", "2019-09-18"],
|
|
252
|
+
"ground_truth_relative_path": [
|
|
253
|
+
"h051/node_h051_0925.csv",
|
|
254
|
+
],
|
|
255
|
+
"attack_to_time_window": [
|
|
256
|
+
["h051/node_h051_0925.csv", "2019-09-25 10:29:00", "2019-09-25 14:25:00"],
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
"TRACE_E5": {
|
|
260
|
+
"raw_dir": "",
|
|
261
|
+
"database": "trace_e5",
|
|
262
|
+
"database_all_file": "trace_e5",
|
|
263
|
+
"schema": "darpa_tc",
|
|
264
|
+
"timezone": "US/Eastern",
|
|
265
|
+
"start_date": "2019-05-08",
|
|
266
|
+
"end_date": "2019-05-18",
|
|
267
|
+
"train_dates": ["2019-05-08", "2019-05-09", "2019-05-10", "2019-05-11", "2019-05-12"],
|
|
268
|
+
"val_dates": ["2019-05-13"],
|
|
269
|
+
"test_dates": ["2019-05-14", "2019-05-15"],
|
|
270
|
+
"unused_dates": ["2019-05-16", "2019-05-17"],
|
|
271
|
+
"ground_truth_relative_path": [
|
|
272
|
+
"E5-TRACE/node_Trace_Firefox_Drakon.csv",
|
|
273
|
+
],
|
|
274
|
+
"attack_to_time_window": [
|
|
275
|
+
[
|
|
276
|
+
"E5-TRACE/node_Trace_Firefox_Drakon.csv",
|
|
277
|
+
"2019-05-14 10:17:00",
|
|
278
|
+
"2019-05-14 11:45:00",
|
|
279
|
+
],
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
"TRACE_E3": {
|
|
283
|
+
"raw_dir": "",
|
|
284
|
+
"database": "trace_e3",
|
|
285
|
+
"database_all_file": "trace_e3",
|
|
286
|
+
"schema": "darpa_tc",
|
|
287
|
+
"timezone": "US/Eastern",
|
|
288
|
+
"start_date": "2018-04-02",
|
|
289
|
+
"end_date": "2018-04-14",
|
|
290
|
+
"train_dates": [
|
|
291
|
+
"2018-04-02",
|
|
292
|
+
"2018-04-03",
|
|
293
|
+
"2018-04-04",
|
|
294
|
+
"2018-04-05",
|
|
295
|
+
"2018-04-06",
|
|
296
|
+
"2018-04-07",
|
|
297
|
+
"2018-04-08",
|
|
298
|
+
],
|
|
299
|
+
"val_dates": ["2018-04-09",],
|
|
300
|
+
"test_dates": [
|
|
301
|
+
"2018-04-10",
|
|
302
|
+
"2018-04-11",
|
|
303
|
+
"2018-04-12",
|
|
304
|
+
"2018-04-13",
|
|
305
|
+
],
|
|
306
|
+
"unused_dates": [],
|
|
307
|
+
"ground_truth_relative_path": [
|
|
308
|
+
"E3-TRACE/node_trace_e3_firefox_0410.csv",
|
|
309
|
+
"E3-TRACE/node_trace_e3_phishing_executable_0413.csv",
|
|
310
|
+
"E3-TRACE/node_trace_e3_pine_0413.csv",
|
|
311
|
+
],
|
|
312
|
+
"attack_to_time_window": [
|
|
313
|
+
[
|
|
314
|
+
"E3-TRACE/node_trace_e3_firefox_0410.csv",
|
|
315
|
+
"2018-04-10 09:45:00",
|
|
316
|
+
"2018-04-10 11:10:00",
|
|
317
|
+
],
|
|
318
|
+
[
|
|
319
|
+
"E3-TRACE/node_trace_e3_phishing_executable_0413.csv",
|
|
320
|
+
"2018-04-13 14:14:00",
|
|
321
|
+
"2018-04-13 14:29:00",
|
|
322
|
+
],
|
|
323
|
+
["E3-TRACE/node_trace_e3_pine_0413.csv", "2018-04-13 12:42:00", "2018-04-13 12:54:00"],
|
|
324
|
+
],
|
|
325
|
+
},
|
|
326
|
+
"FIVEDIRECTIONS_E5": {
|
|
327
|
+
"raw_dir": "",
|
|
328
|
+
"database": "fivedirections_e5",
|
|
329
|
+
"database_all_file": "fivedirections_e5",
|
|
330
|
+
"schema": "darpa_tc",
|
|
331
|
+
"timezone": "US/Eastern",
|
|
332
|
+
"start_date": "2019-05-08",
|
|
333
|
+
"end_date": "2019-05-18",
|
|
334
|
+
"train_dates": ["2019-05-08", "2019-05-10", "2019-05-11", "2019-05-13", "2019-05-14"],
|
|
335
|
+
"val_dates": ["2019-05-12"],
|
|
336
|
+
"test_dates": [
|
|
337
|
+
"2019-05-09",
|
|
338
|
+
"2019-05-15",
|
|
339
|
+
"2019-05-17",
|
|
340
|
+
],
|
|
341
|
+
"unused_dates": ["2019-05-16"],
|
|
342
|
+
"ground_truth_relative_path": [
|
|
343
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_bits_0515.csv",
|
|
344
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_copykatz_0509.csv",
|
|
345
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_dns_0517.csv",
|
|
346
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_drakon_0517.csv",
|
|
347
|
+
],
|
|
348
|
+
"attack_to_time_window": [
|
|
349
|
+
[
|
|
350
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_bits_0515.csv",
|
|
351
|
+
"2019-05-15 13:14:00",
|
|
352
|
+
"2019-05-15 13:35:00",
|
|
353
|
+
],
|
|
354
|
+
[
|
|
355
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_copykatz_0509.csv",
|
|
356
|
+
"2019-05-09 13:25:00",
|
|
357
|
+
"2019-05-09 13:57:00",
|
|
358
|
+
],
|
|
359
|
+
[
|
|
360
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_dns_0517.csv",
|
|
361
|
+
"2019-05-17 12:46:00",
|
|
362
|
+
"2019-05-17 12:57:00",
|
|
363
|
+
],
|
|
364
|
+
[
|
|
365
|
+
"E5-FIVEDIRECTIONS/node_fivedirections_e5_drakon_0517.csv",
|
|
366
|
+
"2019-05-17 16:10:00",
|
|
367
|
+
"2019-05-17 16:16:00",
|
|
368
|
+
],
|
|
369
|
+
],
|
|
370
|
+
},
|
|
371
|
+
"FIVEDIRECTIONS_E3": {
|
|
372
|
+
"raw_dir": "",
|
|
373
|
+
"database": "fivedirections_e3",
|
|
374
|
+
"database_all_file": "fivedirections_e3",
|
|
375
|
+
"schema": "darpa_tc",
|
|
376
|
+
"timezone": "US/Eastern",
|
|
377
|
+
"start_date": "2018-04-02",
|
|
378
|
+
"end_date": "2018-04-14",
|
|
379
|
+
"train_dates": [
|
|
380
|
+
"2018-04-03",
|
|
381
|
+
"2018-04-05",
|
|
382
|
+
"2018-04-06",
|
|
383
|
+
"2018-04-07",
|
|
384
|
+
"2018-04-08",
|
|
385
|
+
"2018-04-10",
|
|
386
|
+
"2018-04-13",
|
|
387
|
+
],
|
|
388
|
+
"val_dates": ["2018-04-04"],
|
|
389
|
+
"test_dates": ["2018-04-09", "2018-04-11"],
|
|
390
|
+
"unused_dates": ["2018-04-12"],
|
|
391
|
+
"ground_truth_relative_path": [
|
|
392
|
+
"E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv",
|
|
393
|
+
# "E3-FIVEDIRECTIONS/node_fivedirections_e3_browser_0412.csv",
|
|
394
|
+
"E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv",
|
|
395
|
+
],
|
|
396
|
+
"attack_to_time_window": [
|
|
397
|
+
[
|
|
398
|
+
"E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv",
|
|
399
|
+
"2018-04-11 09:59:00",
|
|
400
|
+
"2018-04-11 10:41:00",
|
|
401
|
+
],
|
|
402
|
+
# ["E3-FIVEDIRECTIONS/node_fivedirections_e3_browser_0412.csv", '2018-04-12 11:12:00', '2018-04-12 11:15:00'],
|
|
403
|
+
[
|
|
404
|
+
"E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv",
|
|
405
|
+
"2018-04-09 15:06:00",
|
|
406
|
+
"2018-04-09 15:43:00",
|
|
407
|
+
],
|
|
408
|
+
],
|
|
409
|
+
},
|
|
410
|
+
"PROVENANCE_BENIGN": {
|
|
411
|
+
"raw_dir": "",
|
|
412
|
+
"database": "PROVENANCE_BENIGN",
|
|
413
|
+
"database_all_file": "PROVENANCE_BENIGN",
|
|
414
|
+
"schema": "darpa_tc",
|
|
415
|
+
"timezone": "UTC",
|
|
416
|
+
"start_date": "2026-03-16",
|
|
417
|
+
"end_date": "2026-03-16",
|
|
418
|
+
"train_dates": ["2026-03-16"],
|
|
419
|
+
"val_dates": ["2026-03-16"],
|
|
420
|
+
"test_dates": ["2026-03-16"],
|
|
421
|
+
"unused_dates": [],
|
|
422
|
+
"ground_truth_relative_path": [],
|
|
423
|
+
"attack_to_time_window": [],
|
|
424
|
+
},
|
|
425
|
+
# See https://arxiv.org/pdf/2401.01341
|
|
426
|
+
"ATLASV2_EDR": {
|
|
427
|
+
"raw_dir": "",
|
|
428
|
+
"database": "atlasv2_edr",
|
|
429
|
+
"database_all_file": "atlasv2_edr",
|
|
430
|
+
"schema": "carbon_black_edr",
|
|
431
|
+
"timezone": "US/Central",
|
|
432
|
+
"start_date": "2022-07-15",
|
|
433
|
+
"end_date": "2022-07-21",
|
|
434
|
+
"train_dates": [
|
|
435
|
+
"2022-07-16",
|
|
436
|
+
# Arbitrarly picked 2022-07-17 for the validation/threshold calibration
|
|
437
|
+
"2022-07-18",
|
|
438
|
+
],
|
|
439
|
+
"val_dates": [
|
|
440
|
+
"2022-07-17"
|
|
441
|
+
],
|
|
442
|
+
"test_dates": [
|
|
443
|
+
"2022-07-19",
|
|
444
|
+
"2022-07-20"
|
|
445
|
+
],
|
|
446
|
+
"unused_dates": [
|
|
447
|
+
"2022-07-15"
|
|
448
|
+
],
|
|
449
|
+
"ground_truth_relative_path": [
|
|
450
|
+
"atlasv2_edr/atlasv2_edr_s1.csv",
|
|
451
|
+
"atlasv2_edr/atlasv2_edr_s2.csv",
|
|
452
|
+
"atlasv2_edr/atlasv2_edr_s3.csv",
|
|
453
|
+
"atlasv2_edr/atlasv2_edr_s4.csv",
|
|
454
|
+
"atlasv2_edr/atlasv2_edr_m1.csv",
|
|
455
|
+
"atlasv2_edr/atlasv2_edr_m2.csv",
|
|
456
|
+
"atlasv2_edr/atlasv2_edr_m3.csv",
|
|
457
|
+
"atlasv2_edr/atlasv2_edr_m4.csv",
|
|
458
|
+
"atlasv2_edr/atlasv2_edr_m5.csv",
|
|
459
|
+
"atlasv2_edr/atlasv2_edr_m6.csv",
|
|
460
|
+
],
|
|
461
|
+
"attack_to_time_window": [
|
|
462
|
+
# NOTE: the reported attack windows are somewhat inaccurate (i.e., the first and last
|
|
463
|
+
# true-positive malicious alerts occur OUTSIDE the reported attack windows), so we start
|
|
464
|
+
# at 2022-07-19 13:00:00 (Rather than 2022-07-19 13:12:00) and end at
|
|
465
|
+
# 2022-07-20 01:15:00 (Rather than 2022-07-20 01:00:00) to capture all of the true
|
|
466
|
+
# positives.
|
|
467
|
+
["atlasv2_edr/atlasv2_edr_s1.csv", "2022-07-19 13:00:00", "2022-07-19 13:40:00"],
|
|
468
|
+
["atlasv2_edr/atlasv2_edr_s2.csv", "2022-07-19 13:45:00", "2022-07-19 14:20:00"],
|
|
469
|
+
["atlasv2_edr/atlasv2_edr_s3.csv", "2022-07-19 14:20:00", "2022-07-19 15:05:00"],
|
|
470
|
+
["atlasv2_edr/atlasv2_edr_s4.csv", "2022-07-20 00:31:00", "2022-07-20 01:15:00"],
|
|
471
|
+
["atlasv2_edr/atlasv2_edr_m1.csv", "2022-07-19 16:00:00", "2022-07-19 17:50:00"],
|
|
472
|
+
["atlasv2_edr/atlasv2_edr_m2.csv", "2022-07-19 19:32:00", "2022-07-19 20:02:00"],
|
|
473
|
+
["atlasv2_edr/atlasv2_edr_m3.csv", "2022-07-19 20:06:00", "2022-07-19 20:40:00"],
|
|
474
|
+
["atlasv2_edr/atlasv2_edr_m4.csv", "2022-07-19 22:31:00", "2022-07-19 23:04:00"],
|
|
475
|
+
["atlasv2_edr/atlasv2_edr_m5.csv", "2022-07-19 23:16:00", "2022-07-19 23:46:00"],
|
|
476
|
+
["atlasv2_edr/atlasv2_edr_m6.csv", "2022-07-19 23:54:00", "2022-07-20 00:27:00"],
|
|
477
|
+
],
|
|
478
|
+
},
|
|
479
|
+
# See https://www.ndss-symposium.org/wp-content/uploads/prism2026-12.pdf
|
|
480
|
+
"CARBANAKV2_EDR": {
|
|
481
|
+
"raw_dir": "",
|
|
482
|
+
"database": "carbanakv2_edr",
|
|
483
|
+
"database_all_file": "carbanakv2_edr",
|
|
484
|
+
"schema": "carbon_black_edr",
|
|
485
|
+
"timezone": "US/Central",
|
|
486
|
+
"start_date": "2024-04-18",
|
|
487
|
+
"end_date": "2024-05-13",
|
|
488
|
+
"train_dates": [
|
|
489
|
+
"2024-04-20",
|
|
490
|
+
"2024-04-21",
|
|
491
|
+
# Arbitrarly picked 2024-04-22 for the validation/threshold calibration
|
|
492
|
+
"2024-04-23",
|
|
493
|
+
"2024-04-24",
|
|
494
|
+
"2024-04-25",
|
|
495
|
+
# Arbitrarly picked 2024-04-26 for the validation/threshold calibration
|
|
496
|
+
"2024-04-27",
|
|
497
|
+
"2024-04-28",
|
|
498
|
+
"2024-04-29",
|
|
499
|
+
],
|
|
500
|
+
"val_dates": [
|
|
501
|
+
"2024-04-22",
|
|
502
|
+
"2024-04-26",
|
|
503
|
+
],
|
|
504
|
+
"test_dates": [
|
|
505
|
+
"2024-04-30",
|
|
506
|
+
"2024-05-01",
|
|
507
|
+
"2024-05-02",
|
|
508
|
+
"2024-05-07",
|
|
509
|
+
"2024-05-08",
|
|
510
|
+
"2024-05-09",
|
|
511
|
+
"2024-05-10",
|
|
512
|
+
],
|
|
513
|
+
"unused_dates": [
|
|
514
|
+
"2024-04-18",
|
|
515
|
+
"2024-04-19",
|
|
516
|
+
"2024-05-03",
|
|
517
|
+
"2024-05-04",
|
|
518
|
+
"2024-05-05",
|
|
519
|
+
"2024-05-06",
|
|
520
|
+
"2024-05-11",
|
|
521
|
+
"2024-05-12",
|
|
522
|
+
"2024-05-13",
|
|
523
|
+
],
|
|
524
|
+
"ground_truth_relative_path": [
|
|
525
|
+
"carbanakv2_edr/carbanakv2_edr.csv",
|
|
526
|
+
],
|
|
527
|
+
"attack_to_time_window": [
|
|
528
|
+
["carbanakv2_edr/carbanakv2_edr.csv", "2024-04-30 17:30:00", "2024-05-10 20:30:00"]
|
|
529
|
+
],
|
|
530
|
+
},
|
|
531
|
+
# LANL "Comprehensive, Multi-Source Cyber-Security Events" (Kent, 2015): NTLM authentications
|
|
532
|
+
# between computers, as in Euler, Argus, Jbeil and LARES. LANL timestamps are seconds from an
|
|
533
|
+
# undisclosed origin: they are mapped to synthetic dates such that the first red team event
|
|
534
|
+
# (t=150885) starts on 2015-01-03, i.e. the two first days are benign
|
|
535
|
+
# (see `dataset_preprocessing/lanl/create_database_lanl.py`). The test period covers all the
|
|
536
|
+
# red team events (2015-01-03 to 2015-01-30), as Euler (Argus uses the first 14 days).
|
|
537
|
+
"LANL": {
|
|
538
|
+
"raw_dir": "",
|
|
539
|
+
"database": "lanl",
|
|
540
|
+
"database_all_file": "lanl",
|
|
541
|
+
"schema": "lanl_auth",
|
|
542
|
+
"timezone": "UTC",
|
|
543
|
+
"start_date": "2015-01-01",
|
|
544
|
+
"end_date": "2015-02-28",
|
|
545
|
+
"train_dates": ["2015-01-01"],
|
|
546
|
+
"val_dates": ["2015-01-02"],
|
|
547
|
+
"test_dates": _date_range("2015-01-03", "2015-01-30"),
|
|
548
|
+
"unused_dates": _date_range("2015-01-31", "2015-02-28"),
|
|
549
|
+
# Labels are those of the events in the database (red team events of redteam.txt)
|
|
550
|
+
"ground_truth_relative_path": [],
|
|
551
|
+
"attack_to_time_window": [],
|
|
552
|
+
# Root source of the attacks (index ID), whose malicious edges are the positives of
|
|
553
|
+
# LARES' evaluation (`host_two_stage_evaluation.root_attack_nodes: dataset`)
|
|
554
|
+
"root_attack_nodes": [9660],
|
|
555
|
+
},
|
|
556
|
+
# DARPA OpTC network flows (FLOW START and FLOW MESSAGE events between all hosts), in the version
|
|
557
|
+
# preprocessed and labelled by LARES, with the real timestamps of OpTC
|
|
558
|
+
# (see `dataset_preprocessing/optc/create_database_optc_net.py`).
|
|
559
|
+
"OPTC_NET": {
|
|
560
|
+
"raw_dir": "",
|
|
561
|
+
"database": "optc_net",
|
|
562
|
+
"database_all_file": "optc_net",
|
|
563
|
+
"schema": "optc_flows",
|
|
564
|
+
"timezone": "Etc/GMT+4",
|
|
565
|
+
"start_date": "2019-09-16",
|
|
566
|
+
"end_date": "2019-09-25",
|
|
567
|
+
"train_dates": _date_range("2019-09-16", "2019-09-21"),
|
|
568
|
+
"val_dates": ["2019-09-22"],
|
|
569
|
+
"test_dates": _date_range("2019-09-23", "2019-09-25"),
|
|
570
|
+
"unused_dates": [],
|
|
571
|
+
# Labels are those of the events in the database (malicious flows labelled by LARES)
|
|
572
|
+
"ground_truth_relative_path": [],
|
|
573
|
+
"attack_to_time_window": [],
|
|
574
|
+
# Root sources of the attacks (LARES host IDs), see the `LANL` entry
|
|
575
|
+
"root_attack_nodes": [201, 402, 501],
|
|
576
|
+
},
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
# Arguments
|
|
580
|
+
|
|
581
|
+
TASK_DEPENDENCIES = {
|
|
582
|
+
"construction": [],
|
|
583
|
+
"transformation": ["construction"],
|
|
584
|
+
"featurization": ["transformation"],
|
|
585
|
+
"feat_inference": ["featurization"],
|
|
586
|
+
"batching": ["feat_inference"],
|
|
587
|
+
"training": ["batching"],
|
|
588
|
+
"evaluation": ["training"],
|
|
589
|
+
"triage": ["evaluation"],
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
class AND(list):
|
|
594
|
+
pass
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
class OR(list):
|
|
598
|
+
pass
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
class Arg:
|
|
602
|
+
def __init__(self, type, vals: list = None, desc: str = None):
|
|
603
|
+
self.type = type
|
|
604
|
+
self.vals = vals
|
|
605
|
+
self.desc = desc
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
def _node_label_features_cfg():
|
|
609
|
+
"""`construction.node_label_features` args: one per node type of all schemas, in id order."""
|
|
610
|
+
args = {}
|
|
611
|
+
for schema in SCHEMAS.values():
|
|
612
|
+
for nt in sorted(schema.node_types, key=lambda nt: nt.id):
|
|
613
|
+
if nt.name in args:
|
|
614
|
+
continue
|
|
615
|
+
args[nt.name] = Arg(
|
|
616
|
+
str,
|
|
617
|
+
vals=AND(nt.label_choices()),
|
|
618
|
+
desc=f"Attributes of `{nt.name}` nodes used as node labels (concatenated): "
|
|
619
|
+
f"{', '.join(nt.attributes)}. `type` adds the node type, and `auto` uses "
|
|
620
|
+
"the type-specific default label, only made of non-null attributes.",
|
|
621
|
+
)
|
|
622
|
+
return args
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
NODE_LABEL_FEATURES_CFG = _node_label_features_cfg()
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
FEATURIZATIONS_CFG = {
|
|
629
|
+
"word2vec": {
|
|
630
|
+
"alpha": Arg(float),
|
|
631
|
+
"window_size": Arg(int),
|
|
632
|
+
"min_count": Arg(int),
|
|
633
|
+
"use_skip_gram": Arg(bool),
|
|
634
|
+
"num_workers": Arg(int),
|
|
635
|
+
"epochs": Arg(int),
|
|
636
|
+
"compute_loss": Arg(bool),
|
|
637
|
+
"negative": Arg(int),
|
|
638
|
+
"decline_rate": Arg(int),
|
|
639
|
+
},
|
|
640
|
+
"doc2vec": {
|
|
641
|
+
"include_neighbors": Arg(
|
|
642
|
+
bool,
|
|
643
|
+
desc="Whether the document of a node also contains the labels of its successors.",
|
|
644
|
+
),
|
|
645
|
+
"truncate_process_name": Arg(
|
|
646
|
+
bool,
|
|
647
|
+
desc="Whether the features of processes are computed from the directory of their \
|
|
648
|
+
executable only, without its name nor the rest of their label (as in R-Caid, \
|
|
649
|
+
whose `predict_process_tag` objective predicts the name).",
|
|
650
|
+
),
|
|
651
|
+
"epochs": Arg(int),
|
|
652
|
+
"alpha": Arg(float),
|
|
653
|
+
"workers": Arg(
|
|
654
|
+
int,
|
|
655
|
+
desc="Number of threads training Doc2Vec. Training is deterministic only with 1.",
|
|
656
|
+
),
|
|
657
|
+
},
|
|
658
|
+
# Whole-graph embedding of each time window (ProGrapher), see featurization_graph2vec.py
|
|
659
|
+
"graph2vec": {
|
|
660
|
+
"wl_iterations": Arg(
|
|
661
|
+
int,
|
|
662
|
+
desc="Depth D of the Weisfeiler-Lehman rooted subgraphs (RSGs) of each node, built from \
|
|
663
|
+
node and edge types (ProGrapher: 3 on small graphs, 4 on large ones).",
|
|
664
|
+
),
|
|
665
|
+
"negative": Arg(int, desc="Number of negative RSGs sampled per RSG (PV-DBOW)."),
|
|
666
|
+
"min_count": Arg(int, desc="RSGs seen fewer times in the training snapshots are ignored."),
|
|
667
|
+
"alpha": Arg(float, desc="Initial learning rate of doc2vec."),
|
|
668
|
+
"infer_epochs": Arg(
|
|
669
|
+
int,
|
|
670
|
+
desc="Epochs to infer the embedding of each snapshot (all splits) from the trained RSG vectors.",
|
|
671
|
+
),
|
|
672
|
+
"num_workers": Arg(
|
|
673
|
+
int,
|
|
674
|
+
desc="Processes extracting RSGs and inferring embeddings, and threads of doc2vec \
|
|
675
|
+
training (training is only deterministic with 1).",
|
|
676
|
+
),
|
|
677
|
+
},
|
|
678
|
+
"fasttext": {
|
|
679
|
+
"min_count": Arg(int),
|
|
680
|
+
"alpha": Arg(float),
|
|
681
|
+
"window_size": Arg(int),
|
|
682
|
+
"negative": Arg(int),
|
|
683
|
+
"num_workers": Arg(int),
|
|
684
|
+
"use_pretrained_fb_model": Arg(bool),
|
|
685
|
+
},
|
|
686
|
+
"alacarte": {
|
|
687
|
+
"walk_length": Arg(int),
|
|
688
|
+
"num_walks": Arg(int),
|
|
689
|
+
"epochs": Arg(int),
|
|
690
|
+
"context_window_size": Arg(int),
|
|
691
|
+
"min_count": Arg(int),
|
|
692
|
+
"use_skip_gram": Arg(bool),
|
|
693
|
+
"num_workers": Arg(int),
|
|
694
|
+
"compute_loss": Arg(bool),
|
|
695
|
+
"add_paths": Arg(bool),
|
|
696
|
+
},
|
|
697
|
+
"temporal_rw": {
|
|
698
|
+
"walk_length": Arg(int),
|
|
699
|
+
"num_walks": Arg(int),
|
|
700
|
+
"trw_workers": Arg(int),
|
|
701
|
+
"time_weight": Arg(str),
|
|
702
|
+
"half_life": Arg(int),
|
|
703
|
+
"window_size": Arg(int),
|
|
704
|
+
"min_count": Arg(int),
|
|
705
|
+
"use_skip_gram": Arg(bool),
|
|
706
|
+
"wv_workers": Arg(int),
|
|
707
|
+
"epochs": Arg(int),
|
|
708
|
+
"compute_loss": Arg(bool),
|
|
709
|
+
"negative": Arg(int),
|
|
710
|
+
"decline_rate": Arg(int),
|
|
711
|
+
},
|
|
712
|
+
"flash": {
|
|
713
|
+
"min_count": Arg(int),
|
|
714
|
+
"workers": Arg(int),
|
|
715
|
+
},
|
|
716
|
+
"hierarchical_hashing": {},
|
|
717
|
+
"magic": {},
|
|
718
|
+
"only_type": {},
|
|
719
|
+
"only_ones": {},
|
|
720
|
+
"ocrapt_features": {
|
|
721
|
+
"use_lifespan": Arg(bool, desc="Off by default, hurts generalization (paper Appendix E)."),
|
|
722
|
+
"use_cumulative_active_time": Arg(bool, desc="Off by default, same reason as use_lifespan."),
|
|
723
|
+
},
|
|
724
|
+
"pretrained": {
|
|
725
|
+
# Model configuration
|
|
726
|
+
"model_size": Arg(
|
|
727
|
+
str,
|
|
728
|
+
desc="SPIDER encoder size preset (selects hidden / layers / heads / FFN). "
|
|
729
|
+
"Standard presets: 'tiny' (H=128), 'mini' (H=256), 'med' (H=512), "
|
|
730
|
+
"'baseline' (H=768). HF pretrained model_types use their own size keys "
|
|
731
|
+
"(e.g. 'small' / 'medium' / 'large' / 'xl' for gpt2_pretrained, "
|
|
732
|
+
"'1b' / '3b' for llama3_pretrained).",
|
|
733
|
+
),
|
|
734
|
+
"model_type": Arg(
|
|
735
|
+
str,
|
|
736
|
+
vals=OR([
|
|
737
|
+
# MLM walk-based
|
|
738
|
+
"bert", "roberta", "modernbert", "ropebert", "llama", "logbert",
|
|
739
|
+
# Walk embedding
|
|
740
|
+
"deepwalk", "node2vec",
|
|
741
|
+
# GNN self-supervised
|
|
742
|
+
"graphmae", "gae", "dgi",
|
|
743
|
+
# GNN token-budget
|
|
744
|
+
"gnn_distill", "behavior_cluster", "spider",
|
|
745
|
+
# HF pretrained
|
|
746
|
+
"gpt2_pretrained", "llama3_pretrained", "opt_pretrained",
|
|
747
|
+
]),
|
|
748
|
+
desc=(
|
|
749
|
+
"SPIDER pretraining objective + architecture. See "
|
|
750
|
+
"config/pretrained/README.md for full descriptions. Families:\n"
|
|
751
|
+
" MLM walk-based : bert, roberta, modernbert, ropebert, llama, logbert\n"
|
|
752
|
+
" Walk embedding : deepwalk, node2vec\n"
|
|
753
|
+
" GNN self-supervised: graphmae, gae, dgi\n"
|
|
754
|
+
" GNN token-budget : gnn_distill, behavior_cluster, spider\n"
|
|
755
|
+
" HF pretrained : gpt2_pretrained, llama3_pretrained, opt_pretrained"
|
|
756
|
+
),
|
|
757
|
+
),
|
|
758
|
+
# DeepWalk / Node2Vec shared parameters
|
|
759
|
+
"deepwalk": {
|
|
760
|
+
"window": Arg(int, desc="Skip-gram context window size. Default: 5."),
|
|
761
|
+
"epochs": Arg(int, desc="Number of Word2Vec training epochs. Default: 10."),
|
|
762
|
+
"min_count": Arg(int, desc="Minimum label frequency to include in vocabulary. Default: 1."),
|
|
763
|
+
"workers": Arg(int, desc="Number of parallel workers for Word2Vec training. Default: 4."),
|
|
764
|
+
},
|
|
765
|
+
|
|
766
|
+
# Node2Vec-specific parameters
|
|
767
|
+
"node2vec": {
|
|
768
|
+
"p": Arg(float, desc="Return parameter. Higher p = less likely to revisit previous node. Default: 1.0."),
|
|
769
|
+
"q": Arg(float, desc="In-out parameter. q > 1 = BFS-like (local); q < 1 = DFS-like (explore). Default: 1.0."),
|
|
770
|
+
},
|
|
771
|
+
|
|
772
|
+
# GNN distillation model_type parameters
|
|
773
|
+
"gnn_distill": {
|
|
774
|
+
"emb_dim": Arg(int, desc="GNN edge embedding dimension. Default: 128."),
|
|
775
|
+
"hidden_dim": Arg(int, desc="GNN hidden dimension. Default: 128."),
|
|
776
|
+
"num_layers": Arg(int, desc="Number of GNN encoder layers. Default: 1."),
|
|
777
|
+
"num_heads": Arg(int, desc="Number of attention heads in GNN layers. Default: 4."),
|
|
778
|
+
"n_neighbors_min": Arg(int, desc="Min direct neighbors to sample per entity. Default: 5."),
|
|
779
|
+
"n_neighbors_max": Arg(int, desc="Max direct neighbors to sample per entity. Default: 20."),
|
|
780
|
+
"diverse_neighbors": Arg(bool, desc="Dedup neighbors by (edge_type, node_type, label) and prioritize edge type diversity. Default: True."),
|
|
781
|
+
"loss_weight": Arg(float, desc="Weight for distillation loss (T5 encoder → GNN alignment). Default: 0.5."),
|
|
782
|
+
"gnn_loss_weight": Arg(float, desc="Weight for GNN masked reconstruction loss. Default: 1.0."),
|
|
783
|
+
"gnn_lr": Arg(float, desc="Learning rate for GNN teacher parameters. Default: 1e-3."),
|
|
784
|
+
"ema_momentum": Arg(float, desc="EMA momentum for teacher update (0.999 = slow-moving). Default: 0.999."),
|
|
785
|
+
"edge_projection": Arg(bool, desc="Apply per-edge-type linear projection to source nodes before GNN message passing. Default: False."),
|
|
786
|
+
"filter_noisy_edges": Arg(bool, desc="Remove shared libs, /dev, /proc, /sys, linker cache, common configs from GNN neighborhoods. Default: False."),
|
|
787
|
+
},
|
|
788
|
+
|
|
789
|
+
# Behavior cluster model_type parameters
|
|
790
|
+
"behavior_cluster": {
|
|
791
|
+
"proj_dim": Arg(int, desc="Contrastive projection head output dimensionality. Default: 128."),
|
|
792
|
+
"bce_weight": Arg(float, desc="Weight for multi-label BCE loss. Default: 1.0."),
|
|
793
|
+
"contrastive_weight": Arg(float, desc="Weight for contrastive (NT-Xent) loss. Default: 0.5."),
|
|
794
|
+
"temperature": Arg(float, desc="Temperature for InfoNCE cosine similarity scaling. Default: 0.07."),
|
|
795
|
+
"min_signature_size": Arg(int, desc="Skip entities with fewer behavior labels in their signature. Default: 2."),
|
|
796
|
+
"filter_noisy_edges": Arg(bool, desc="Remove shared libs, /dev, /proc, /sys, linker cache, common configs from signature extraction. Default: True."),
|
|
797
|
+
"use_contrastive_head": Arg(bool, desc="Use contrastive projection head for inference embeddings (proj_dim) instead of raw encoder (emb_dim). Default: False."),
|
|
798
|
+
"min_entities_per_class": Arg(int, desc="Floor: oversample small classes to this minimum per epoch. 0 = no floor. Default: 0."),
|
|
799
|
+
"max_entities_per_class": Arg(int, desc="Cap entities per signature class per epoch. Rotates across epochs. 0 = no cap. Default: 0."),
|
|
800
|
+
"samples_per_class": Arg(int, desc="K in P×K batch sampling: number of entities per class per batch. Guarantees every entity has at least K-1 positives for contrastive learning. Default: 4."),
|
|
801
|
+
"bce_mode": Arg(str, desc="Classification head mode: 'multilabel' = BCE over behavior labels, 'class' = cross-entropy over entity classes. Default: multilabel."),
|
|
802
|
+
"contrastive_target": Arg(str, desc="Contrastive positive definition: 'signature' = entities with identical behavior signatures are positives, 'entity_class' = entities with the same coarse functional class are positives. Default: signature."),
|
|
803
|
+
"strip_entity_type": Arg(bool, desc="Remove entity type prefix tokens ([PROC], [FILE], [SOCK]) from tokenized sequences. Forces the model to learn identity from behavior rather than type. Default: False."),
|
|
804
|
+
},
|
|
805
|
+
|
|
806
|
+
# GNN cluster model_type parameters
|
|
807
|
+
"spider": {
|
|
808
|
+
"emb_dim": Arg(int, desc="GNN edge embedding dimension. Default: 256."),
|
|
809
|
+
"hidden_dim": Arg(int, desc="GNN encoder hidden dimension. Default: 256."),
|
|
810
|
+
"proj_dim": Arg(int, desc="Contrastive projection dimension (teacher). Default: 256."),
|
|
811
|
+
"num_heads": Arg(int, desc="Number of attention heads in GNN TransformerConv. Default: 4."),
|
|
812
|
+
"n_neighbors_min": Arg(int, desc="Min direct neighbors to sample per entity. Default: 5."),
|
|
813
|
+
"n_neighbors_max": Arg(int, desc="Max direct neighbors to sample per entity. Default: 20."),
|
|
814
|
+
"diverse_neighbors": Arg(bool, desc="Dedup neighbors by (edge_type, node_type, label) and prioritize edge type diversity. Default: True."),
|
|
815
|
+
"filter_noisy_edges": Arg(bool, desc="Remove shared libs, /dev, /proc, /sys from GNN neighborhoods. Default: True."),
|
|
816
|
+
"ema_momentum": Arg(float, desc="EMA momentum for teacher T5 update. Default: 0.999."),
|
|
817
|
+
"supcon_weight": Arg(float, desc="Weight for supervised contrastive loss on GNN teacher. Default: 1.0."),
|
|
818
|
+
"distill_weight": Arg(float, desc="Weight for distillation loss (student → GNN targets). Default: 0.5."),
|
|
819
|
+
"temperature": Arg(float, desc="SupCon temperature. Default: 0.07."),
|
|
820
|
+
"min_signature_size": Arg(int, desc="Skip entities with fewer behavior labels (for entity class assignment). Default: 2."),
|
|
821
|
+
"min_entities_per_class": Arg(int, desc="Floor: oversample small classes to this minimum per epoch. Default: 100."),
|
|
822
|
+
"max_entities_per_class": Arg(int, desc="Cap entities per class per epoch. Default: 2000."),
|
|
823
|
+
"samples_per_class": Arg(int, desc="K in P×K batching. Default: 4."),
|
|
824
|
+
"strip_entity_type": Arg(bool, desc="Remove entity type prefix tokens from inputs. Default: False."),
|
|
825
|
+
"distill_loss": Arg(str, desc="Distillation loss: sce or mse. Default: sce.", vals=OR(["sce", "mse"])),
|
|
826
|
+
"teacher_loss": Arg(str, desc="Teacher loss: contrastive (SupCon) or bce (cross-entropy). Default: contrastive.", vals=OR(["contrastive", "bce"])),
|
|
827
|
+
"teacher_data": Arg(str, desc="Teacher data modalities (comma-separated): signature, gnn_emb, or both. Default: signature,gnn_emb."),
|
|
828
|
+
"student_only_mode": Arg(str, desc="Student-only ablation: none, student_signature, or student_class. Default: none.", vals=OR(["none", "student_signature", "student_class"])),
|
|
829
|
+
},
|
|
830
|
+
|
|
831
|
+
# GraphMAE-specific parameters
|
|
832
|
+
"graphmae": {
|
|
833
|
+
"num_layers": Arg(int, desc="Number of GAT encoder layers. Default: 2."),
|
|
834
|
+
"num_heads": Arg(int, desc="Number of attention heads in GAT layers. Default: 4."),
|
|
835
|
+
"decoder_num_layers": Arg(int, desc="Number of GAT decoder layers. Default: 1."),
|
|
836
|
+
"mask_rate": Arg(float, desc="Fraction of nodes to mask during pretraining. Default: 0.5."),
|
|
837
|
+
"replace_rate": Arg(float, desc="Fraction of masked nodes replaced with random tokens (rest get [MASK]). Default: 0.1."),
|
|
838
|
+
"neighborhood_min": Arg(int, desc="Minimum number of neighbors in temporal neighborhood. Default: 5."),
|
|
839
|
+
"neighborhood_max": Arg(int, desc="Maximum number of neighbors in temporal neighborhood. Default: 20."),
|
|
840
|
+
"epochs": Arg(int, desc="Number of training epochs. Default: 100."),
|
|
841
|
+
"lr": Arg(float, desc="Learning rate. Default: 0.001."),
|
|
842
|
+
},
|
|
843
|
+
|
|
844
|
+
# GAE-specific parameters
|
|
845
|
+
"gae": {
|
|
846
|
+
"num_layers": Arg(int, desc="Number of GAT encoder layers. Default: 2."),
|
|
847
|
+
"num_heads": Arg(int, desc="Number of attention heads in GAT layers. Default: 4."),
|
|
848
|
+
"neighborhood_min": Arg(int, desc="Minimum number of neighbors in temporal neighborhood. Default: 5."),
|
|
849
|
+
"neighborhood_max": Arg(int, desc="Maximum number of neighbors in temporal neighborhood. Default: 20."),
|
|
850
|
+
"epochs": Arg(int, desc="Number of training epochs. Default: 100."),
|
|
851
|
+
"lr": Arg(float, desc="Learning rate. Default: 0.001."),
|
|
852
|
+
},
|
|
853
|
+
|
|
854
|
+
# DGI-specific parameters
|
|
855
|
+
"dgi": {
|
|
856
|
+
"num_layers": Arg(int, desc="Number of GAT encoder layers. Default: 2."),
|
|
857
|
+
"num_heads": Arg(int, desc="Number of attention heads in GAT layers. Default: 4."),
|
|
858
|
+
"neighborhood_min": Arg(int, desc="Minimum number of neighbors in temporal neighborhood. Default: 5."),
|
|
859
|
+
"neighborhood_max": Arg(int, desc="Maximum number of neighbors in temporal neighborhood. Default: 20."),
|
|
860
|
+
"epochs": Arg(int, desc="Number of training epochs. Default: 100."),
|
|
861
|
+
"lr": Arg(float, desc="Learning rate. Default: 0.001."),
|
|
862
|
+
},
|
|
863
|
+
|
|
864
|
+
# Token-budget training loop. Used by: MLM family, GNN token-budget
|
|
865
|
+
# (gnn_distill / spider / behavior_cluster), HF pretrained. Ignored by:
|
|
866
|
+
# walk embedding (uses deepwalk.epochs) and GNN-SSL (graphmae / gae / dgi
|
|
867
|
+
# have their own .epochs and .lr). See pretrained.yml for the full scope map.
|
|
868
|
+
"training": {
|
|
869
|
+
"pretrain_tokens": Arg(int, desc="Total number of tokens to process during pretraining (controls training duration)."),
|
|
870
|
+
"warmup_tokens": Arg(int, desc="Number of tokens for learning rate warmup at the start of pretraining."),
|
|
871
|
+
"batch_size": Arg(int, desc="Mini-batch size during pretraining. Interpretation depends on model_type: walks per batch (MLM), entities per batch (GNN token-budget), labels per batch (HF pretrained), neighborhoods per batch (GNN-SSL)."),
|
|
872
|
+
"lr": Arg(float, desc="Peak learning rate for pretraining (after warmup)."),
|
|
873
|
+
"scheduler": Arg(str, vals=OR(["cosine", "linear"]), desc="Learning rate scheduler shape after warmup. Only consumed by MLM and HF pretrained; GNN token-budget hardcodes cosine."),
|
|
874
|
+
},
|
|
875
|
+
|
|
876
|
+
# MLM-specific parameters (masking + architecture sub-blocks for MLM family)
|
|
877
|
+
"mlm": {
|
|
878
|
+
"mask_rate_fixed": Arg(float, desc="Initial fixed mask rate (fraction of nodes masked). Decays to mask_rate_min."),
|
|
879
|
+
"mask_rate_min": Arg(float, desc="Minimum mask rate after decay."),
|
|
880
|
+
"mask_edge_type": Arg(bool, desc="Enable structured masking of edge types during pretraining and edge-type scoring at inference."),
|
|
881
|
+
|
|
882
|
+
# ModernBERT-specific parameters
|
|
883
|
+
"modernbert": {
|
|
884
|
+
"global_attn_every_n_layers": Arg(int, desc="Use global attention every N layers. Other layers use local sliding window attention. Default: 3."),
|
|
885
|
+
"local_attention_window": Arg(int, desc="Sliding window size for local attention layers. Default: 128 tokens."),
|
|
886
|
+
},
|
|
887
|
+
|
|
888
|
+
# RoPEBERT-specific parameters
|
|
889
|
+
"ropebert": {
|
|
890
|
+
"rope_theta": Arg(float, desc="Base frequency for rotary position embeddings. Default: 10000.0."),
|
|
891
|
+
},
|
|
892
|
+
|
|
893
|
+
# LLaMA-specific parameters
|
|
894
|
+
"llama": {
|
|
895
|
+
"rope_theta": Arg(float, desc="Base frequency for rotary position embeddings. Default: 10000.0."),
|
|
896
|
+
},
|
|
897
|
+
|
|
898
|
+
# LogBERT-specific parameters
|
|
899
|
+
"logbert": {
|
|
900
|
+
"hvm_weight": Arg(float, desc="Weight for hypersphere volume minimization loss relative to MLM loss. Default: 0.1."),
|
|
901
|
+
},
|
|
902
|
+
},
|
|
903
|
+
|
|
904
|
+
"pretrain_datasets": Arg(str, desc="Comma-separated list of dataset names to use for multi-dataset pretraining."),
|
|
905
|
+
"weights_path": Arg(str, desc="Path to a folder of pretrained weights (e.g. the SPIDER weights). May contain any subset of: corpus.pt (sampler states + indexid2msg), tokenizer.pt (BPE vocabulary), pretrain_*.pt (model checkpoint), behavior_vocab.txt. Present artifacts are loaded; missing ones are computed from scratch. Works with any model_type."),
|
|
906
|
+
|
|
907
|
+
"graph_context_mode": Arg(
|
|
908
|
+
str,
|
|
909
|
+
vals=OR(["window", "day", "all"]),
|
|
910
|
+
desc="Graph context scope for walk sampling at both pretraining and inference time. "
|
|
911
|
+
"'window' = each time-window snapshot independently; "
|
|
912
|
+
"'day' = merge all snapshots from the same calendar day; "
|
|
913
|
+
"'all' = merge all snapshots in the relevant split "
|
|
914
|
+
"(train split at pretrain time; val or test split at inference time — "
|
|
915
|
+
"no training data leaks into inference context).",
|
|
916
|
+
),
|
|
917
|
+
|
|
918
|
+
# Walk configuration (used by MLM family and deepwalk/node2vec; affects corpus cache)
|
|
919
|
+
"walks": {
|
|
920
|
+
"walk_length": Arg(int, desc="Number of nodes per random walk during pretraining."),
|
|
921
|
+
"num_walks": Arg(int, desc="Number of random walks to sample per node per epoch during pretraining."),
|
|
922
|
+
"time_weight": Arg(str, desc="Temporal weighting for neighbor selection: 'uniform', 'exponential', or 'linear'."),
|
|
923
|
+
"half_life": Arg(float, desc="Half-life (in seconds) for exponential time weighting of neighbor selection."),
|
|
924
|
+
"random_walk_start": Arg(
|
|
925
|
+
bool,
|
|
926
|
+
desc="Randomize the temporal entry point for each walk. "
|
|
927
|
+
"When True, the first hop picks a random edge instead of "
|
|
928
|
+
"always starting from the earliest/latest timestamp.",
|
|
929
|
+
),
|
|
930
|
+
"diversity_weight": Arg(
|
|
931
|
+
float,
|
|
932
|
+
desc="Edge-type diversity bias for random walks during pretraining. "
|
|
933
|
+
"0 = no bias (default), higher values increasingly favor edges "
|
|
934
|
+
"whose type is underrepresented in the current walk. "
|
|
935
|
+
"Only affects pretraining; finetuning/inference use natural distribution.",
|
|
936
|
+
),
|
|
937
|
+
},
|
|
938
|
+
|
|
939
|
+
},
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
# Patterns that tokenizers can replace with placeholder tokens (see pidsmaker/tokenization/substitution.py).
|
|
943
|
+
SUBSTITUTION_METHODS = ["hash", "guid", "random", "version", "timestamp", "env_var", "number", "ip", "port"]
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
def _substitutions_arg():
|
|
947
|
+
return Arg(
|
|
948
|
+
str,
|
|
949
|
+
vals=AND(SUBSTITUTION_METHODS + ["none"]),
|
|
950
|
+
desc="Variable values replaced by a placeholder token before tokenization, or `none`. \
|
|
951
|
+
`hash`: hex strings of 7+ chars -> [HASH]; `guid`: GUIDs/UUIDs -> [GUID]; `random`: random-looking strings and Windows SIDs -> [RANDOM]; \
|
|
952
|
+
`version`: 1.2.3 -> [VER]; `timestamp`: words starting with a date -> [TIMESTAMP]; `env_var`: $HOME, %APPDATA% -> [ENV]; \
|
|
953
|
+
`number`: numbers above 255 -> [NUM]; `ip`: netflow IPs -> [PRIVATE_IP]/[PUBLIC_IP]/[LOCALHOST_IP]; \
|
|
954
|
+
`port`: netflow ports -> [PORT_HTTPS], [PORT_SSH], ... or [PORT_LOW]/[PORT_REG]/[PORT_EPH].",
|
|
955
|
+
)
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
# Tokenization of node labels, shared by all featurization methods (see pidsmaker/tokenization/).
|
|
959
|
+
TOKENIZATIONS_CFG = {
|
|
960
|
+
"none": {},
|
|
961
|
+
"nltk": {
|
|
962
|
+
"type_aware": Arg(
|
|
963
|
+
bool,
|
|
964
|
+
desc="NLTK word tokenization. If True, process and file labels are split on '/' and netflow labels on ':' and '.' \
|
|
965
|
+
(Orthrus, R-Caid, NodLink). If False, all labels are split on '/', ':' and '.' (FLASH).",
|
|
966
|
+
),
|
|
967
|
+
"substitutions": _substitutions_arg(),
|
|
968
|
+
},
|
|
969
|
+
"hierarchical": {
|
|
970
|
+
"substitutions": _substitutions_arg(),
|
|
971
|
+
},
|
|
972
|
+
"whole_label": {
|
|
973
|
+
"substitutions": _substitutions_arg(),
|
|
974
|
+
},
|
|
975
|
+
"bpe": {
|
|
976
|
+
"vocab_size": Arg(int, desc="Target BPE vocabulary size."),
|
|
977
|
+
"max_seq_len": Arg(int, desc="Maximum number of tokens per label (and per walk for the pretrained MLM models). Longer sequences are truncated."),
|
|
978
|
+
"mode": Arg(str, vals=OR(["domain_bpe", "bpe_only"]), desc="'domain_bpe' splits labels with domain-specific rules before BPE; 'bpe_only' applies BPE directly on whitespace-separated words."),
|
|
979
|
+
"substitutions": _substitutions_arg(),
|
|
980
|
+
"canonicalize_neighbors": Arg(bool, desc="Enable multi-level neighbor canonicalization. When True, decoder targets keep only structural/categorical tokens ([] special tokens + OS-agnostic category tokens like [CAT_WEBSERVER], [FCAT_LOG_WEB]) while encoder input gets full detail + category tokens prepended. During continue_pretrain, neighbors keep all tokens with category tokens prepended."),
|
|
981
|
+
},
|
|
982
|
+
"huggingface": {
|
|
983
|
+
"model_name": Arg(str, desc="HuggingFace id of the tokenizer (e.g. openai-community/gpt2). 'auto' uses the tokenizer of the HuggingFace pretrained model set in `featurization.pretrained` (gpt2_pretrained, llama3_pretrained, opt_pretrained)."),
|
|
984
|
+
"max_seq_len": Arg(int, desc="Maximum number of tokens per label. Longer labels are truncated."),
|
|
985
|
+
"substitutions": _substitutions_arg(),
|
|
986
|
+
},
|
|
987
|
+
}
|
|
988
|
+
TOKENIZATION_METHODS = list(TOKENIZATIONS_CFG.keys())
|
|
989
|
+
TEXT_TOKENIZATION_METHODS = [m for m in TOKENIZATION_METHODS if m != "none"]
|
|
990
|
+
# word2vec and fasttext learn from one sentence per unique label: with `whole_label`, each sentence
|
|
991
|
+
# is a single token without context.
|
|
992
|
+
SUBWORD_TOKENIZATION_METHODS = [m for m in TEXT_TOKENIZATION_METHODS if m != "whole_label"]
|
|
993
|
+
|
|
994
|
+
# Tokenizations that each featurization method can use. Methods mapped to `["none"]` do not
|
|
995
|
+
# read node labels as text: their tokenization is ignored.
|
|
996
|
+
FEATURIZATION_TOKENIZATIONS = {
|
|
997
|
+
"word2vec": SUBWORD_TOKENIZATION_METHODS,
|
|
998
|
+
"doc2vec": TEXT_TOKENIZATION_METHODS,
|
|
999
|
+
"graph2vec": ["none"],
|
|
1000
|
+
"fasttext": SUBWORD_TOKENIZATION_METHODS,
|
|
1001
|
+
"temporal_rw": TEXT_TOKENIZATION_METHODS,
|
|
1002
|
+
"flash": TEXT_TOKENIZATION_METHODS,
|
|
1003
|
+
"hierarchical_hashing": TEXT_TOKENIZATION_METHODS,
|
|
1004
|
+
"alacarte": ["none"],
|
|
1005
|
+
"magic": ["none"],
|
|
1006
|
+
"only_type": ["none"],
|
|
1007
|
+
"only_ones": ["none"],
|
|
1008
|
+
"ocrapt_features": ["none"],
|
|
1009
|
+
}
|
|
1010
|
+
# The pretrained encoders are built around one tokenizer, which depends on `pretrained.model_type`.
|
|
1011
|
+
PRETRAINED_TOKENIZATIONS = {
|
|
1012
|
+
"deepwalk": "whole_label",
|
|
1013
|
+
"node2vec": "whole_label",
|
|
1014
|
+
"gpt2_pretrained": "huggingface",
|
|
1015
|
+
"llama3_pretrained": "huggingface",
|
|
1016
|
+
"opt_pretrained": "huggingface",
|
|
1017
|
+
}
|
|
1018
|
+
PRETRAINED_DEFAULT_TOKENIZATION = "bpe" # all other model types
|
|
1019
|
+
|
|
1020
|
+
ENCODERS_CFG = {
|
|
1021
|
+
"tgn": {
|
|
1022
|
+
"tgn_memory_dim": Arg(int),
|
|
1023
|
+
"tgn_time_dim": Arg(int),
|
|
1024
|
+
"use_node_feats_in_gnn": Arg(bool),
|
|
1025
|
+
"use_memory": Arg(bool),
|
|
1026
|
+
"use_time_order_encoding": Arg(bool),
|
|
1027
|
+
"project_src_dst": Arg(bool),
|
|
1028
|
+
"mode": Arg(str),
|
|
1029
|
+
"use_residual_norm": Arg(bool, desc="Adds the projected input node features to the output of the GNN wrapped by TGN, followed by dropout and LayerNorm."),
|
|
1030
|
+
},
|
|
1031
|
+
"graph_attention": {
|
|
1032
|
+
"activation": Arg(str),
|
|
1033
|
+
"num_heads": Arg(int),
|
|
1034
|
+
"concat": Arg(bool),
|
|
1035
|
+
"flow": Arg(str),
|
|
1036
|
+
"num_layers": Arg(int),
|
|
1037
|
+
"final_activation": Arg(
|
|
1038
|
+
bool, desc="Applies `activation` to the output of the last layer too, as in Kairos."
|
|
1039
|
+
),
|
|
1040
|
+
},
|
|
1041
|
+
"sage": {
|
|
1042
|
+
"activation": Arg(str),
|
|
1043
|
+
"num_layers": Arg(int),
|
|
1044
|
+
},
|
|
1045
|
+
"gcn": {
|
|
1046
|
+
"activation": Arg(str),
|
|
1047
|
+
"num_layers": Arg(int, desc="Number of GCN layers. Edges are weighted by `batch.edge_weight` (see the `merge_edges` transformation)."),
|
|
1048
|
+
},
|
|
1049
|
+
"node_id_embedding": {
|
|
1050
|
+
"dim": Arg(int, desc="Size of the learned embedding of each node's identity, concatenated to its input features (as the one-hot node IDs of Euler, Argus and LARES)."),
|
|
1051
|
+
"all_nodes": Arg(
|
|
1052
|
+
bool,
|
|
1053
|
+
desc="Embeds all the nodes of the dataset in every graph, as Euler and Argus (nodes absent \
|
|
1054
|
+
from the graph only get their ID embedding). Combined with `snapshot_gru`, the state of \
|
|
1055
|
+
every node is updated at every graph, and with uniform negative sampling, negative \
|
|
1056
|
+
edges reach all nodes. Only for edge-level objectives.",
|
|
1057
|
+
),
|
|
1058
|
+
},
|
|
1059
|
+
"snapshot_gru": {
|
|
1060
|
+
"hidden_dim": Arg(int, desc="Size of the GRU state, projected to `node_out_dim` (0: `node_out_dim`)."),
|
|
1061
|
+
"dropout": Arg(float, desc="Dropout applied to the input of the GRU."),
|
|
1062
|
+
},
|
|
1063
|
+
# ProGrapher: predicts the graph2vec embedding of each snapshot from the previous ones
|
|
1064
|
+
"textrcnn": {
|
|
1065
|
+
"sequence_length": Arg(
|
|
1066
|
+
int,
|
|
1067
|
+
desc="Number of previous snapshots (graphs) whose graph2vec embeddings form the input \
|
|
1068
|
+
sequence (ProGrapher's L). Shorter sequences are used when fewer snapshots were seen.",
|
|
1069
|
+
),
|
|
1070
|
+
"num_layers": Arg(int, desc="Number of layers of the bidirectional RNN (hidden size: `node_hid_dim`)."),
|
|
1071
|
+
"rnn_type": Arg(
|
|
1072
|
+
str,
|
|
1073
|
+
vals=OR(["lstm", "gru", "rnn"]),
|
|
1074
|
+
desc="Bidirectional RNN computing the left and right contexts of each snapshot: \
|
|
1075
|
+
`rnn` is the ReLU recurrence of the TextRCNN equations, `lstm` and `gru` are gated.",
|
|
1076
|
+
),
|
|
1077
|
+
},
|
|
1078
|
+
"lares": {
|
|
1079
|
+
"flow": Arg(
|
|
1080
|
+
str,
|
|
1081
|
+
vals=OR(["target_to_source", "source_to_target"]),
|
|
1082
|
+
desc="`target_to_source` (LARES): hosts aggregate the messages of the destinations of \
|
|
1083
|
+
their outgoing edges; `source_to_target`: of the sources of their incoming edges.",
|
|
1084
|
+
),
|
|
1085
|
+
"use_node_features": Arg(
|
|
1086
|
+
bool,
|
|
1087
|
+
desc="Adds a projection of the node features to the node ID embedding (LARES only uses \
|
|
1088
|
+
node IDs).",
|
|
1089
|
+
),
|
|
1090
|
+
},
|
|
1091
|
+
"egraphsage": {
|
|
1092
|
+
"activation": Arg(str),
|
|
1093
|
+
"num_layers": Arg(int, desc="Number of E-GraphSAGE layers, whose messages include the edge features."),
|
|
1094
|
+
"undirected": Arg(bool, desc="Aggregates each edge in both directions, as E-GraphSAGE and Anomal-E (default: True)."),
|
|
1095
|
+
},
|
|
1096
|
+
"argus": {
|
|
1097
|
+
"num_layers": Arg(int, desc="Number of layers: GCN layers followed by a last edge-conditioned convolution (NNConv) if edge features are used."),
|
|
1098
|
+
},
|
|
1099
|
+
"shadewatcher": {
|
|
1100
|
+
"hidden_dims": Arg(
|
|
1101
|
+
str,
|
|
1102
|
+
desc="Comma-separated output sizes of the GNN layers propagating the TransR entity \
|
|
1103
|
+
embeddings (of size `node_hid_dim`) over the knowledge graph (ShadeWatcher: `32,16`). \
|
|
1104
|
+
The output concatenates the entity embeddings and the output of each layer, \
|
|
1105
|
+
projected to `node_out_dim` if their sizes differ.",
|
|
1106
|
+
),
|
|
1107
|
+
"kg_dim": Arg(int, desc="Size of the relation space of TransR (relation embeddings and projections)."),
|
|
1108
|
+
"kg_neg_ratio": Arg(int, desc="Number of corrupted triples per triple of the TransR loss."),
|
|
1109
|
+
"kg_margin": Arg(float, desc="Margin between the distances of valid and corrupted triples in the TransR loss."),
|
|
1110
|
+
},
|
|
1111
|
+
"gat": {
|
|
1112
|
+
"activation": Arg(str),
|
|
1113
|
+
"num_heads": Arg(int),
|
|
1114
|
+
"concat": Arg(bool),
|
|
1115
|
+
"flow": Arg(str),
|
|
1116
|
+
"num_layers": Arg(int),
|
|
1117
|
+
},
|
|
1118
|
+
"gin": {
|
|
1119
|
+
"activation": Arg(str),
|
|
1120
|
+
"num_layers": Arg(int),
|
|
1121
|
+
},
|
|
1122
|
+
"rgcn": {
|
|
1123
|
+
"activation": Arg(str),
|
|
1124
|
+
"num_layers": Arg(int),
|
|
1125
|
+
},
|
|
1126
|
+
"rgcn_per_type": {
|
|
1127
|
+
"activation": Arg(str),
|
|
1128
|
+
"num_layers": Arg(int),
|
|
1129
|
+
},
|
|
1130
|
+
"sum_aggregation": {},
|
|
1131
|
+
"rcaid_gat": {
|
|
1132
|
+
"num_layers": Arg(int, desc="Number of layers (local + root attention, then MLP update)."),
|
|
1133
|
+
"num_heads": Arg(int, desc="Number of attention heads (averaged) of each attention."),
|
|
1134
|
+
},
|
|
1135
|
+
"magic_gat": {
|
|
1136
|
+
"num_layers": Arg(int),
|
|
1137
|
+
"num_heads": Arg(int),
|
|
1138
|
+
"negative_slope": Arg(float),
|
|
1139
|
+
"alpha_l": Arg(float),
|
|
1140
|
+
"activation": Arg(str),
|
|
1141
|
+
},
|
|
1142
|
+
"glstm": {},
|
|
1143
|
+
"custom_mlp": {
|
|
1144
|
+
"architecture_str": Arg(str),
|
|
1145
|
+
},
|
|
1146
|
+
"none": {},
|
|
1147
|
+
"hetero_graph_transformer": {
|
|
1148
|
+
"activation": Arg(str, desc="Unused: the input projections always use ReLU."),
|
|
1149
|
+
"num_heads": Arg(int, desc="Number of attention heads of each Heterogeneous Graph Transformer (HGT) layer."),
|
|
1150
|
+
"num_layers": Arg(int, desc="Number of HGT layers. Each node and edge type gets its own parameters; not available on OpTC."),
|
|
1151
|
+
},
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
DECODERS_NODE_LEVEL = ["node_mlp", "none", "magic_gat", "nodlink"]
|
|
1155
|
+
DECODERS_EDGE_LEVEL = ["edge_mlp"]
|
|
1156
|
+
DECODERS_CFG = {
|
|
1157
|
+
"edge_mlp": {
|
|
1158
|
+
"architecture_str": Arg(
|
|
1159
|
+
str,
|
|
1160
|
+
desc="A string describing a simple neural network. Example: if the encoder's output has shape `node_out_dim=128` \
|
|
1161
|
+
setting `architecture_str=linear(2) | relu | linear(0.5)` creates this MLP: nn.Linear(128, 256), nn.ReLU(), nn.Linear(256, 128), nn.Linear(128, y). \
|
|
1162
|
+
Precisely, in linear(x), x is the multiplier of input neurons. `dropout(p)` adds a dropout of rate p, \
|
|
1163
|
+
`dropout` one of rate `training.encoder.dropout`. The final layer `nn.Linear(128, y)` is added automatically such that `y` is the \
|
|
1164
|
+
output size matching the downstream objective (e.g. edge type prediction involves predicting 10 edge types, so the output of the decoder should be 10).",
|
|
1165
|
+
),
|
|
1166
|
+
"src_dst_projection_coef": Arg(
|
|
1167
|
+
int, desc="Multiplier of input neurons to project src and dst nodes."
|
|
1168
|
+
),
|
|
1169
|
+
},
|
|
1170
|
+
"node_mlp": {
|
|
1171
|
+
"architecture_str": Arg(str),
|
|
1172
|
+
},
|
|
1173
|
+
"magic_gat": {
|
|
1174
|
+
"num_layers": Arg(int),
|
|
1175
|
+
"num_heads": Arg(int),
|
|
1176
|
+
"negative_slope": Arg(float),
|
|
1177
|
+
"alpha_l": Arg(float),
|
|
1178
|
+
"activation": Arg(str),
|
|
1179
|
+
},
|
|
1180
|
+
"nodlink": {},
|
|
1181
|
+
"inner_product": {},
|
|
1182
|
+
"none": {},
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
RECON_LOSSES = ["SCE", "MSE", "MSE_sum", "MAE", "none"]
|
|
1186
|
+
PRED_LOSSES = ["cross_entropy", "BCE"]
|
|
1187
|
+
OBJECTIVES_NODE_LEVEL = [
|
|
1188
|
+
"predict_node_type",
|
|
1189
|
+
"predict_process_tag",
|
|
1190
|
+
"reconstruct_node_features",
|
|
1191
|
+
"reconstruct_node_embeddings",
|
|
1192
|
+
"reconstruct_masked_features",
|
|
1193
|
+
"one_class",
|
|
1194
|
+
"predict_masked_struct",
|
|
1195
|
+
"predict_snapshot_embedding",
|
|
1196
|
+
]
|
|
1197
|
+
OBJECTIVES_EDGE_LEVEL = [
|
|
1198
|
+
"autoencode_edge_embeddings",
|
|
1199
|
+
"deep_graph_infomax",
|
|
1200
|
+
"predict_edge_type",
|
|
1201
|
+
"predict_edge_supervised",
|
|
1202
|
+
"reconstruct_edge_embeddings",
|
|
1203
|
+
"predict_edge_contrastive",
|
|
1204
|
+
]
|
|
1205
|
+
OBJECTIVES = OBJECTIVES_NODE_LEVEL + OBJECTIVES_EDGE_LEVEL
|
|
1206
|
+
# Objectives that do not use a decoder (their `decoder` arg is ignored)
|
|
1207
|
+
OBJECTIVES_WITHOUT_DECODER = ["deep_graph_infomax", "autoencode_edge_embeddings"]
|
|
1208
|
+
# The encoder of ProGrapher (`textrcnn`) directly predicts the snapshot embedding
|
|
1209
|
+
OBJECTIVES_WITHOUT_DECODER += ["predict_snapshot_embedding"]
|
|
1210
|
+
OBJECTIVES_CFG = {
|
|
1211
|
+
# Prediction-based
|
|
1212
|
+
"predict_edge_supervised": {
|
|
1213
|
+
"decoder": Arg(
|
|
1214
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1215
|
+
),
|
|
1216
|
+
**DECODERS_CFG,
|
|
1217
|
+
"mode": Arg(str, vals=OR(["scores", "patterns", "synthetic"]),
|
|
1218
|
+
desc="'scores': pick top-N from an edge_scores pkl; 'patterns': match hand-crafted TTP patterns; "
|
|
1219
|
+
"'synthetic': use pre-computed embeddings for explicit attack edge definitions."),
|
|
1220
|
+
# mode=scores fields
|
|
1221
|
+
"top_n_attacks": Arg(int, desc="(scores mode) Number of top-loss edges to use as attack examples."),
|
|
1222
|
+
# mode=patterns fields
|
|
1223
|
+
"attack_patterns": Arg(list, desc="(patterns mode) List of TTP pattern dicts."),
|
|
1224
|
+
"max_edges_per_pattern": Arg(int, desc="(patterns mode) Max edges collected per pattern."),
|
|
1225
|
+
# mode=synthetic fields
|
|
1226
|
+
"attack_edges_path": Arg(str, desc="(synthetic mode) Path to YAML file with explicit (src_type, src_label, "
|
|
1227
|
+
"edge_type, dst_type, dst_label) attack edge definitions."),
|
|
1228
|
+
"pos_weight": Arg(float, desc="BCE pos_weight for the attack class (on top of 1:1 oversampling)."),
|
|
1229
|
+
},
|
|
1230
|
+
"predict_edge_type": {
|
|
1231
|
+
"loss": Arg(
|
|
1232
|
+
str,
|
|
1233
|
+
vals=OR(PRED_LOSSES + ["AMS"]),
|
|
1234
|
+
desc="Loss used to predict the edge type. AMS: additive margin softmax (see `AMS`).",
|
|
1235
|
+
),
|
|
1236
|
+
"decoder": Arg(
|
|
1237
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1238
|
+
),
|
|
1239
|
+
**DECODERS_CFG,
|
|
1240
|
+
"balanced_loss": Arg(bool),
|
|
1241
|
+
"use_triplet_types": Arg(bool),
|
|
1242
|
+
"edge_type_in_msg": Arg(
|
|
1243
|
+
bool,
|
|
1244
|
+
desc="Keeps the edge type in the edge messages `msg` (TGN memory and `msg` edge \
|
|
1245
|
+
features), as in Kairos. Messages of an edge are only used after its type is \
|
|
1246
|
+
predicted. By default, the edge type is removed from the messages.",
|
|
1247
|
+
),
|
|
1248
|
+
"AMS":
|
|
1249
|
+
{
|
|
1250
|
+
"version": Arg(int),
|
|
1251
|
+
"margin": Arg(float),
|
|
1252
|
+
"scale": Arg(int),
|
|
1253
|
+
},
|
|
1254
|
+
},
|
|
1255
|
+
"predict_node_type": {
|
|
1256
|
+
"decoder": Arg(
|
|
1257
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1258
|
+
),
|
|
1259
|
+
**DECODERS_CFG,
|
|
1260
|
+
"balanced_loss": Arg(bool),
|
|
1261
|
+
"flash_snapshots": Arg(
|
|
1262
|
+
bool,
|
|
1263
|
+
desc="With the `flash` threshold method: trains each epoch on the training nodes still "
|
|
1264
|
+
"misclassified, and flags a node only if no snapshot of the epochs so far predicts its "
|
|
1265
|
+
"type correctly with a confidence above the threshold, as in FLASH.",
|
|
1266
|
+
),
|
|
1267
|
+
"flash_drop_conf": Arg(
|
|
1268
|
+
float,
|
|
1269
|
+
desc="With `flash_snapshots`: training nodes predicted with this confidence or more are "
|
|
1270
|
+
"removed after an epoch, as the correctly predicted ones (0.9 in FLASH).",
|
|
1271
|
+
),
|
|
1272
|
+
},
|
|
1273
|
+
# R-Caid: predicts the name of the executable of each process (other nodes are not scored)
|
|
1274
|
+
"predict_process_tag": {
|
|
1275
|
+
"decoder": Arg(
|
|
1276
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1277
|
+
),
|
|
1278
|
+
**DECODERS_CFG,
|
|
1279
|
+
"balanced_loss": Arg(bool),
|
|
1280
|
+
"detection": Arg(
|
|
1281
|
+
str,
|
|
1282
|
+
vals=OR(["loss", "kmeans"]),
|
|
1283
|
+
desc="Score of the processes at inference. `loss`: cross-entropy of their tag (tags \
|
|
1284
|
+
unseen in training have their own class, never predicted). `kmeans`: distance of \
|
|
1285
|
+
their embedding to the median of the nearest K-Means cluster of training \
|
|
1286
|
+
processes (as in the paper).",
|
|
1287
|
+
),
|
|
1288
|
+
},
|
|
1289
|
+
"predict_masked_struct": {
|
|
1290
|
+
"loss": Arg(str, vals=OR(PRED_LOSSES)),
|
|
1291
|
+
"decoder": Arg(
|
|
1292
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1293
|
+
),
|
|
1294
|
+
**DECODERS_CFG,
|
|
1295
|
+
"balanced_loss": Arg(bool),
|
|
1296
|
+
"max_samples": Arg(
|
|
1297
|
+
int,
|
|
1298
|
+
desc="Number of existing edges sampled per batch as positives, with as many negative \
|
|
1299
|
+
node pairs, capped by the number of nodes (MAGIC: 10000). 0 uses all the edges.",
|
|
1300
|
+
),
|
|
1301
|
+
},
|
|
1302
|
+
"detect_edge_few_shot": {
|
|
1303
|
+
"decoder": Arg(
|
|
1304
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1305
|
+
),
|
|
1306
|
+
**DECODERS_CFG,
|
|
1307
|
+
},
|
|
1308
|
+
"predict_edge_contrastive": {
|
|
1309
|
+
"decoder": Arg(
|
|
1310
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1311
|
+
),
|
|
1312
|
+
"loss": Arg(
|
|
1313
|
+
str,
|
|
1314
|
+
vals=OR(["bce", "ap", "bpr"]),
|
|
1315
|
+
desc="`bce`: binary cross-entropy of positive vs. random negative edges (default), \
|
|
1316
|
+
`ap`: surrogate average precision loss of Argus, `bpr`: pairwise BPR loss of \
|
|
1317
|
+
ShadeWatcher, softplus(s_neg - s_pos) between each negative edge and its positive edge.",
|
|
1318
|
+
),
|
|
1319
|
+
"ap_margin": Arg(float, desc="Margin of the squared hinge of the `ap` loss (default: 0.8)."),
|
|
1320
|
+
"neg_sampling": Arg(
|
|
1321
|
+
str,
|
|
1322
|
+
vals=OR(["shuffle_dst", "uniform", "uniform_dst", "tgn"]),
|
|
1323
|
+
desc="Negative edges: `shuffle_dst` pairs each source with the destination of another \
|
|
1324
|
+
edge of the graph (negatives keep the degree of destinations), `uniform` draws \
|
|
1325
|
+
sources and destinations uniformly among the embedded nodes (as Euler and Argus), \
|
|
1326
|
+
`uniform_dst` pairs the source of each edge with uniform destinations among the \
|
|
1327
|
+
embedded nodes, `tgn` pairs it with a uniform destination of the dataset embedded \
|
|
1328
|
+
by the TGN (as TGN and Jbeil, requires `tgn_last_neighbor.negative_destinations`).",
|
|
1329
|
+
),
|
|
1330
|
+
"neg_ratio": Arg(float, desc="Number of negatives per positive edge with `uniform` sampling."),
|
|
1331
|
+
**DECODERS_CFG,
|
|
1332
|
+
"inner_product": {
|
|
1333
|
+
"dropout": Arg(float),
|
|
1334
|
+
"negate": Arg(
|
|
1335
|
+
bool,
|
|
1336
|
+
desc="Scores edges by the negated inner product, as ShadeWatcher, whose inner \
|
|
1337
|
+
product is the probability that two entities would not interact.",
|
|
1338
|
+
),
|
|
1339
|
+
},
|
|
1340
|
+
},
|
|
1341
|
+
# Self-supervised contrastive learning on edges, with PCA anomaly scores (Anomal-E)
|
|
1342
|
+
"deep_graph_infomax": {
|
|
1343
|
+
"decoder": Arg(
|
|
1344
|
+
str, vals=OR(["none"]), desc="Unused: the discriminator of DGI is bilinear."
|
|
1345
|
+
),
|
|
1346
|
+
"pca_components": Arg(
|
|
1347
|
+
int,
|
|
1348
|
+
desc="Number of principal components of the PCA fitted on the embeddings of training \
|
|
1349
|
+
edges. Edges are scored by the reconstruction error of their embedding.",
|
|
1350
|
+
),
|
|
1351
|
+
},
|
|
1352
|
+
# Prediction of the graph2vec embedding of each snapshot, with node scores (ProGrapher)
|
|
1353
|
+
"predict_snapshot_embedding": {
|
|
1354
|
+
"decoder": Arg(str, vals=OR(["none"]), desc="Unused: the encoder predicts the embedding."),
|
|
1355
|
+
"top_k": Arg(
|
|
1356
|
+
int,
|
|
1357
|
+
desc="Number of top-ranked rooted subgraphs (key indicators) whose nodes get a score: \
|
|
1358
|
+
other nodes get 0. 0 scores all nodes by the rank of their best rooted subgraph.",
|
|
1359
|
+
),
|
|
1360
|
+
},
|
|
1361
|
+
# Reconstruction-based
|
|
1362
|
+
"reconstruct_node_features": {
|
|
1363
|
+
"loss": Arg(str, vals=OR(RECON_LOSSES)),
|
|
1364
|
+
"decoder": Arg(
|
|
1365
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1366
|
+
),
|
|
1367
|
+
**DECODERS_CFG,
|
|
1368
|
+
},
|
|
1369
|
+
"reconstruct_node_embeddings": {
|
|
1370
|
+
"loss": Arg(str, vals=OR(RECON_LOSSES)),
|
|
1371
|
+
"decoder": Arg(
|
|
1372
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1373
|
+
),
|
|
1374
|
+
**DECODERS_CFG,
|
|
1375
|
+
},
|
|
1376
|
+
"autoencode_edge_embeddings": {
|
|
1377
|
+
"decoder": Arg(str, vals=OR(["none"]), desc="Unused: the objective has its own autoencoder."),
|
|
1378
|
+
"use_edge_feats": Arg(
|
|
1379
|
+
bool,
|
|
1380
|
+
desc="Adds the edge features (`batching.edge_features`) to the edge embedding through a \
|
|
1381
|
+
gated skip connection, as LARES.",
|
|
1382
|
+
),
|
|
1383
|
+
},
|
|
1384
|
+
"reconstruct_edge_embeddings": {
|
|
1385
|
+
"loss": Arg(str, vals=OR(RECON_LOSSES)),
|
|
1386
|
+
"decoder": Arg(
|
|
1387
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1388
|
+
),
|
|
1389
|
+
**DECODERS_CFG,
|
|
1390
|
+
},
|
|
1391
|
+
"reconstruct_masked_features": {
|
|
1392
|
+
"loss": Arg(str, vals=OR(RECON_LOSSES)),
|
|
1393
|
+
"mask_rate": Arg(float),
|
|
1394
|
+
"decoder": Arg(
|
|
1395
|
+
str, vals=OR(list(DECODERS_CFG.keys())), desc="Decoder used before computing loss."
|
|
1396
|
+
),
|
|
1397
|
+
**DECODERS_CFG,
|
|
1398
|
+
},
|
|
1399
|
+
"one_class": {
|
|
1400
|
+
"decoder": Arg(
|
|
1401
|
+
str, vals=OR(list(DECODERS_CFG.keys())),
|
|
1402
|
+
desc="Decoder applied to embeddings before the hypersphere; use 'none' (identity).",
|
|
1403
|
+
),
|
|
1404
|
+
**DECODERS_CFG,
|
|
1405
|
+
"beta": Arg(float, desc="Soft-boundary fraction; radius is the (1-beta) distance quantile."),
|
|
1406
|
+
"eps": Arg(float, desc="Center slack keeping |c| away from zero."),
|
|
1407
|
+
"warmup": Arg(int, desc="Kept for parity; a no-op (c/r update every train step)."),
|
|
1408
|
+
},
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
SYNTHETIC_ATTACKS = {
|
|
1412
|
+
"synthetic_attack_naive": {
|
|
1413
|
+
"num_attacks": Arg(int),
|
|
1414
|
+
"num_malicious_process": Arg(int),
|
|
1415
|
+
"num_unauthorized_file_access": Arg(int),
|
|
1416
|
+
"process_selection_method": Arg(str),
|
|
1417
|
+
},
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
REQUIRE_HETERO_FEATURES_ENCODERS = ["hetero_graph_transformer"]
|
|
1421
|
+
REQUIRE_NON_REVERSED_EDGES_ENCODERS = ["hetero_graph_transformer", "event_type_encoding"]
|
|
1422
|
+
# Encoders wrapping or preprocessing the inputs of a single base encoder (e.g. `tgn,graph_attention`)
|
|
1423
|
+
ENCODER_WRAPPERS = [
|
|
1424
|
+
"tgn",
|
|
1425
|
+
"ancestor_encoding",
|
|
1426
|
+
"entity_type_encoding",
|
|
1427
|
+
"event_type_encoding",
|
|
1428
|
+
# Node ID embeddings concatenated to inputs, and a GRU over the successive embeddings of
|
|
1429
|
+
# nodes across graphs (Euler, Argus), see `pidsmaker/encoders/temporal_wrappers.py`
|
|
1430
|
+
"node_id_embedding",
|
|
1431
|
+
"snapshot_gru",
|
|
1432
|
+
]
|
|
1433
|
+
|
|
1434
|
+
THRESHOLD_METHODS = ["max_val_loss", "mean_val_loss", "percentile", "threatrace", "magic", "flash", "nodlink", "fixed_zero", "ocrapt"]
|
|
1435
|
+
|
|
1436
|
+
# --- Tasks, subtasks, and argument configurations ---
|
|
1437
|
+
# Cleaning of the raw data during construction (see pidsmaker/preprocessing/cleaning.py).
|
|
1438
|
+
IP_CATEGORIES = ["multicast", "broadcast", "unspecified", "loopback", "link_local"]
|
|
1439
|
+
CLEANING_CFG = {
|
|
1440
|
+
"remove_null_attributes": {},
|
|
1441
|
+
"normalize_labels": {
|
|
1442
|
+
"collapse_whitespace": Arg(bool, desc="Trims labels and replaces runs of whitespaces by a single space."),
|
|
1443
|
+
"collapse_slashes": Arg(
|
|
1444
|
+
bool, desc="Replaces repeated '/' (except in URLs) and repeated '\\' by a single one."
|
|
1445
|
+
),
|
|
1446
|
+
"strip_path_prefixes": Arg(bool, desc="Removes Windows NT path prefixes such as '\\\\?\\' and '//?/'."),
|
|
1447
|
+
"strip_quotes": Arg(bool, desc="Removes single and double quotes, e.g. around Windows executable paths."),
|
|
1448
|
+
"lowercase": Arg(bool, desc="Lowercases labels, e.g. for case-insensitive Windows paths."),
|
|
1449
|
+
"max_length": Arg(int, desc="Labels longer than this number of characters are truncated. 0 disables truncation."),
|
|
1450
|
+
},
|
|
1451
|
+
"remove_duplicate_events": {},
|
|
1452
|
+
"remove_self_loops": {},
|
|
1453
|
+
"remove_noisy_netflows": {
|
|
1454
|
+
"ip_categories": Arg(
|
|
1455
|
+
str,
|
|
1456
|
+
vals=AND(IP_CATEGORIES),
|
|
1457
|
+
desc="Netflow nodes whose remote IP is in one of these categories are removed. \
|
|
1458
|
+
`broadcast` is 255.255.255.255.",
|
|
1459
|
+
),
|
|
1460
|
+
},
|
|
1461
|
+
"dedup_window_edges": {},
|
|
1462
|
+
}
|
|
1463
|
+
CLEANING_METHODS = list(CLEANING_CFG.keys())
|
|
1464
|
+
|
|
1465
|
+
TASK_ARGS = {
|
|
1466
|
+
"construction": {
|
|
1467
|
+
"used_method": Arg(
|
|
1468
|
+
str, vals=OR(["default", "magic"]), desc="The method to build time window graphs."
|
|
1469
|
+
),
|
|
1470
|
+
"use_all_files": Arg(bool),
|
|
1471
|
+
"mimicry_edge_num": Arg(int),
|
|
1472
|
+
"time_window_size": Arg(
|
|
1473
|
+
float,
|
|
1474
|
+
desc="The size of each graph in minutes. The notation should always be float (e.g. 10.0). Supports sizes < 1.0.",
|
|
1475
|
+
),
|
|
1476
|
+
"use_hashed_label": Arg(bool, desc="Whether to hash the textual features."),
|
|
1477
|
+
"fuse_edge": Arg(
|
|
1478
|
+
bool, desc="Whether to fuse duplicate sequential edges into a single edge."
|
|
1479
|
+
),
|
|
1480
|
+
"consistent_edge_types": Arg(
|
|
1481
|
+
bool, desc="Map OpTC edge types to DARPA TC equivalents for shared vocabulary across datasets."
|
|
1482
|
+
),
|
|
1483
|
+
"operations": Arg(
|
|
1484
|
+
str,
|
|
1485
|
+
desc="Events kept when building graphs, by value of their `operation` column: \
|
|
1486
|
+
`default` keeps the default events of the dataset's schema (all events, except for \
|
|
1487
|
+
OpTC network flows where only FLOW_START events are kept, as in LARES and Argus), \
|
|
1488
|
+
`all` keeps all events, otherwise a comma-separated list of operations \
|
|
1489
|
+
(e.g. `FLOW_START,FLOW_MESSAGE`).",
|
|
1490
|
+
),
|
|
1491
|
+
"drop_noise_events": Arg(
|
|
1492
|
+
bool,
|
|
1493
|
+
desc="Drops the noise events of the dataset's schema when building graphs (OpTC \
|
|
1494
|
+
network flows: NetBIOS, LLMNR and SSDP broadcasts and multicasts and ICMPv6 neighbor \
|
|
1495
|
+
discovery, which link every host to most hosts in every time window). No effect on datasets \
|
|
1496
|
+
without noise events. Default: True.",
|
|
1497
|
+
),
|
|
1498
|
+
"benign_training": Arg(
|
|
1499
|
+
bool,
|
|
1500
|
+
desc="Drops the events labelled malicious from the graphs of the train and val dates, so \
|
|
1501
|
+
that models are trained and validated on benign events only (datasets with event \
|
|
1502
|
+
labels whose train or val dates have attacks). No effect on other datasets and \
|
|
1503
|
+
dates. Default: True.",
|
|
1504
|
+
),
|
|
1505
|
+
"edge_type": Arg(
|
|
1506
|
+
str,
|
|
1507
|
+
vals=OR(sorted({c for schema in SCHEMAS.values() for c in schema.edge_type_choices})),
|
|
1508
|
+
desc="Edge attribute used as edge type by graphs and models (e.g. the type predicted by \
|
|
1509
|
+
`predict_edge_type`). `operation` is the default type of events of the dataset \
|
|
1510
|
+
(e.g. system calls in provenance datasets), other values are categorical edge \
|
|
1511
|
+
attributes of the dataset's schema (e.g. `logon_type` in LANL).",
|
|
1512
|
+
),
|
|
1513
|
+
"node_label_features": {
|
|
1514
|
+
# One entry per node type of the dataset schemas (see `pidsmaker/config/schemas.py`)
|
|
1515
|
+
**NODE_LABEL_FEATURES_CFG,
|
|
1516
|
+
},
|
|
1517
|
+
"null_label_tokens": Arg(
|
|
1518
|
+
bool,
|
|
1519
|
+
desc="When enabled, null entity attributes produce explicit tokens ([NO_CMD], [NO_PATH], [NO_IP]) instead of empty strings.",
|
|
1520
|
+
),
|
|
1521
|
+
"multi_dataset": Arg(
|
|
1522
|
+
str,
|
|
1523
|
+
vals=OR(list(DATASET_DEFAULT_CONFIG.keys()) + ["none"]),
|
|
1524
|
+
desc="A comma-separated list of datasets on which training is performed. Evaluation is done only the primary dataset run in CLI.",
|
|
1525
|
+
),
|
|
1526
|
+
"cleaning": {
|
|
1527
|
+
"used_methods": Arg(
|
|
1528
|
+
str,
|
|
1529
|
+
vals=AND(CLEANING_METHODS + ["none"]),
|
|
1530
|
+
desc="Cleaning methods applied to the raw data before building the graphs, or `none`. \
|
|
1531
|
+
`remove_null_attributes`: null-like attributes (`None`, `NA`, `<UNNAMED fd:3>`, invalid IPs and ports) are removed from labels; \
|
|
1532
|
+
`normalize_labels`: whitespaces, slashes, path prefixes and quotes are normalized and long labels truncated; \
|
|
1533
|
+
`remove_duplicate_events`: events with the same source, destination, type and timestamp are kept once; \
|
|
1534
|
+
`remove_self_loops`: events from a node to itself are removed; \
|
|
1535
|
+
`remove_noisy_netflows`: netflows to multicast/broadcast/... IPs are removed with their events; \
|
|
1536
|
+
`dedup_window_edges`: only the first event of each (source, destination, type) is kept in each time window.",
|
|
1537
|
+
),
|
|
1538
|
+
**CLEANING_CFG,
|
|
1539
|
+
},
|
|
1540
|
+
},
|
|
1541
|
+
"transformation": {
|
|
1542
|
+
"used_methods": Arg(
|
|
1543
|
+
str,
|
|
1544
|
+
vals=AND(
|
|
1545
|
+
["undirected", "dag", "rcaid_pseudo_graph", "merge_edges", "none"]
|
|
1546
|
+
+ list(SYNTHETIC_ATTACKS.keys())
|
|
1547
|
+
),
|
|
1548
|
+
desc="Applies transformations to graphs after their construction. Multiple transformations can be applied sequentially. Example: `used_methods=undirected,dag`",
|
|
1549
|
+
),
|
|
1550
|
+
"rcaid_pseudo_graph": {
|
|
1551
|
+
"use_pruning": Arg(
|
|
1552
|
+
bool,
|
|
1553
|
+
desc="Whether roots reaching more than `prune_threshold` of the nodes of the graph \
|
|
1554
|
+
get no pseudo edges (R-Caid's pruning of highly-connected roots).",
|
|
1555
|
+
),
|
|
1556
|
+
"prune_threshold": Arg(
|
|
1557
|
+
float,
|
|
1558
|
+
desc="Fraction of the nodes of the graph above which the descendants of a root are \
|
|
1559
|
+
pruned (0.5 for DARPA TC in the paper).",
|
|
1560
|
+
),
|
|
1561
|
+
"root_node_types": Arg(
|
|
1562
|
+
str,
|
|
1563
|
+
desc="Comma-separated node types that can be roots (e.g. `file,netflow`: files and \
|
|
1564
|
+
sockets, as in the paper), or `all`.",
|
|
1565
|
+
),
|
|
1566
|
+
"keep_original_edges": Arg(
|
|
1567
|
+
bool,
|
|
1568
|
+
desc="Whether the transformed graph keeps the edges of the provenance graph next to \
|
|
1569
|
+
the pseudo edges (root -> descendant), which have no edge type. If False, only \
|
|
1570
|
+
the pseudo edges are kept.",
|
|
1571
|
+
),
|
|
1572
|
+
"merge_same_label_roots": Arg(
|
|
1573
|
+
bool,
|
|
1574
|
+
desc="Whether the pseudo edges of the roots with the same type and label (thus the \
|
|
1575
|
+
same features) towards a same node are merged into one, from the first such root.",
|
|
1576
|
+
),
|
|
1577
|
+
"max_roots_per_node": Arg(
|
|
1578
|
+
int,
|
|
1579
|
+
desc="Maximum number of pseudo-roots of a node (0: no limit): its roots with the \
|
|
1580
|
+
fewest descendants. Bounds the pseudo edges by this number times the number of \
|
|
1581
|
+
nodes, e.g. when a process reads thousands of files that become roots of all \
|
|
1582
|
+
its descendants.",
|
|
1583
|
+
),
|
|
1584
|
+
},
|
|
1585
|
+
"merge_edges": {
|
|
1586
|
+
"per_edge_type": Arg(
|
|
1587
|
+
bool,
|
|
1588
|
+
desc="Whether repeated edges are merged per edge type (one edge per source, \
|
|
1589
|
+
destination and type) or regardless of their type (one edge per source and \
|
|
1590
|
+
destination, as in Euler). Merged edges have a `count` and a `weight` attribute.",
|
|
1591
|
+
),
|
|
1592
|
+
"aggregate_attributes": Arg(
|
|
1593
|
+
bool,
|
|
1594
|
+
desc="Whether the edge attributes of a merged edge (`batching.edge_features=edge_attrs`) \
|
|
1595
|
+
aggregate all its events, as the edge features of Euler, Argus and LARES: the number \
|
|
1596
|
+
of events, the number of events with each value of each categorical attribute \
|
|
1597
|
+
(e.g. successful and failed logons) and the number, mean and std of the values of \
|
|
1598
|
+
numeric attributes, each standardized over the edges of the graph as \
|
|
1599
|
+
sigmoid(floor(x / std)). Otherwise, the attributes of the first event are kept.",
|
|
1600
|
+
),
|
|
1601
|
+
},
|
|
1602
|
+
**SYNTHETIC_ATTACKS,
|
|
1603
|
+
},
|
|
1604
|
+
"featurization": {
|
|
1605
|
+
"emb_dim": Arg(
|
|
1606
|
+
int,
|
|
1607
|
+
desc="Size of the text embedding. Arg not used by some featurization methods that do not build embeddings.",
|
|
1608
|
+
),
|
|
1609
|
+
"epochs": Arg(
|
|
1610
|
+
int, desc="Epochs to train the embedding method. Arg not used by some methods."
|
|
1611
|
+
),
|
|
1612
|
+
"seed": Arg(int),
|
|
1613
|
+
"training_split": Arg(
|
|
1614
|
+
str,
|
|
1615
|
+
vals=OR(["train", "all"]),
|
|
1616
|
+
desc="The partition of data used to train the featurization method.",
|
|
1617
|
+
),
|
|
1618
|
+
"multi_dataset_training": Arg(
|
|
1619
|
+
bool,
|
|
1620
|
+
desc="Whether the featurization method should be trained on all datasets in `multi_dataset`.",
|
|
1621
|
+
),
|
|
1622
|
+
"pretrain_datasets": Arg(
|
|
1623
|
+
str,
|
|
1624
|
+
desc="Comma-separated list of dataset names for multi-dataset pretraining (used by word2vec, doc2vec, etc.).",
|
|
1625
|
+
),
|
|
1626
|
+
"used_method": Arg(
|
|
1627
|
+
str,
|
|
1628
|
+
vals=OR(list(FEATURIZATIONS_CFG.keys())),
|
|
1629
|
+
desc="Algorithms used to create node and edge features.",
|
|
1630
|
+
),
|
|
1631
|
+
"tokenization": {
|
|
1632
|
+
"used_method": Arg(
|
|
1633
|
+
str,
|
|
1634
|
+
vals=OR(TOKENIZATION_METHODS),
|
|
1635
|
+
desc="How node labels are split into tokens before featurization. `nltk` splits words with NLTK, \
|
|
1636
|
+
`hierarchical` keeps each level of paths and IPs (Kairos), `whole_label` uses the whole label as a single token (DeepWalk), \
|
|
1637
|
+
`bpe` is the provenance-specific BPE of SPIDER, `huggingface` uses the tokenizer of a HuggingFace language model, \
|
|
1638
|
+
`none` is for featurization methods that do not tokenize labels.",
|
|
1639
|
+
),
|
|
1640
|
+
**TOKENIZATIONS_CFG,
|
|
1641
|
+
},
|
|
1642
|
+
**FEATURIZATIONS_CFG,
|
|
1643
|
+
},
|
|
1644
|
+
"feat_inference": {
|
|
1645
|
+
"to_remove": Arg(bool), # TODO: remove
|
|
1646
|
+
"edge_attributes": Arg(
|
|
1647
|
+
str,
|
|
1648
|
+
desc="Edge attributes of the dataset's schema used as edge features \
|
|
1649
|
+
(`batching.edge_features=edge_attrs`): `all`, a comma-separated list of attribute \
|
|
1650
|
+
names (names absent from the dataset are ignored), or lists per dataset, e.g. \
|
|
1651
|
+
`LANL:success;OPTC_NET:src_port,dst_port,protocol` (unlisted datasets use all their \
|
|
1652
|
+
attributes).",
|
|
1653
|
+
),
|
|
1654
|
+
"continue_pretrain": Arg(bool, desc="Continue pretraining on the target dataset before inference. Default: False."),
|
|
1655
|
+
"continue_pretrain_epochs": Arg(int, desc="Number of epochs for continue-pretraining on target dataset. Default: 3."),
|
|
1656
|
+
"continue_pretrain_lr_factor": Arg(float, desc="LR multiplier relative to original peak LR (e.g., 0.1 = 10x lower). Default: 0.1."),
|
|
1657
|
+
"edge_batch_size": Arg(int, desc="Number of edges to process in each batch during feat_inference. Default: 5000."),
|
|
1658
|
+
"rename_attack": {
|
|
1659
|
+
"enabled": Arg(bool, desc="If True, after embeddings are computed, replace the embedding of selected test-set nodes with a benign target embedding. Simulates an inference-time renaming/mimicry attack."),
|
|
1660
|
+
"entities": Arg(str, desc="Comma-separated BASE NAMES of attack entities (e.g. 'main, XIM, sendmail'). Each is matched two ways against test-set nodes of `target_node_type`: (a) exact label equality, and (b) labels ending with '/<base>' (path-style)."),
|
|
1661
|
+
"target_node_type": Arg(str, vals=OR(["subject", "file", "netflow"]), desc="Node type the attack targets (only nodes of this type are rewritten)."),
|
|
1662
|
+
"top_k": Arg(int, desc="If >0, automatically build a benign-target pool from the top-K most frequent BARE labels (no '/') of `target_node_type` seen in the training split, and assign one target per attack entity. Path-suffix matches preserve the original prefix (e.g. '/tmp/main' -> '/tmp/<assigned-target>'). If 0, use the manual `target_label` for every entity (e.g. for an 'unseen-by-pretraining' target)."),
|
|
1663
|
+
"target_label": Arg(str, desc="(Manual mode only, used when top_k=0) Bare base name to replace every attack entity. Path-suffix matches still preserve the prefix (e.g. '/tmp/main' -> '/tmp/<target_label>')."),
|
|
1664
|
+
"seed": Arg(int, desc="Seed used to shuffle the auto-picked benign pool before assigning one target per entity. Vary it for sensitivity analysis over which benign label each malicious entity is mimicking."),
|
|
1665
|
+
},
|
|
1666
|
+
},
|
|
1667
|
+
"batching": {
|
|
1668
|
+
"save_on_disk": Arg(
|
|
1669
|
+
bool,
|
|
1670
|
+
desc="Whether to store the graphs on disk upon building the graphs. \
|
|
1671
|
+
Used to avoid re-computation of very complex batching operations that take time. Can take up to 300GB storage for CADETS_E5.",
|
|
1672
|
+
),
|
|
1673
|
+
"node_features": Arg(
|
|
1674
|
+
str,
|
|
1675
|
+
vals=AND(["node_type", "node_emb", "only_ones", "edges_distribution"]),
|
|
1676
|
+
desc="Node features to use during GNN training. `node_type` is a one-hot encoded entity type vector, \
|
|
1677
|
+
`node_emb` refers to the embedding generated during the `featurization` task, `only_ones` is a vector of ones \
|
|
1678
|
+
with length `node_type`, `edges_distribution` counts emitted and received edges.",
|
|
1679
|
+
),
|
|
1680
|
+
"edges_distribution_scaling": Arg(
|
|
1681
|
+
str,
|
|
1682
|
+
vals=OR(["max", "none", "log1p"]),
|
|
1683
|
+
desc="Scaling of the `edges_distribution` counts: `max` divides them by the largest count of \
|
|
1684
|
+
the time window (default), `none` keeps the raw counts (as ThreaTrace), `log1p` applies log(1 + x).",
|
|
1685
|
+
),
|
|
1686
|
+
"edge_features": Arg(
|
|
1687
|
+
str,
|
|
1688
|
+
vals=AND(["edge_type", "edge_type_triplet", "msg", "time_encoding", "edge_attrs", "none"]),
|
|
1689
|
+
desc="Edge features to used during GNN training. `edge_type` refers to the system call type, `edge_type_triplet` \
|
|
1690
|
+
considers a same edge type as a new type if source or destination node types are different, `msg` is the message vector \
|
|
1691
|
+
used in the TGN, `time_encoding` encodes temporal order of events with their timestamps in the TGN, \
|
|
1692
|
+
`edge_attrs` are the edge attributes of the dataset's schema besides the edge type (one-hot categorical and \
|
|
1693
|
+
log-scaled numeric attributes, e.g. ports or logon types), `none` uses no features.",
|
|
1694
|
+
),
|
|
1695
|
+
"multi_dataset_training": Arg(
|
|
1696
|
+
bool, desc="Whether the GNN should be trained on all datasets in `multi_dataset`."
|
|
1697
|
+
),
|
|
1698
|
+
"compact_node_ids": Arg(
|
|
1699
|
+
bool,
|
|
1700
|
+
desc="Renumbers the nodes of the graphs from 0 to (number of nodes in the graphs - 1), keeping \
|
|
1701
|
+
their order, instead of using the node IDs of the database, which also count the nodes \
|
|
1702
|
+
absent from all graphs (86% of the 44.5M IDs of TRACE_E3). Tensors indexed by node (TGN \
|
|
1703
|
+
memory, neighbor loader, node ID embeddings, `all_nodes` embeddings, ...) are sized \
|
|
1704
|
+
accordingly. Node IDs are restored in the outputs. Results are unchanged, except for \
|
|
1705
|
+
methods drawing random nodes among all IDs (e.g. uniform negatives of Euler and Argus).",
|
|
1706
|
+
),
|
|
1707
|
+
"fix_buggy_graph_reindexer": Arg(
|
|
1708
|
+
bool,
|
|
1709
|
+
desc="A bug has been found in the first version of the framework, where reindexing graphs in shape (N, d) \
|
|
1710
|
+
slightly modify node features. Setting this to true fixes the bug.",
|
|
1711
|
+
),
|
|
1712
|
+
"global_batching": {
|
|
1713
|
+
"used_method": Arg(
|
|
1714
|
+
str,
|
|
1715
|
+
vals=OR(["edges", "minutes", "unique_edge_types", "none"]),
|
|
1716
|
+
desc="Flattens the time window-based graphs into a single large \
|
|
1717
|
+
temporal graph and recreate graphs based on the given method. `edges` creates contiguous graphs of size `global_batching_batch_size` edges, \
|
|
1718
|
+
the same applies for `minutes`, `unique_edge_types` builds graphs where each pair of connected nodes share edges with distinct edge types, \
|
|
1719
|
+
`none` uses the default time window-based batching defined in minutes with arg `time_window_size`.",
|
|
1720
|
+
),
|
|
1721
|
+
"global_batching_batch_size": Arg(
|
|
1722
|
+
int,
|
|
1723
|
+
desc="Controls the value associated with `global_batching.used_method` (training+inference).",
|
|
1724
|
+
),
|
|
1725
|
+
"global_batching_batch_size_inference": Arg(
|
|
1726
|
+
int,
|
|
1727
|
+
desc="Controls the value associated with `global_batching.used_method` (inference only).",
|
|
1728
|
+
),
|
|
1729
|
+
},
|
|
1730
|
+
"intra_graph_batching": {
|
|
1731
|
+
"used_methods": Arg(
|
|
1732
|
+
str,
|
|
1733
|
+
vals=AND(["edges", "tgn_last_neighbor", "none"]),
|
|
1734
|
+
desc="Breaks each previously computed graph into even smaller graphs. \
|
|
1735
|
+
`edges` creates contiguous graphs of size `intra_graph_batch_size` edges (if a graph has 2000 edges and `intra_graph_batch_size=1500` \
|
|
1736
|
+
creates two graphs: one with 1500 edges, the other with 500 edges), `tgn_last_neighbor` computes for each graph its associated graph \
|
|
1737
|
+
based on the TGN last neighbor loader, namely a new graph where each node is connected with its last `tgn_neighbor_size` incoming edges.\
|
|
1738
|
+
`none` does not alter any graph.",
|
|
1739
|
+
),
|
|
1740
|
+
"edges": {
|
|
1741
|
+
"intra_graph_batch_size": Arg(
|
|
1742
|
+
int,
|
|
1743
|
+
desc="Controls the value associated with `global_batching.used_method`.",
|
|
1744
|
+
),
|
|
1745
|
+
},
|
|
1746
|
+
"tgn_last_neighbor": {
|
|
1747
|
+
"tgn_neighbor_size": Arg(
|
|
1748
|
+
int, desc="Number of last neighbors to store for each node."
|
|
1749
|
+
),
|
|
1750
|
+
"tgn_neighbor_n_hop": Arg(
|
|
1751
|
+
int,
|
|
1752
|
+
desc="If greater than one, will also gather the last neighbors of neighbors.",
|
|
1753
|
+
),
|
|
1754
|
+
"fix_buggy_orthrus_TGN": Arg(
|
|
1755
|
+
bool,
|
|
1756
|
+
desc="A bug has been in the first version of the framework, where the features of last neighbors not appearing \
|
|
1757
|
+
in the input graph have zero node feature vectors. Setting this arg to true includes the features of all nodes in the TGN graph.",
|
|
1758
|
+
),
|
|
1759
|
+
"fix_tgn_neighbor_loader": Arg(
|
|
1760
|
+
bool,
|
|
1761
|
+
desc="We found a minor bug in the original TGN code (https://github.com/pyg-team/pytorch_geometric/issues/10100). This \
|
|
1762
|
+
is an unofficial fix.",
|
|
1763
|
+
),
|
|
1764
|
+
"directed": Arg(
|
|
1765
|
+
bool,
|
|
1766
|
+
desc="The original TGN's loader builds graphs in an undirected way. This makes the graphs purely directed.",
|
|
1767
|
+
),
|
|
1768
|
+
"insert_neighbors_before": Arg(
|
|
1769
|
+
bool,
|
|
1770
|
+
desc="Whether to insert the edges of the current graph before loading last neighbors.",
|
|
1771
|
+
),
|
|
1772
|
+
"reset_state_every_day": Arg(
|
|
1773
|
+
bool,
|
|
1774
|
+
desc="Empties the last neighbors and resets the TGN memory at the first batch of each day \
|
|
1775
|
+
(date of its first event), as Kairos, which trains and tests on one graph per day.",
|
|
1776
|
+
),
|
|
1777
|
+
"negative_destinations": Arg(
|
|
1778
|
+
bool,
|
|
1779
|
+
desc="Draws a negative destination for each edge, uniformly among the destinations \
|
|
1780
|
+
of the training graphs (training) or of all graphs (validation, test), and adds \
|
|
1781
|
+
it to the nodes of the TGN graph to be embedded with memory and neighbors, as \
|
|
1782
|
+
TGN and Jbeil (used by `predict_edge_contrastive.neg_sampling=tgn`).",
|
|
1783
|
+
),
|
|
1784
|
+
},
|
|
1785
|
+
},
|
|
1786
|
+
"inter_graph_batching": {
|
|
1787
|
+
"used_method": Arg(
|
|
1788
|
+
str,
|
|
1789
|
+
vals=OR(["graph_batching", "none"]),
|
|
1790
|
+
desc="Batches multiple graphs into a single large one for parallel training. \
|
|
1791
|
+
Does not support TGN. `graph_batching` batches `inter_graph_batch_size` together, `none` doesn't batch graphs.",
|
|
1792
|
+
),
|
|
1793
|
+
"inter_graph_batch_size": Arg(
|
|
1794
|
+
int,
|
|
1795
|
+
desc="Controls the value associated with `inter_graph_batching.used_method`.",
|
|
1796
|
+
),
|
|
1797
|
+
},
|
|
1798
|
+
},
|
|
1799
|
+
"training": {
|
|
1800
|
+
"seed": Arg(int),
|
|
1801
|
+
"deterministic": Arg(bool, desc="Whether to force PyTorch to use deterministic algorithms."),
|
|
1802
|
+
"num_epochs": Arg(int),
|
|
1803
|
+
"patience": Arg(int),
|
|
1804
|
+
"lr": Arg(float),
|
|
1805
|
+
"weight_decay": Arg(float),
|
|
1806
|
+
"node_hid_dim": Arg(int, desc="Number of neurons in the middle layers of the encoder."),
|
|
1807
|
+
"node_out_dim": Arg(int, desc="Number of neurons in the last layer of the encoder."),
|
|
1808
|
+
"grad_accumulation": Arg(int, desc="Number of epochs to gather gradients before backprop."),
|
|
1809
|
+
"stable_optim": Arg(
|
|
1810
|
+
bool, desc="Use AdamW + warmup cosine schedule + gradient clipping for stable training."
|
|
1811
|
+
),
|
|
1812
|
+
"inference_device": Arg(str, vals=OR(["cpu", "cuda"]), desc="Device used during testing."),
|
|
1813
|
+
"fuse_duplicate_edges_training": Arg(bool, desc="During training only, keeps one edge per (source, destination) pair in each batch, so that repeated events between the same entities count once in the loss."),
|
|
1814
|
+
"used_method": Arg(str, vals=OR(["default", "pretrained", "threatrace"]), desc="Which training pipeline use. \
|
|
1815
|
+
`threatrace` trains ThreaTrace's successive submodels (see `training.threatrace`)."),
|
|
1816
|
+
"threatrace": {
|
|
1817
|
+
"ratio_threshold": Arg(
|
|
1818
|
+
float,
|
|
1819
|
+
desc="ThreaTrace's `thre`: a node is explained by a submodel when its type is predicted \
|
|
1820
|
+
with a top-1 / top-2 probability ratio of at least this value. Anomalous nodes are \
|
|
1821
|
+
those no submodel explains (used by `threshold_method: threatrace`).",
|
|
1822
|
+
),
|
|
1823
|
+
"max_submodels": Arg(int, desc="Maximum number of submodels trained by `used_method: threatrace`."),
|
|
1824
|
+
"max_retrain_epochs": Arg(
|
|
1825
|
+
int, desc="Maximum number of epochs to train each submodel after the first one."
|
|
1826
|
+
),
|
|
1827
|
+
"retrain_loss_threshold": Arg(
|
|
1828
|
+
float,
|
|
1829
|
+
desc="Training of a submodel after the first one stops once its mean loss on the nodes \
|
|
1830
|
+
not yet explained is below this value.",
|
|
1831
|
+
),
|
|
1832
|
+
"max_rounds_without_progress": Arg(
|
|
1833
|
+
int,
|
|
1834
|
+
desc="Training stops after this number of consecutive rounds where the submodel \
|
|
1835
|
+
explains no new training node.",
|
|
1836
|
+
),
|
|
1837
|
+
},
|
|
1838
|
+
"ocrapt_early_stop": {
|
|
1839
|
+
"enabled": Arg(bool, desc="Off by default, no-op unless set."),
|
|
1840
|
+
"patience": Arg(int),
|
|
1841
|
+
"min_delta": Arg(float),
|
|
1842
|
+
"max_delta": Arg(float),
|
|
1843
|
+
},
|
|
1844
|
+
"encoder": {
|
|
1845
|
+
"dropout": Arg(float),
|
|
1846
|
+
"used_methods": Arg(
|
|
1847
|
+
str,
|
|
1848
|
+
vals=AND(list(ENCODERS_CFG.keys())),
|
|
1849
|
+
desc="First part of the neural network. Usually GNN encoders to capture complex patterns.",
|
|
1850
|
+
),
|
|
1851
|
+
"x_is_tuple": Arg(
|
|
1852
|
+
bool, desc="Whether to consider nodes differently when being source or destination."
|
|
1853
|
+
),
|
|
1854
|
+
**ENCODERS_CFG,
|
|
1855
|
+
},
|
|
1856
|
+
"decoder": {
|
|
1857
|
+
"used_methods": Arg(
|
|
1858
|
+
str,
|
|
1859
|
+
vals=AND(list(OBJECTIVES_CFG.keys())),
|
|
1860
|
+
desc="Second part of the neural network. Usually MLPs specific to the downstream task (e.g. reconstruction of prediction)",
|
|
1861
|
+
),
|
|
1862
|
+
**OBJECTIVES_CFG,
|
|
1863
|
+
"use_few_shot": Arg(bool, desc="Old feature: need some work to update it."),
|
|
1864
|
+
"few_shot": {
|
|
1865
|
+
"include_attacks_in_ssl_training": Arg(bool),
|
|
1866
|
+
"freeze_encoder": Arg(bool),
|
|
1867
|
+
"num_epochs_few_shot": Arg(int),
|
|
1868
|
+
"patience_few_shot": Arg(int),
|
|
1869
|
+
"lr_few_shot": Arg(float),
|
|
1870
|
+
"weight_decay_few_shot": Arg(float),
|
|
1871
|
+
"decoder": {
|
|
1872
|
+
"used_methods": Arg(str),
|
|
1873
|
+
**OBJECTIVES_CFG,
|
|
1874
|
+
},
|
|
1875
|
+
},
|
|
1876
|
+
},
|
|
1877
|
+
"pretrained": {
|
|
1878
|
+
"finetune_mode": Arg(str, desc="Fine-tuning and scoring mode: 'cls', 'cls_attack', 'lp', 'mlm', 'tgn', 'edge_cls', or 'perplexity'."),
|
|
1879
|
+
"finetune_epochs": Arg(int, desc="Number of fine-tuning epochs."),
|
|
1880
|
+
"finetune_walk_len": Arg(int, desc="Number of nodes per context walk during fine-tuning and inference."),
|
|
1881
|
+
"finetune_lr": Arg(float, desc="Learning rate for fine-tuning."),
|
|
1882
|
+
"finetune_margin": Arg(float, desc="Margin for the ranking loss in cls mode. The anomalous logit must exceed the normal logit by at least this value. Larger values spread anomaly scores further apart."),
|
|
1883
|
+
"freeze_backbone": Arg(bool, desc="Freeze pretrained backbone weights during fine-tuning (only train the head)."),
|
|
1884
|
+
"num_inference_walks": Arg(int, desc="Number of context walks per edge at inference. Scores are averaged to reduce variance."),
|
|
1885
|
+
"inference_batch_size": Arg(int, desc="Number of edges per batch during inference scoring."),
|
|
1886
|
+
"edge_score_weight": Arg(float, desc="Weight (lambda) for edge-type CE in combined scoring: score = node_CE + lambda * edge_CE. Requires mask_edge_type=True."),
|
|
1887
|
+
"num_attack_walks": Arg(int, desc="Number of unique context walks to extract per malicious edge for cls_attack fine-tuning. Walks are deduplicated by edge-type sequence."),
|
|
1888
|
+
"event_emb": {
|
|
1889
|
+
"pool_method": Arg(str, vals=OR(["mean"]), desc="How to extract embeddings from BERT hidden states over a node span. 'mean' = mean-pool."),
|
|
1890
|
+
},
|
|
1891
|
+
"tgn": {
|
|
1892
|
+
"objective": Arg(str, desc="TGN training objective: 'contrastive' (BCE with neg sampling), 'edge_pred' (predict edge type), or 'node_pred' (predict dst node type)."),
|
|
1893
|
+
"memory_dim": Arg(int, desc="Entity memory dimension for TGN mode (default: same as BERT hidden size)."),
|
|
1894
|
+
"edge_emb_dim": Arg(int, desc="Edge type embedding dimension for TGN mode."),
|
|
1895
|
+
"time_dim": Arg(int, desc="Time encoding dimension for TGN mode."),
|
|
1896
|
+
"num_heads": Arg(int, desc="Number of attention heads in TGN memory updater."),
|
|
1897
|
+
"batch_size": Arg(int, desc="Temporal batch size (edges per update step) for TGN mode."),
|
|
1898
|
+
"use_node_type_emb": Arg(bool, desc="Include src/dst node type embeddings in the TGN classifier input."),
|
|
1899
|
+
"use_time_emb": Arg(bool, desc="Include src/dst time-delta encodings in the TGN classifier input."),
|
|
1900
|
+
"use_memory": Arg(bool, desc="Include evolving memory vectors in the edge predictor/classifier input. When False, predictions use only static BERT embeddings."),
|
|
1901
|
+
"use_entity_emb": Arg(bool, desc="Include static BERT entity embeddings in the edge predictor/classifier input. When False, predictions rely on memory and other features."),
|
|
1902
|
+
"use_event_bert_emb": Arg(bool, desc="(event mode only) Include per-edge contextual src/dst BERT embeddings in TGN prediction heads."),
|
|
1903
|
+
"reset_memory_on_inference": Arg(bool, desc="Start inference with empty memory instead of trained memory state. Simulates production deployment on unseen data."),
|
|
1904
|
+
"score_gated_memory": Arg(bool, desc="Gate messages by per-edge anomaly score before aggregation. High-anomaly edges leave stronger memory traces; low-anomaly edges are suppressed."),
|
|
1905
|
+
"temporal_decay": Arg(bool, desc="Apply exponential memory decay toward zero based on time elapsed since last update. Learned decay rate. Old events naturally fade."),
|
|
1906
|
+
"anomaly_accumulator": Arg(bool, desc="Track per-node EMA of anomaly scores. When temporal_decay is also True, nodes with high accumulated anomaly decay slower (stickier memory)."),
|
|
1907
|
+
},
|
|
1908
|
+
},
|
|
1909
|
+
},
|
|
1910
|
+
"evaluation": {
|
|
1911
|
+
"viz_malicious_nodes": Arg(
|
|
1912
|
+
bool,
|
|
1913
|
+
desc="Whether to generate images of malicious nodes' neighborhoods (not stable).",
|
|
1914
|
+
),
|
|
1915
|
+
"ground_truth_version": Arg(str, vals=OR(["orthrus", "reapr", "threatrace"])),
|
|
1916
|
+
"evaluate_selected_epoch_only": Arg(
|
|
1917
|
+
bool,
|
|
1918
|
+
desc="Only evaluates the epoch selected by a label-free `best_model_selection` (`last_epoch`, \
|
|
1919
|
+
`best_val_score`), instead of evaluating every epoch on the test set (faster on large \
|
|
1920
|
+
test sets, without per-epoch test metrics).",
|
|
1921
|
+
),
|
|
1922
|
+
"save_figures": Arg(
|
|
1923
|
+
bool,
|
|
1924
|
+
desc="Whether to save the figures of the evaluation (scores, ADP and discrimination \
|
|
1925
|
+
curves) for each evaluated epoch. Metrics are computed either way. Figures with \
|
|
1926
|
+
one point per edge or node are slow to draw on large test sets.",
|
|
1927
|
+
),
|
|
1928
|
+
"best_model_selection": Arg(
|
|
1929
|
+
str,
|
|
1930
|
+
vals=OR(["best_adp", "best_discrimination", "best_ap@10", "best_val_score", "best_mcc", "last_epoch"]),
|
|
1931
|
+
desc="Strategy to select the best model across epochs. `best_adp` selects the best model based on the highest ADP score, `best_discrimination` \
|
|
1932
|
+
selects the model that does the best separation between top-score TPs and top-score FPs. These two use test labels. \
|
|
1933
|
+
`best_val_score` selects the model with the best score on validation data computed by the objective \
|
|
1934
|
+
(link prediction AUC + AP of validation edges for `predict_edge_contrastive`), as Euler's early stopping. \
|
|
1935
|
+
`last_epoch` selects the last evaluated epoch (no labels used). `best_mcc` selects the best MCC on the test set (as LARES' code).",
|
|
1936
|
+
),
|
|
1937
|
+
"used_method": Arg(str),
|
|
1938
|
+
"node_evaluation": {
|
|
1939
|
+
"threshold_method": Arg(
|
|
1940
|
+
str,
|
|
1941
|
+
vals=OR(THRESHOLD_METHODS),
|
|
1942
|
+
desc="Method to calculate the threshold value used to detect anomalies.",
|
|
1943
|
+
),
|
|
1944
|
+
"max_val_loss": {
|
|
1945
|
+
"alpha": Arg(float, desc="Weights the margin applied to the threshold value."),
|
|
1946
|
+
},
|
|
1947
|
+
"use_dst_node_loss": Arg(
|
|
1948
|
+
bool,
|
|
1949
|
+
desc="Whether to consider the loss of destination nodes when computing the node-level scores (maximum loss of a node).",
|
|
1950
|
+
),
|
|
1951
|
+
"use_kmeans": Arg(
|
|
1952
|
+
bool, desc="Whether to cluster nodes after thresholding as done in Orthrus"
|
|
1953
|
+
),
|
|
1954
|
+
"kmeans_top_K": Arg(int, desc="Number of top-score nodes selected before clustering."),
|
|
1955
|
+
"ocrapt_contamination": Arg(
|
|
1956
|
+
float,
|
|
1957
|
+
desc="For threshold_method=ocrapt: max per-type contamination (top fraction "
|
|
1958
|
+
"flagged), clamped from that type's own val malicious fraction.",
|
|
1959
|
+
),
|
|
1960
|
+
"ocrapt_min_contamination": Arg(
|
|
1961
|
+
float,
|
|
1962
|
+
desc="For threshold_method=ocrapt: min per-type contamination floor.",
|
|
1963
|
+
),
|
|
1964
|
+
"magic_knn_k": Arg(
|
|
1965
|
+
int,
|
|
1966
|
+
desc="For threshold_method=magic: number of nearest benign training nodes whose \
|
|
1967
|
+
mean distance scores a test node (default 10, as in the MAGIC paper).",
|
|
1968
|
+
),
|
|
1969
|
+
"magic_max_reference_size": Arg(
|
|
1970
|
+
int,
|
|
1971
|
+
desc="For threshold_method=magic: the k-NN reference set is a random sample of at most \
|
|
1972
|
+
this many benign training node embeddings (0: all of them).",
|
|
1973
|
+
),
|
|
1974
|
+
"magic_embedding": Arg(
|
|
1975
|
+
str,
|
|
1976
|
+
vals=OR(["last", "concat"]),
|
|
1977
|
+
desc="For threshold_method=magic: node embedding scored by the k-NN detector, the output \
|
|
1978
|
+
of the last encoder layer (`last`, MAGIC's code) or the concatenation of all its \
|
|
1979
|
+
layers (`concat`, MAGIC's paper).",
|
|
1980
|
+
),
|
|
1981
|
+
},
|
|
1982
|
+
"tw_evaluation": {
|
|
1983
|
+
"threshold_method": Arg(
|
|
1984
|
+
str,
|
|
1985
|
+
vals=OR(THRESHOLD_METHODS),
|
|
1986
|
+
desc="Time-window detection: each test time window is scored by reducing the losses of its edges, and classified as malicious if its score exceeds the threshold.",
|
|
1987
|
+
),
|
|
1988
|
+
},
|
|
1989
|
+
"node_tw_evaluation": {
|
|
1990
|
+
"threshold_method": Arg(
|
|
1991
|
+
str,
|
|
1992
|
+
vals=OR(THRESHOLD_METHODS),
|
|
1993
|
+
desc="Node-level detection where a same node in multiple time windows is \
|
|
1994
|
+
considered as multiple unique nodes. More realistic evaluation for near real-time detection.",
|
|
1995
|
+
),
|
|
1996
|
+
"use_dst_node_loss": Arg(bool),
|
|
1997
|
+
"use_kmeans": Arg(bool),
|
|
1998
|
+
"kmeans_top_K": Arg(int),
|
|
1999
|
+
},
|
|
2000
|
+
"queue_evaluation": {
|
|
2001
|
+
"used_method": Arg(
|
|
2002
|
+
str,
|
|
2003
|
+
vals=OR(["kairos_idf_queue", "provnet_lof_queue"]),
|
|
2004
|
+
desc="Queue-level detection as in Kairos: anomalous time windows sharing rare (high-IDF) nodes are grouped into queues, and the time windows of queues whose anomaly score exceeds `queue_threshold` are flagged. `provnet_lof_queue` is not supported anymore.",
|
|
2005
|
+
),
|
|
2006
|
+
"queue_threshold": Arg(int),
|
|
2007
|
+
"kairos_idf_queue": {
|
|
2008
|
+
"include_test_set_in_IDF": Arg(bool),
|
|
2009
|
+
},
|
|
2010
|
+
"provnet_lof_queue": {
|
|
2011
|
+
"queue_arg": Arg(str),
|
|
2012
|
+
},
|
|
2013
|
+
},
|
|
2014
|
+
"host_two_stage_evaluation": {
|
|
2015
|
+
"alpha": Arg(int, desc="Number of top host scores clustered by K-means in the first stage (LARES: 3)."),
|
|
2016
|
+
"beta": Arg(int, desc="Number of top outgoing edges predicted malicious per selected host (LARES: 350)."),
|
|
2017
|
+
"root_attack_nodes": Arg(
|
|
2018
|
+
str,
|
|
2019
|
+
desc="Comma-separated index IDs of the root sources of the attacks: only their malicious \
|
|
2020
|
+
edges are positives, as LARES. `dataset`: the `root_attack_nodes` of the dataset (9660 \
|
|
2021
|
+
on LANL, 201,402,501 on OpTC flows). Empty: all malicious edges.",
|
|
2022
|
+
),
|
|
2023
|
+
"test_end": Arg(
|
|
2024
|
+
str,
|
|
2025
|
+
desc="End of the evaluated test period (`%Y-%m-%d %H:%M:%S` in the dataset's timezone). \
|
|
2026
|
+
Empty: the whole test period.",
|
|
2027
|
+
),
|
|
2028
|
+
},
|
|
2029
|
+
"edge_evaluation": {
|
|
2030
|
+
"malicious_edge_selection": Arg(
|
|
2031
|
+
str,
|
|
2032
|
+
vals=OR(["src_node", "dst_node", "both_nodes"]),
|
|
2033
|
+
desc="The ground truth only contains node-level labels. \
|
|
2034
|
+
This arg controls the strategy to label edges. `src_nodes` and `dst_nodes` consider an edge as malicious if only its source or only its destination \
|
|
2035
|
+
node is malicious. `both` labels an edge as malicious if both end nodes are malicious.",
|
|
2036
|
+
),
|
|
2037
|
+
"threshold_method": Arg(str, vals=OR(THRESHOLD_METHODS)),
|
|
2038
|
+
},
|
|
2039
|
+
},
|
|
2040
|
+
"triage": {
|
|
2041
|
+
"used_method": Arg(
|
|
2042
|
+
str,
|
|
2043
|
+
vals=OR(["depimpact", "ocrapt_subgraph"]),
|
|
2044
|
+
desc="Post-processing step to reconstruct attack paths or reduce false positives. `depimpact` is used in Orthrus; `ocrapt_subgraph` is OCR-APT's anomalous-subgraph stage.",
|
|
2045
|
+
),
|
|
2046
|
+
"depimpact": {
|
|
2047
|
+
"used_method": Arg(
|
|
2048
|
+
str, vals=OR(["component", "shortest_path", "1-hop", "2-hop", "3-hop"])
|
|
2049
|
+
),
|
|
2050
|
+
"score_method": Arg(str, vals=OR(["degree", "recon_loss", "degree_recon"])),
|
|
2051
|
+
"workers": Arg(int),
|
|
2052
|
+
"visualize": Arg(bool),
|
|
2053
|
+
},
|
|
2054
|
+
"ocrapt": {
|
|
2055
|
+
"num_hops": Arg(int, desc="hops for correlating anomalies into subgraphs"),
|
|
2056
|
+
"top_k": Arg(int, desc="top-K seed nodes per node type (by Anomaly_score)"),
|
|
2057
|
+
"min_nodes": Arg(int, desc="minimum nodes per constructed subgraph"),
|
|
2058
|
+
"max_edges": Arg(int, desc="subgraphs above this are Louvain-partitioned + edge-sampled"),
|
|
2059
|
+
"abnormality_level": Arg(
|
|
2060
|
+
str, vals=OR(["Negligible", "Minor", "Moderate", "Significant", "Critical"]),
|
|
2061
|
+
desc="least subgraph severity to keep (summed Prediction_probability)",
|
|
2062
|
+
),
|
|
2063
|
+
"correlate_anomalous_once": Arg(bool),
|
|
2064
|
+
"remove_duplicated_subgraph": Arg(bool),
|
|
2065
|
+
},
|
|
2066
|
+
},
|
|
2067
|
+
"postprocessing": {},
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
EXPERIMENTS_CONFIG = {
|
|
2071
|
+
"training_loop": {
|
|
2072
|
+
"run_evaluation": Arg(
|
|
2073
|
+
str, vals=OR(["each_epoch", "best_epoch"])
|
|
2074
|
+
), # (when to run inference on test set)
|
|
2075
|
+
},
|
|
2076
|
+
"experiment": {
|
|
2077
|
+
"used_method": Arg(str, vals=OR(["uncertainty", "none"])),
|
|
2078
|
+
"uncertainty": {
|
|
2079
|
+
"hyperparameter": {
|
|
2080
|
+
"hyperparameters": Arg(str, vals=AND(["lr", "num_epochs", "text_h_dim", "gnn_h_dim"])),
|
|
2081
|
+
"iterations": Arg(int),
|
|
2082
|
+
"delta": Arg(float),
|
|
2083
|
+
},
|
|
2084
|
+
"mc_dropout": {
|
|
2085
|
+
"iterations": Arg(int),
|
|
2086
|
+
"dropout": Arg(float),
|
|
2087
|
+
},
|
|
2088
|
+
"deep_ensemble": {
|
|
2089
|
+
"method": Arg(str),
|
|
2090
|
+
"iterations": Arg(int),
|
|
2091
|
+
"restart_from": Arg(str),
|
|
2092
|
+
},
|
|
2093
|
+
"bagged_ensemble": {
|
|
2094
|
+
"iterations": Arg(int),
|
|
2095
|
+
"min_num_days": Arg(int),
|
|
2096
|
+
},
|
|
2097
|
+
},
|
|
2098
|
+
},
|
|
2099
|
+
}
|
|
2100
|
+
UNCERTAINTY_EXP_YML_FOLDER = "experiments/uncertainty/"
|