pidsmaker 4.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.
Potentially problematic release.
This version of pidsmaker might be problematic. Click here for more details.
- pidsmaker/__init__.py +22 -0
- pidsmaker/cli.py +32 -0
- pidsmaker/config/__init__.py +2 -0
- pidsmaker/config/config.py +2100 -0
- pidsmaker/config/pipeline.py +1768 -0
- pidsmaker/config/schemas.py +1032 -0
- pidsmaker/datasets.py +222 -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 +259 -0
- pidsmaker/detection/evaluation_methods/evaluation_utils.py +1730 -0
- pidsmaker/detection/evaluation_methods/host_two_stage_evaluation.py +115 -0
- pidsmaker/detection/evaluation_methods/node_evaluation.py +463 -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 +451 -0
- pidsmaker/detection/evaluation_methods/tw_evaluation.py +95 -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 +293 -0
- pidsmaker/detection/training_methods/ocrapt_early_stop.py +165 -0
- pidsmaker/detection/training_methods/threatrace_training.py +169 -0
- pidsmaker/detection/training_methods/training_loop.py +377 -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 +31 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_TRW.py +67 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_alacarte.py +16 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_doc2vec.py +54 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_fasttext.py +38 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_flash.py +70 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_graph2vec.py +85 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_ocrapt_features.py +95 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_pretrained.py +1729 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_word2vec.py +56 -0
- pidsmaker/featurization/featurization_methods/__init__.py +0 -0
- pidsmaker/featurization/featurization_methods/build_trw.py +67 -0
- pidsmaker/featurization/featurization_methods/featurization_alacarte.py +748 -0
- pidsmaker/featurization/featurization_methods/featurization_doc2vec.py +99 -0
- pidsmaker/featurization/featurization_methods/featurization_fasttext.py +75 -0
- pidsmaker/featurization/featurization_methods/featurization_flash.py +203 -0
- pidsmaker/featurization/featurization_methods/featurization_graph2vec.py +243 -0
- pidsmaker/featurization/featurization_methods/featurization_trw.py +115 -0
- pidsmaker/featurization/featurization_methods/featurization_word2vec.py +87 -0
- pidsmaker/featurization/featurization_utils.py +275 -0
- pidsmaker/featurization/utils/build_random_walks.py +68 -0
- pidsmaker/featurization/utils/trw.py +203 -0
- pidsmaker/hetero.py +81 -0
- pidsmaker/losses.py +170 -0
- pidsmaker/main.py +377 -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 +830 -0
- pidsmaker/preprocessing/build_graph_methods/build_magic_graphs.py +220 -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 +1432 -0
- pidsmaker/pretrained/embedding_generator.py +252 -0
- pidsmaker/pretrained/finetune.py +1437 -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 +276 -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/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/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 +120 -0
- pidsmaker/resources/config/orthrus_fixed.yml +17 -0
- pidsmaker/resources/config/orthrus_non_snooped.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/tasks/__init__.py +10 -0
- pidsmaker/tasks/batching.py +49 -0
- pidsmaker/tasks/construction.py +31 -0
- pidsmaker/tasks/evaluation.py +232 -0
- pidsmaker/tasks/feat_inference.py +413 -0
- pidsmaker/tasks/featurization.py +43 -0
- pidsmaker/tasks/training.py +19 -0
- pidsmaker/tasks/transformation.py +308 -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/data_utils.py +1742 -0
- pidsmaker/utils/database.py +204 -0
- pidsmaker/utils/dataset_utils.py +413 -0
- pidsmaker/utils/dataset_writer.py +1057 -0
- pidsmaker/utils/graph_store.py +634 -0
- pidsmaker/utils/labelling.py +447 -0
- pidsmaker/utils/loss_files.py +193 -0
- pidsmaker/utils/process_tags.py +44 -0
- pidsmaker/utils/utils.py +730 -0
- pidsmaker/vizgen/__init__.py +1 -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-4.0.0.dist-info/METADATA +596 -0
- pidsmaker-4.0.0.dist-info/RECORD +338 -0
- pidsmaker-4.0.0.dist-info/WHEEL +5 -0
- pidsmaker-4.0.0.dist-info/entry_points.txt +2 -0
- pidsmaker-4.0.0.dist-info/licenses/LICENSE +201 -0
- pidsmaker-4.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# ProGrapher (Yang et al., USENIX Security 2023): "PROGRAPHER: An Anomaly Detection System based on
|
|
2
|
+
# Provenance Graph Embedding". The provenance stream is cut into snapshots, each embedded as a whole
|
|
3
|
+
# by graph2vec: the Weisfeiler-Lehman rooted subgraphs (RSGs) of all nodes, built from node and
|
|
4
|
+
# edge types only, are the words of a document (the snapshot) embedded with doc2vec (PV-DBOW).
|
|
5
|
+
# A TextRCNN (bidirectional RNN + max-pooling) predicts the embedding of each snapshot from those
|
|
6
|
+
# of the previous L snapshots, and snapshots whose actual embedding is far (L2) from the
|
|
7
|
+
# prediction are anomalous. Key indicators are the nodes rooted at the RSGs that explain the
|
|
8
|
+
# deviation the most: RSGs r are ranked by w_r . (E - E'), the difference of their log-likelihood
|
|
9
|
+
# (Eq. 1) under the actual (E) and the predicted (E') embeddings.
|
|
10
|
+
#
|
|
11
|
+
# Components: `graph2vec` featurization (snapshot embedding `graph_emb` and RSGs of each graph),
|
|
12
|
+
# `textrcnn` encoder (state: the embeddings of the last `sequence_length` snapshots, carried
|
|
13
|
+
# across graphs like `snapshot_gru`), `predict_snapshot_embedding` objective (L2 error; at
|
|
14
|
+
# inference, one score per node = snapshot error x (1 - rank of the node's best RSG / #RSGs)).
|
|
15
|
+
#
|
|
16
|
+
# Evaluation:
|
|
17
|
+
# - `tw_evaluation` (default), as the paper: each time window is a snapshot, scored by its
|
|
18
|
+
# prediction error (the max of its node scores) and flagged above the max validation error.
|
|
19
|
+
# - `node_evaluation` (`--evaluation.used_method=node_evaluation`), to compare ProGrapher with the
|
|
20
|
+
# node-level PIDSs on ADP: a node is scored by its key-indicator score in its snapshots (max
|
|
21
|
+
# over windows). `predict_snapshot_embedding.top_k: 4` keeps only the nodes of the top-4 RSGs
|
|
22
|
+
# (the indicators reported by the paper, K = 4 in its Table 10); 0 (default) ranks all nodes.
|
|
23
|
+
#
|
|
24
|
+
# Differences with the original implementation (no public code is available):
|
|
25
|
+
# - snapshots are the time windows of the framework (`construction.time_window_size`), whereas
|
|
26
|
+
# ProGrapher builds snapshots of n nodes (900 on CADETS/THEIA, 300 on CLEARSCOPE) overlapping by
|
|
27
|
+
# 1 - fr, with a forgetting rate fr = 1/3 that retires the oldest nodes; lower the window size
|
|
28
|
+
# to get closer to its snapshot sizes;
|
|
29
|
+
# - graph2vec is trained on the training snapshots only (`training_split: train`, no data
|
|
30
|
+
# snooping) and the embedding of every snapshot (all splits) is then inferred with the trained
|
|
31
|
+
# RSG vectors; ProGrapher is transductive and learns the embeddings of all snapshots jointly,
|
|
32
|
+
# test included (`--featurization.training_split=all` trains on all of them). RSGs unseen in
|
|
33
|
+
# training are ignored, in the embedding and in the key indicators;
|
|
34
|
+
# - gensim truncates documents to 10,000 words: snapshot documents are split into chunks of
|
|
35
|
+
# 10,000 RSGs that share the same tag, and their embedding is inferred over all chunks;
|
|
36
|
+
# - the TextRCNN is trained with one optimizer step per snapshot (sequence of the previous
|
|
37
|
+
# L snapshots, teacher forcing), and the sequence is carried from the training snapshots to
|
|
38
|
+
# the validation and test ones; with fewer than L previous snapshots, the sequence is shorter;
|
|
39
|
+
# - its RNN is a 5-layer bidirectional LSTM (`rnn_type: lstm`, as common TextRCNN code); the
|
|
40
|
+
# paper's equations describe the ReLU recurrence of TextRCNN (`rnn_type: rnn`);
|
|
41
|
+
# - the paper evaluates 2-hour graphs (malicious if one of their snapshots is), here each time
|
|
42
|
+
# window is evaluated, and the threshold is the max validation error (the paper's threshold is
|
|
43
|
+
# "pre-defined");
|
|
44
|
+
# - the model is selected on validation data (lowest mean validation error, `best_val_score`),
|
|
45
|
+
# as the paper's early stopping (patience of 30 epochs); the paper does not report its
|
|
46
|
+
# number of epochs, 20 are run here (one optimizer step per snapshot, i.e. ~600 steps per
|
|
47
|
+
# epoch on CADETS_E3);
|
|
48
|
+
# - ProGrapher only keeps the latest event between a pair of entities: RSGs are built from sets
|
|
49
|
+
# of neighbors and edge types, so repeated events have no effect here (but events of other
|
|
50
|
+
# types between the same pair are kept). As sets, distinct neighbors with the same RSG also
|
|
51
|
+
# count once: an RSG does not reflect how many such neighbors a node has (e.g. a process
|
|
52
|
+
# writing 1 or 1,000 files of the same RSG), unlike the multisets of the original WL kernel.
|
|
53
|
+
|
|
54
|
+
_include_yml: default
|
|
55
|
+
|
|
56
|
+
construction:
|
|
57
|
+
used_method: default
|
|
58
|
+
use_all_files: True
|
|
59
|
+
mimicry_edge_num: 0
|
|
60
|
+
time_window_size: 15.0
|
|
61
|
+
use_hashed_label: False
|
|
62
|
+
fuse_edge: True
|
|
63
|
+
multi_dataset: none
|
|
64
|
+
cleaning:
|
|
65
|
+
used_methods: none
|
|
66
|
+
transformation:
|
|
67
|
+
used_methods: none
|
|
68
|
+
|
|
69
|
+
featurization:
|
|
70
|
+
used_method: graph2vec
|
|
71
|
+
emb_dim: 256 # dimension of the graph embedding
|
|
72
|
+
epochs: 100 # graph2vec training epochs (Section 6.4)
|
|
73
|
+
seed: 0
|
|
74
|
+
training_split: train
|
|
75
|
+
tokenization:
|
|
76
|
+
used_method: none # graph2vec only uses node and edge types
|
|
77
|
+
graph2vec:
|
|
78
|
+
wl_iterations: 4 # depth d of the WL kernel: 4 on large graphs (CADETS, THEIA), 3 on small ones (CLEARSCOPE)
|
|
79
|
+
negative: 15
|
|
80
|
+
min_count: 1
|
|
81
|
+
alpha: 0.025
|
|
82
|
+
infer_epochs: 100
|
|
83
|
+
num_workers: 1 # several workers make the training of gensim non-deterministic
|
|
84
|
+
feat_inference:
|
|
85
|
+
to_remove: True
|
|
86
|
+
|
|
87
|
+
batching:
|
|
88
|
+
save_on_disk: False
|
|
89
|
+
node_features: node_type
|
|
90
|
+
edge_features: none
|
|
91
|
+
fix_buggy_graph_reindexer: True
|
|
92
|
+
# One graph per snapshot (time window)
|
|
93
|
+
global_batching:
|
|
94
|
+
used_method: none
|
|
95
|
+
intra_graph_batching:
|
|
96
|
+
used_methods: none
|
|
97
|
+
inter_graph_batching:
|
|
98
|
+
used_method: none
|
|
99
|
+
|
|
100
|
+
training:
|
|
101
|
+
used_method: default
|
|
102
|
+
seed: 0
|
|
103
|
+
deterministic: False
|
|
104
|
+
num_epochs: 20
|
|
105
|
+
patience: 30
|
|
106
|
+
lr: 0.0003
|
|
107
|
+
weight_decay: 0.0
|
|
108
|
+
node_hid_dim: 128 # hidden size of the anomaly detector
|
|
109
|
+
node_out_dim: 256 # the TextRCNN outputs a graph embedding of size `featurization.emb_dim`
|
|
110
|
+
grad_accumulation: 1
|
|
111
|
+
encoder:
|
|
112
|
+
dropout: 0.2
|
|
113
|
+
used_methods: textrcnn
|
|
114
|
+
textrcnn:
|
|
115
|
+
sequence_length: 128 # L: 128 on CADETS and THEIA, 32 on CLEARSCOPE
|
|
116
|
+
num_layers: 5
|
|
117
|
+
rnn_type: lstm
|
|
118
|
+
decoder:
|
|
119
|
+
used_methods: predict_snapshot_embedding
|
|
120
|
+
predict_snapshot_embedding:
|
|
121
|
+
decoder: none
|
|
122
|
+
top_k: 0
|
|
123
|
+
|
|
124
|
+
evaluation:
|
|
125
|
+
viz_malicious_nodes: False
|
|
126
|
+
ground_truth_version: orthrus
|
|
127
|
+
best_model_selection: best_val_score
|
|
128
|
+
used_method: tw_evaluation
|
|
129
|
+
tw_evaluation:
|
|
130
|
+
threshold_method: max_val_loss
|
|
131
|
+
node_evaluation:
|
|
132
|
+
threshold_method: max_val_loss
|
|
133
|
+
use_kmeans: False
|
|
134
|
+
node_tw_evaluation:
|
|
135
|
+
threshold_method: max_val_loss
|
|
136
|
+
use_kmeans: False
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
construction:
|
|
2
|
+
used_method: default
|
|
3
|
+
use_all_files: True
|
|
4
|
+
mimicry_edge_num: 0
|
|
5
|
+
time_window_size: 15.0
|
|
6
|
+
use_hashed_label: False
|
|
7
|
+
fuse_edge: True
|
|
8
|
+
node_label_features:
|
|
9
|
+
subject: path, cmd_line
|
|
10
|
+
file: path
|
|
11
|
+
netflow: remote_ip
|
|
12
|
+
multi_dataset: none
|
|
13
|
+
cleaning:
|
|
14
|
+
used_methods: none
|
|
15
|
+
transformation:
|
|
16
|
+
used_methods: rcaid_pseudo_graph
|
|
17
|
+
rcaid_pseudo_graph:
|
|
18
|
+
use_pruning: True
|
|
19
|
+
prune_threshold: 0.5
|
|
20
|
+
root_node_types: file, netflow
|
|
21
|
+
keep_original_edges: True
|
|
22
|
+
merge_same_label_roots: True
|
|
23
|
+
max_roots_per_node: 16
|
|
24
|
+
|
|
25
|
+
featurization:
|
|
26
|
+
epochs: 5
|
|
27
|
+
emb_dim: 128
|
|
28
|
+
seed: 0
|
|
29
|
+
training_split: all
|
|
30
|
+
used_method: doc2vec
|
|
31
|
+
tokenization:
|
|
32
|
+
used_method: nltk
|
|
33
|
+
nltk:
|
|
34
|
+
type_aware: True
|
|
35
|
+
substitutions: none
|
|
36
|
+
doc2vec:
|
|
37
|
+
include_neighbors: False
|
|
38
|
+
truncate_process_name: True
|
|
39
|
+
alpha: 0.025
|
|
40
|
+
workers: 1
|
|
41
|
+
feat_inference:
|
|
42
|
+
to_remove: True
|
|
43
|
+
|
|
44
|
+
batching:
|
|
45
|
+
save_on_disk: False
|
|
46
|
+
node_features: node_emb
|
|
47
|
+
edge_features: none
|
|
48
|
+
fix_buggy_graph_reindexer: False
|
|
49
|
+
global_batching:
|
|
50
|
+
used_method: none
|
|
51
|
+
intra_graph_batching:
|
|
52
|
+
used_methods: none
|
|
53
|
+
inter_graph_batching:
|
|
54
|
+
used_method: none
|
|
55
|
+
training:
|
|
56
|
+
used_method: default
|
|
57
|
+
seed: 0
|
|
58
|
+
deterministic: False
|
|
59
|
+
num_epochs: 12
|
|
60
|
+
patience: 3
|
|
61
|
+
lr: 0.0001
|
|
62
|
+
weight_decay: 0.0001
|
|
63
|
+
node_hid_dim: 128
|
|
64
|
+
node_out_dim: 128
|
|
65
|
+
grad_accumulation: 1
|
|
66
|
+
encoder:
|
|
67
|
+
dropout: 0.5
|
|
68
|
+
used_methods: rcaid_gat
|
|
69
|
+
rcaid_gat:
|
|
70
|
+
num_layers: 2
|
|
71
|
+
num_heads: 1
|
|
72
|
+
decoder:
|
|
73
|
+
used_methods: predict_process_tag
|
|
74
|
+
predict_process_tag:
|
|
75
|
+
decoder: node_mlp
|
|
76
|
+
balanced_loss: False
|
|
77
|
+
detection: kmeans
|
|
78
|
+
node_mlp:
|
|
79
|
+
architecture_str: none
|
|
80
|
+
|
|
81
|
+
evaluation:
|
|
82
|
+
viz_malicious_nodes: False
|
|
83
|
+
ground_truth_version: orthrus
|
|
84
|
+
best_model_selection: best_adp
|
|
85
|
+
used_method: node_evaluation
|
|
86
|
+
node_evaluation:
|
|
87
|
+
threshold_method: max_val_loss
|
|
88
|
+
use_kmeans: False
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# ShadeWatcher (Zeng et al., IEEE S&P 2022): "ShadeWatcher: Recommendation-guided Cyber Threat
|
|
2
|
+
# Analysis using System Audit Records". Threat detection as a recommendation problem: system
|
|
3
|
+
# entities interact with other entities as users with items, and interactions that an entity
|
|
4
|
+
# would unlikely "prefer" are threats. A knowledge graph (KG) joins the interactions,
|
|
5
|
+
# (h, interact, t), with the events of the provenance graph as side information, (h, event, t).
|
|
6
|
+
# TransR embeds the entities and relations of the KG (first-order information), GNN layers
|
|
7
|
+
# propagate these embeddings along the KG with a relation-aware attention (KGAT-style) and a
|
|
8
|
+
# GraphSAGE aggregator (higher-order information), and the inner product of the concatenated
|
|
9
|
+
# embeddings of two entities is the probability that they would *not* interact. The GNN is
|
|
10
|
+
# trained with a BPR loss against random interactions, TransR with a pairwise loss against
|
|
11
|
+
# corrupted triples, on benign data only.
|
|
12
|
+
#
|
|
13
|
+
# Mapping onto PIDSMaker:
|
|
14
|
+
# - each edge of a time window is both an interaction and a KG triple whose relation is the edge
|
|
15
|
+
# type (`shadewatcher` encoder); repeated events are merged per (src, type, dst) (`merge_edges`)
|
|
16
|
+
# so that triples are unique, as in the KG of ShadeWatcher;
|
|
17
|
+
# - the TransR loss is computed by the encoder and added to the loss of the objective; the
|
|
18
|
+
# interactions are scored by `predict_edge_contrastive` with the BPR loss (`loss: bpr`), two
|
|
19
|
+
# negatives per interaction sharing its source (`uniform_dst`, `neg_ratio: 2`, as
|
|
20
|
+
# `inter_pos_rate`), and the negated inner product (`negate`: an observed interaction has a low
|
|
21
|
+
# probability of not happening);
|
|
22
|
+
# - the anomaly score of an interaction is the inner product, and an entity's is the max over its
|
|
23
|
+
# interactions (`node_evaluation`, both endpoints), so that alerts are entity-level and comparable
|
|
24
|
+
# with the other PIDSs.
|
|
25
|
+
#
|
|
26
|
+
# Differences with the original implementation (https://github.com/jun-zeng/ShadeWatcher):
|
|
27
|
+
# - Entity embeddings: ShadeWatcher learns one embedding per entity ID over a single KG of all
|
|
28
|
+
# the audit data, randomly split 80/10/10 into interactions to train, validate and test. Here,
|
|
29
|
+
# models are trained on the first days and tested on later days, whose entities are mostly
|
|
30
|
+
# unseen: a per-ID embedding would stay untrained for them. The embedding of an entity is
|
|
31
|
+
# instead a linear projection of its features: a word2vec embedding of its label (process
|
|
32
|
+
# path and command line, file path, IP and port, i.e. the attributes of ShadeWatcher's
|
|
33
|
+
# entities) and its type, trained on the training split only. Add `node_id_embedding` to the
|
|
34
|
+
# encoders (`--training.encoder.used_methods=shadewatcher,node_id_embedding`) to concatenate a
|
|
35
|
+
# learned ID embedding to the features, closer to ShadeWatcher but transductive.
|
|
36
|
+
# - Interactions: ShadeWatcher pairs the root data object of each behavior (a subgraph found by
|
|
37
|
+
# a forward DFS from a data object) with every entity of that behavior, i.e. multi-hop causal
|
|
38
|
+
# pairs; here, interactions are the endpoints of the events (1-hop). The KG and its GNN
|
|
39
|
+
# propagation are built per time window (15 min) instead of over the whole log, and the noise
|
|
40
|
+
# reduction of ShadeWatcher's parser is not applied. As in the code (inverse relations are
|
|
41
|
+
# commented out in `recommend/util/gnn_data.py`), each node only aggregates the tails of the
|
|
42
|
+
# triples it is the head of: nodes that are only destinations of events get no neighborhood
|
|
43
|
+
# information from the GNN layers.
|
|
44
|
+
# - Training: the BPR and TransR losses are summed and optimized jointly at each batch (time
|
|
45
|
+
# window), as in the objective of the paper (L = L_first + L_higher + lambda ||Theta||, lambda
|
|
46
|
+
# as Adam's weight decay), whereas the code alternates one epoch of each with two optimizers
|
|
47
|
+
# over random batches of 1024 interactions/triples. Negatives are drawn among the nodes of the
|
|
48
|
+
# window instead of all the entities. The BPR loss averages the pairs (interaction, negative),
|
|
49
|
+
# whereas the code compares each interaction to the sum of the scores of its 2 negatives.
|
|
50
|
+
# - TransR: squared L2 distance as the code (the paper writes L1), with the margin γ = 1 of the
|
|
51
|
+
# paper (defined but unused in the code). The attention is recomputed from the current TransR
|
|
52
|
+
# embeddings at each batch, without gradient, whereas the code computes it once before training.
|
|
53
|
+
# - Threshold and epochs: the threshold is the max score of validation interactions
|
|
54
|
+
# (`max_val_loss`) instead of a fixed value grid-searched on labelled validation data (-0.5 in
|
|
55
|
+
# the paper, 1.5 in the code), and the reported epoch is chosen as for the other PIDSs
|
|
56
|
+
# (`best_adp`), among 30 epochs as in the paper.
|
|
57
|
+
# - Model adaptation from analyst feedback on false positives is not implemented.
|
|
58
|
+
|
|
59
|
+
_include_yml: default
|
|
60
|
+
|
|
61
|
+
construction:
|
|
62
|
+
used_method: default
|
|
63
|
+
use_all_files: True
|
|
64
|
+
mimicry_edge_num: 0
|
|
65
|
+
time_window_size: 15.0
|
|
66
|
+
use_hashed_label: False
|
|
67
|
+
fuse_edge: True
|
|
68
|
+
node_label_features:
|
|
69
|
+
subject: type, path, cmd_line
|
|
70
|
+
file: type, path
|
|
71
|
+
netflow: type, remote_ip, remote_port
|
|
72
|
+
multi_dataset: none
|
|
73
|
+
transformation:
|
|
74
|
+
used_methods: merge_edges
|
|
75
|
+
merge_edges:
|
|
76
|
+
per_edge_type: True
|
|
77
|
+
|
|
78
|
+
featurization:
|
|
79
|
+
emb_dim: 128
|
|
80
|
+
epochs: 50
|
|
81
|
+
training_split: train
|
|
82
|
+
seed: 0
|
|
83
|
+
used_method: word2vec
|
|
84
|
+
tokenization:
|
|
85
|
+
used_method: nltk
|
|
86
|
+
nltk:
|
|
87
|
+
type_aware: True
|
|
88
|
+
substitutions: none
|
|
89
|
+
feat_inference:
|
|
90
|
+
to_remove: True
|
|
91
|
+
|
|
92
|
+
batching:
|
|
93
|
+
node_features: node_emb,node_type
|
|
94
|
+
edge_features: none
|
|
95
|
+
fix_buggy_graph_reindexer: True
|
|
96
|
+
global_batching:
|
|
97
|
+
used_method: none
|
|
98
|
+
intra_graph_batching:
|
|
99
|
+
used_methods: none
|
|
100
|
+
inter_graph_batching:
|
|
101
|
+
used_method: none
|
|
102
|
+
|
|
103
|
+
training:
|
|
104
|
+
used_method: default
|
|
105
|
+
seed: 0
|
|
106
|
+
deterministic: False
|
|
107
|
+
num_epochs: 30
|
|
108
|
+
patience: 5
|
|
109
|
+
lr: 0.001
|
|
110
|
+
weight_decay: 0.00001 # λ = 1e-5
|
|
111
|
+
node_hid_dim: 32 # size of the TransR entity embeddings
|
|
112
|
+
node_out_dim: 80 # 32 (TransR) + 32 + 16 (GNN layers), concatenated
|
|
113
|
+
grad_accumulation: 1
|
|
114
|
+
stable_optim: False
|
|
115
|
+
fuse_duplicate_edges_training: False
|
|
116
|
+
encoder:
|
|
117
|
+
dropout: 0.2
|
|
118
|
+
used_methods: shadewatcher
|
|
119
|
+
shadewatcher:
|
|
120
|
+
hidden_dims: 32,16
|
|
121
|
+
kg_dim: 32
|
|
122
|
+
kg_neg_ratio: 2
|
|
123
|
+
kg_margin: 1.0
|
|
124
|
+
decoder:
|
|
125
|
+
used_methods: predict_edge_contrastive
|
|
126
|
+
predict_edge_contrastive:
|
|
127
|
+
loss: bpr
|
|
128
|
+
neg_sampling: uniform_dst
|
|
129
|
+
neg_ratio: 2.0
|
|
130
|
+
decoder: inner_product
|
|
131
|
+
inner_product:
|
|
132
|
+
dropout: 0.0
|
|
133
|
+
negate: True
|
|
134
|
+
use_few_shot: False
|
|
135
|
+
|
|
136
|
+
evaluation:
|
|
137
|
+
viz_malicious_nodes: False
|
|
138
|
+
ground_truth_version: orthrus
|
|
139
|
+
best_model_selection: best_adp
|
|
140
|
+
used_method: node_evaluation
|
|
141
|
+
node_evaluation:
|
|
142
|
+
threshold_method: max_val_loss
|
|
143
|
+
max_val_loss:
|
|
144
|
+
alpha: 1.0
|
|
145
|
+
use_dst_node_loss: True
|
|
146
|
+
use_kmeans: False
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
construction:
|
|
2
|
+
used_method: default
|
|
3
|
+
use_all_files: True
|
|
4
|
+
mimicry_edge_num: 0
|
|
5
|
+
time_window_size: 15.0
|
|
6
|
+
use_hashed_label: False
|
|
7
|
+
fuse_edge: True
|
|
8
|
+
node_label_features:
|
|
9
|
+
subject: type, path, cmd_line
|
|
10
|
+
file: type, path
|
|
11
|
+
netflow: type, remote_ip, remote_port
|
|
12
|
+
multi_dataset: none
|
|
13
|
+
cleaning:
|
|
14
|
+
used_methods: none
|
|
15
|
+
transformation:
|
|
16
|
+
used_methods: none
|
|
17
|
+
|
|
18
|
+
featurization:
|
|
19
|
+
used_method: only_type
|
|
20
|
+
tokenization:
|
|
21
|
+
used_method: none
|
|
22
|
+
feat_inference:
|
|
23
|
+
to_remove: True
|
|
24
|
+
|
|
25
|
+
batching:
|
|
26
|
+
save_on_disk: False
|
|
27
|
+
node_features: edges_distribution
|
|
28
|
+
edges_distribution_scaling: none
|
|
29
|
+
edge_features: none
|
|
30
|
+
fix_buggy_graph_reindexer: True
|
|
31
|
+
global_batching:
|
|
32
|
+
used_method: none
|
|
33
|
+
intra_graph_batching:
|
|
34
|
+
used_methods: none
|
|
35
|
+
inter_graph_batching:
|
|
36
|
+
used_method: none
|
|
37
|
+
training:
|
|
38
|
+
used_method: threatrace
|
|
39
|
+
seed: 0
|
|
40
|
+
deterministic: False
|
|
41
|
+
num_epochs: 12
|
|
42
|
+
patience: 3
|
|
43
|
+
lr: 0.01
|
|
44
|
+
weight_decay: 0.0005
|
|
45
|
+
node_hid_dim: 32
|
|
46
|
+
node_out_dim: 3
|
|
47
|
+
grad_accumulation: 1
|
|
48
|
+
threatrace:
|
|
49
|
+
ratio_threshold: 1.5 # `thre` of CADETS and THEIA in the original
|
|
50
|
+
max_submodels: 100
|
|
51
|
+
max_retrain_epochs: 149
|
|
52
|
+
retrain_loss_threshold: 1.0
|
|
53
|
+
max_rounds_without_progress: 3
|
|
54
|
+
encoder:
|
|
55
|
+
dropout: 0.5
|
|
56
|
+
used_methods: sage
|
|
57
|
+
sage:
|
|
58
|
+
activation: relu
|
|
59
|
+
num_layers: 2
|
|
60
|
+
decoder:
|
|
61
|
+
used_methods: predict_node_type
|
|
62
|
+
predict_node_type:
|
|
63
|
+
decoder: none
|
|
64
|
+
balanced_loss: False
|
|
65
|
+
|
|
66
|
+
evaluation:
|
|
67
|
+
viz_malicious_nodes: False
|
|
68
|
+
ground_truth_version: orthrus
|
|
69
|
+
best_model_selection: best_adp
|
|
70
|
+
used_method: node_evaluation
|
|
71
|
+
node_evaluation:
|
|
72
|
+
threshold_method: threatrace
|
|
73
|
+
use_kmeans: False
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Hyperparameters of LARES on OpTC (`OPTC_base` in src/utils/config.py of the LARES repository),
|
|
2
|
+
# loaded with `--tuned`. The defaults of lares.yml are those of LANL.
|
|
3
|
+
construction:
|
|
4
|
+
time_window_size: 30.0 # 30 one-minute files per snapshot
|
|
5
|
+
training:
|
|
6
|
+
seed: 42
|
|
7
|
+
lr: 0.001
|
|
8
|
+
node_hid_dim: 128
|
|
9
|
+
node_out_dim: 128
|
|
10
|
+
evaluation:
|
|
11
|
+
host_two_stage_evaluation:
|
|
12
|
+
alpha: 5
|
|
13
|
+
beta: 30
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
embedding_viz:
|
|
2
|
+
activated: false
|
|
3
|
+
embeddings: "word2vec" # word2vec | encoder | both
|
|
4
|
+
method: "umap" # umap | tsne
|
|
5
|
+
max_benign_nodes: "all" # int or "all"
|
|
6
|
+
max_attack_nodes: "all" # int or "all"
|
|
7
|
+
default_hops: 0
|
|
8
|
+
show_trajectories: true
|
|
9
|
+
show_stats_overlay: true
|
|
10
|
+
n_neighbors: 30
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
|
|
5
|
+
from pidsmaker.utils.data_utils import (
|
|
6
|
+
get_original_node_ids,
|
|
7
|
+
load_all_datasets,
|
|
8
|
+
set_original_node_ids,
|
|
9
|
+
)
|
|
10
|
+
from pidsmaker.utils.utils import get_device, log, log_start, set_seed
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_preprocessed_graphs(cfg):
|
|
14
|
+
if not cfg._save_graph_preprocessing:
|
|
15
|
+
log("Force graphs loading to save storage.")
|
|
16
|
+
return get_data(cfg)
|
|
17
|
+
|
|
18
|
+
log("Loading preprocessed graphs...")
|
|
19
|
+
out_dir = cfg.batching._preprocessed_graphs_dir
|
|
20
|
+
out_file = os.path.join(out_dir, "torch_graphs.pkl")
|
|
21
|
+
node_ids_file = os.path.join(out_dir, "original_node_ids.pkl")
|
|
22
|
+
# Original IDs of the compacted node IDs (`batching.compact_node_ids`)
|
|
23
|
+
set_original_node_ids(torch.load(node_ids_file) if os.path.exists(node_ids_file) else None)
|
|
24
|
+
return torch.load(out_file)
|
|
25
|
+
|
|
26
|
+
def get_data(cfg):
|
|
27
|
+
device = get_device(cfg)
|
|
28
|
+
return load_all_datasets(cfg, device)
|
|
29
|
+
|
|
30
|
+
def main(cfg):
|
|
31
|
+
set_seed(cfg)
|
|
32
|
+
log_start(__file__)
|
|
33
|
+
|
|
34
|
+
if not cfg._save_graph_preprocessing:
|
|
35
|
+
log("Skipping task to save storage.")
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
train_data, val_data, test_data, max_node_num = get_data(cfg)
|
|
39
|
+
|
|
40
|
+
out_dir = cfg.batching._preprocessed_graphs_dir
|
|
41
|
+
out_file = os.path.join(out_dir, "torch_graphs.pkl")
|
|
42
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
43
|
+
log(f"Saving preprocessed graphs to {out_file}...")
|
|
44
|
+
torch.save((train_data, val_data, test_data, max_node_num), out_file)
|
|
45
|
+
node_ids_file = os.path.join(out_dir, "original_node_ids.pkl")
|
|
46
|
+
if get_original_node_ids() is not None:
|
|
47
|
+
torch.save(get_original_node_ids(), node_ids_file)
|
|
48
|
+
elif os.path.exists(node_ids_file):
|
|
49
|
+
os.remove(node_ids_file)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from pidsmaker.config import update_cfg_for_multi_dataset
|
|
2
|
+
from pidsmaker.preprocessing.build_graph_methods import (
|
|
3
|
+
build_default_graphs,
|
|
4
|
+
build_magic_graphs,
|
|
5
|
+
)
|
|
6
|
+
from pidsmaker.utils.utils import get_multi_datasets
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main_from_config(cfg):
|
|
10
|
+
graph_method = cfg.construction.used_method
|
|
11
|
+
if graph_method == "default":
|
|
12
|
+
build_default_graphs.main(cfg)
|
|
13
|
+
elif graph_method == "magic":
|
|
14
|
+
build_default_graphs.main(cfg)
|
|
15
|
+
build_magic_graphs.main(cfg)
|
|
16
|
+
else:
|
|
17
|
+
raise ValueError(f"Unrecognized graph method: {graph_method}")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main(cfg):
|
|
21
|
+
multi_datasets = get_multi_datasets(cfg)
|
|
22
|
+
if "none" in multi_datasets:
|
|
23
|
+
main_from_config(cfg)
|
|
24
|
+
|
|
25
|
+
# Multi-dataset mode
|
|
26
|
+
else:
|
|
27
|
+
for dataset in multi_datasets:
|
|
28
|
+
updated_cfg, should_restart = update_cfg_for_multi_dataset(cfg, dataset)
|
|
29
|
+
|
|
30
|
+
if should_restart["construction"]:
|
|
31
|
+
main_from_config(updated_cfg)
|