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.

Files changed (338) hide show
  1. pidsmaker/__init__.py +22 -0
  2. pidsmaker/cli.py +32 -0
  3. pidsmaker/config/__init__.py +2 -0
  4. pidsmaker/config/config.py +2100 -0
  5. pidsmaker/config/pipeline.py +1768 -0
  6. pidsmaker/config/schemas.py +1032 -0
  7. pidsmaker/datasets.py +222 -0
  8. pidsmaker/debug_tests.py +30 -0
  9. pidsmaker/decoders/__init__.py +5 -0
  10. pidsmaker/decoders/custom_edge_mlp_decoder.py +17 -0
  11. pidsmaker/decoders/custom_mlp_decoder.py +10 -0
  12. pidsmaker/decoders/edge_linear_decoder.py +16 -0
  13. pidsmaker/decoders/inner_product_decoder.py +18 -0
  14. pidsmaker/decoders/nodlink_decoder.py +56 -0
  15. pidsmaker/detection/__init__.py +0 -0
  16. pidsmaker/detection/evaluation_methods/__init__.py +9 -0
  17. pidsmaker/detection/evaluation_methods/edge_evaluation.py +259 -0
  18. pidsmaker/detection/evaluation_methods/evaluation_utils.py +1730 -0
  19. pidsmaker/detection/evaluation_methods/host_two_stage_evaluation.py +115 -0
  20. pidsmaker/detection/evaluation_methods/node_evaluation.py +463 -0
  21. pidsmaker/detection/evaluation_methods/node_tw_evaluation.py +196 -0
  22. pidsmaker/detection/evaluation_methods/plot.py +192 -0
  23. pidsmaker/detection/evaluation_methods/queue_evaluation.py +451 -0
  24. pidsmaker/detection/evaluation_methods/tw_evaluation.py +95 -0
  25. pidsmaker/detection/flash_detection.py +162 -0
  26. pidsmaker/detection/magic_knn.py +190 -0
  27. pidsmaker/detection/node_scoring.py +52 -0
  28. pidsmaker/detection/threatrace_detection.py +65 -0
  29. pidsmaker/detection/training_methods/__init__.py +1 -0
  30. pidsmaker/detection/training_methods/inference_loop.py +293 -0
  31. pidsmaker/detection/training_methods/ocrapt_early_stop.py +165 -0
  32. pidsmaker/detection/training_methods/threatrace_training.py +169 -0
  33. pidsmaker/detection/training_methods/training_loop.py +377 -0
  34. pidsmaker/encoders/__init__.py +22 -0
  35. pidsmaker/encoders/argus_encoder.py +69 -0
  36. pidsmaker/encoders/custom_mlp.py +75 -0
  37. pidsmaker/encoders/custom_mlp_encoder.py +10 -0
  38. pidsmaker/encoders/egraphsage_encoder.py +56 -0
  39. pidsmaker/encoders/gat.py +67 -0
  40. pidsmaker/encoders/gcn.py +27 -0
  41. pidsmaker/encoders/gin.py +48 -0
  42. pidsmaker/encoders/glstm.py +298 -0
  43. pidsmaker/encoders/graph_attention.py +63 -0
  44. pidsmaker/encoders/gru.py +29 -0
  45. pidsmaker/encoders/hetero/__init__.py +4 -0
  46. pidsmaker/encoders/hetero/ancestor_encoder.py +98 -0
  47. pidsmaker/encoders/hetero/entity_encoder.py +33 -0
  48. pidsmaker/encoders/hetero/event_encoder.py +81 -0
  49. pidsmaker/encoders/hetero/hetero_graph_transformer.py +40 -0
  50. pidsmaker/encoders/lares_encoder.py +68 -0
  51. pidsmaker/encoders/linear_encoder.py +16 -0
  52. pidsmaker/encoders/magic_encoder.py +161 -0
  53. pidsmaker/encoders/rcaid_encoder.py +81 -0
  54. pidsmaker/encoders/rgcn.py +75 -0
  55. pidsmaker/encoders/sage.py +51 -0
  56. pidsmaker/encoders/shadewatcher_encoder.py +149 -0
  57. pidsmaker/encoders/sum_aggregation.py +20 -0
  58. pidsmaker/encoders/temporal_wrappers.py +80 -0
  59. pidsmaker/encoders/textrcnn.py +82 -0
  60. pidsmaker/encoders/tgn_encoder.py +193 -0
  61. pidsmaker/experiments/tuning.py +102 -0
  62. pidsmaker/experiments/uncertainty.py +261 -0
  63. pidsmaker/factory.py +1456 -0
  64. pidsmaker/featurization/__init__.py +0 -0
  65. pidsmaker/featurization/feat_inference_methods/__init__.py +7 -0
  66. pidsmaker/featurization/feat_inference_methods/feat_inference_HFH.py +31 -0
  67. pidsmaker/featurization/feat_inference_methods/feat_inference_TRW.py +67 -0
  68. pidsmaker/featurization/feat_inference_methods/feat_inference_alacarte.py +16 -0
  69. pidsmaker/featurization/feat_inference_methods/feat_inference_doc2vec.py +54 -0
  70. pidsmaker/featurization/feat_inference_methods/feat_inference_fasttext.py +38 -0
  71. pidsmaker/featurization/feat_inference_methods/feat_inference_flash.py +70 -0
  72. pidsmaker/featurization/feat_inference_methods/feat_inference_graph2vec.py +85 -0
  73. pidsmaker/featurization/feat_inference_methods/feat_inference_ocrapt_features.py +95 -0
  74. pidsmaker/featurization/feat_inference_methods/feat_inference_pretrained.py +1729 -0
  75. pidsmaker/featurization/feat_inference_methods/feat_inference_word2vec.py +56 -0
  76. pidsmaker/featurization/featurization_methods/__init__.py +0 -0
  77. pidsmaker/featurization/featurization_methods/build_trw.py +67 -0
  78. pidsmaker/featurization/featurization_methods/featurization_alacarte.py +748 -0
  79. pidsmaker/featurization/featurization_methods/featurization_doc2vec.py +99 -0
  80. pidsmaker/featurization/featurization_methods/featurization_fasttext.py +75 -0
  81. pidsmaker/featurization/featurization_methods/featurization_flash.py +203 -0
  82. pidsmaker/featurization/featurization_methods/featurization_graph2vec.py +243 -0
  83. pidsmaker/featurization/featurization_methods/featurization_trw.py +115 -0
  84. pidsmaker/featurization/featurization_methods/featurization_word2vec.py +87 -0
  85. pidsmaker/featurization/featurization_utils.py +275 -0
  86. pidsmaker/featurization/utils/build_random_walks.py +68 -0
  87. pidsmaker/featurization/utils/trw.py +203 -0
  88. pidsmaker/hetero.py +81 -0
  89. pidsmaker/losses.py +170 -0
  90. pidsmaker/main.py +377 -0
  91. pidsmaker/mimicry.py +284 -0
  92. pidsmaker/model.py +382 -0
  93. pidsmaker/objectives/__init__.py +16 -0
  94. pidsmaker/objectives/autoencode_edge_emb.py +43 -0
  95. pidsmaker/objectives/deep_graph_infomax.py +94 -0
  96. pidsmaker/objectives/detect_few_shot.py +21 -0
  97. pidsmaker/objectives/one_class.py +75 -0
  98. pidsmaker/objectives/predict_edge_contrastive.py +165 -0
  99. pidsmaker/objectives/predict_edge_supervised.py +77 -0
  100. pidsmaker/objectives/predict_edge_type.py +28 -0
  101. pidsmaker/objectives/predict_masked_struct.py +49 -0
  102. pidsmaker/objectives/predict_node_type.py +36 -0
  103. pidsmaker/objectives/predict_process_tag.py +169 -0
  104. pidsmaker/objectives/predict_snapshot_embedding.py +97 -0
  105. pidsmaker/objectives/reconstruct_edge_emb.py +16 -0
  106. pidsmaker/objectives/reconstruct_masked_feat.py +51 -0
  107. pidsmaker/objectives/reconstruct_node_emb.py +13 -0
  108. pidsmaker/objectives/reconstruct_node_feat.py +13 -0
  109. pidsmaker/objectives/validation_wrapper.py +55 -0
  110. pidsmaker/preprocessing/__init__.py +0 -0
  111. pidsmaker/preprocessing/build_graph_methods/__init__.py +1 -0
  112. pidsmaker/preprocessing/build_graph_methods/build_default_graphs.py +830 -0
  113. pidsmaker/preprocessing/build_graph_methods/build_magic_graphs.py +220 -0
  114. pidsmaker/preprocessing/cleaning.py +258 -0
  115. pidsmaker/preprocessing/transformation_methods/__init__.py +2 -0
  116. pidsmaker/preprocessing/transformation_methods/attack_generation/synthetic_attack_naive.py +194 -0
  117. pidsmaker/preprocessing/transformation_methods/transformation_dag.py +28 -0
  118. pidsmaker/preprocessing/transformation_methods/transformation_merge_edges.py +136 -0
  119. pidsmaker/preprocessing/transformation_methods/transformation_rcaid_pseudo_graph.py +510 -0
  120. pidsmaker/preprocessing/transformation_methods/transformation_undirected.py +24 -0
  121. pidsmaker/preprocessing/transformation_methods/transformation_utils.py +36 -0
  122. pidsmaker/pretrained/__init__.py +5 -0
  123. pidsmaker/pretrained/data/__init__.py +4 -0
  124. pidsmaker/pretrained/data/behavior_signatures.py +548 -0
  125. pidsmaker/pretrained/data/canonical_tokens.py +1035 -0
  126. pidsmaker/pretrained/data/edge_filter.py +381 -0
  127. pidsmaker/pretrained/data/entity_classes.py +476 -0
  128. pidsmaker/pretrained/data/sampler.py +926 -0
  129. pidsmaker/pretrained/data/tokenizer_bpe.py +1659 -0
  130. pidsmaker/pretrained/detect.py +1432 -0
  131. pidsmaker/pretrained/embedding_generator.py +252 -0
  132. pidsmaker/pretrained/finetune.py +1437 -0
  133. pidsmaker/pretrained/models/__init__.py +20 -0
  134. pidsmaker/pretrained/models/behavior.py +348 -0
  135. pidsmaker/pretrained/models/bert.py +286 -0
  136. pidsmaker/pretrained/models/deepwalk.py +128 -0
  137. pidsmaker/pretrained/models/dgi.py +120 -0
  138. pidsmaker/pretrained/models/gae.py +114 -0
  139. pidsmaker/pretrained/models/gnn_distill.py +475 -0
  140. pidsmaker/pretrained/models/graphmae.py +373 -0
  141. pidsmaker/pretrained/models/hf_pretrained.py +213 -0
  142. pidsmaker/pretrained/models/llama.py +110 -0
  143. pidsmaker/pretrained/models/modernbert.py +567 -0
  144. pidsmaker/pretrained/models/roberta.py +147 -0
  145. pidsmaker/pretrained/models/rope_utils.py +99 -0
  146. pidsmaker/pretrained/models/ropebert.py +322 -0
  147. pidsmaker/pretrained/models/spider.py +204 -0
  148. pidsmaker/pretrained/models/tgn.py +770 -0
  149. pidsmaker/pretrained/pretrain/__init__.py +3 -0
  150. pidsmaker/pretrained/pretrain/pretrain_behavior_cluster.py +513 -0
  151. pidsmaker/pretrained/pretrain/pretrain_common.py +585 -0
  152. pidsmaker/pretrained/pretrain/pretrain_deepwalk.py +31 -0
  153. pidsmaker/pretrained/pretrain/pretrain_dgi.py +143 -0
  154. pidsmaker/pretrained/pretrain/pretrain_gae.py +143 -0
  155. pidsmaker/pretrained/pretrain/pretrain_gnn_distill.py +438 -0
  156. pidsmaker/pretrained/pretrain/pretrain_graphmae.py +151 -0
  157. pidsmaker/pretrained/pretrain/pretrain_hf.py +169 -0
  158. pidsmaker/pretrained/pretrain/pretrain_main.py +276 -0
  159. pidsmaker/pretrained/pretrain/pretrain_mlm.py +491 -0
  160. pidsmaker/pretrained/pretrain/pretrain_spider.py +502 -0
  161. pidsmaker/pretrained/training_utils.py +157 -0
  162. pidsmaker/process_reapr_gt.py +101 -0
  163. pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_06.csv +8 -0
  164. pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_11.csv +4 -0
  165. pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_12.csv +43 -0
  166. pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_13.csv +24 -0
  167. pidsmaker/resources/Ground_Truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0411.csv +41 -0
  168. pidsmaker/resources/Ground_Truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0412.csv +0 -0
  169. pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_browser_0412.csv +1 -0
  170. pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +63 -0
  171. pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +56 -0
  172. pidsmaker/resources/Ground_Truth/orthrus/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +61 -0
  173. pidsmaker/resources/Ground_Truth/orthrus/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +58 -0
  174. pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_firefox_0410.csv +11 -0
  175. pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +11 -0
  176. pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_pine_0413.csv +14 -0
  177. pidsmaker/resources/Ground_Truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT.csv +19 -0
  178. pidsmaker/resources/Ground_Truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT_17.csv +107 -0
  179. pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_appstarter_0515.csv +26 -0
  180. pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_firefox_0517.csv +1 -0
  181. pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_lockwatch_0517.csv +17 -0
  182. pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_tester_0517.csv +8 -0
  183. pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_bits_0515.csv +54 -0
  184. pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_copykatz_0509.csv +87 -0
  185. pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_dns_0517.csv +11 -0
  186. pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_drakon_0517.csv +6 -0
  187. pidsmaker/resources/Ground_Truth/orthrus/E5-THEIA/node_THEIA_1_Firefox_Drakon_APT_BinFmt_Elevate_Inject.csv +70 -0
  188. pidsmaker/resources/Ground_Truth/orthrus/E5-TRACE/node_Trace_Firefox_Drakon.csv +71 -0
  189. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m1.csv +1 -0
  190. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m2.csv +1 -0
  191. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m3.csv +1 -0
  192. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m4.csv +5 -0
  193. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m5.csv +23 -0
  194. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m6.csv +18 -0
  195. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s1.csv +1 -0
  196. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s2.csv +1 -0
  197. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s3.csv +16 -0
  198. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s4.csv +22 -0
  199. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m1.csv +126 -0
  200. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m2.csv +105 -0
  201. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m3.csv +94 -0
  202. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m4.csv +139 -0
  203. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m5.csv +228 -0
  204. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m6.csv +131 -0
  205. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s1.csv +118 -0
  206. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s2.csv +89 -0
  207. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s3.csv +133 -0
  208. pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s4.csv +135 -0
  209. pidsmaker/resources/Ground_Truth/orthrus/carbanakv2_edr/carbanakv2_edr.csv +2453 -0
  210. pidsmaker/resources/Ground_Truth/orthrus/h051/node_h051_0925.csv +114 -0
  211. pidsmaker/resources/Ground_Truth/orthrus/h201/node_h201_0923.csv +2905 -0
  212. pidsmaker/resources/Ground_Truth/orthrus/h501/node_h501_0924.csv +749 -0
  213. pidsmaker/resources/Ground_Truth/orthrus/readme.md +98 -0
  214. pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_06.csv +3 -0
  215. pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_12.csv +655 -0
  216. pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_13.csv +770 -0
  217. pidsmaker/resources/Ground_Truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +0 -0
  218. pidsmaker/resources/Ground_Truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +18 -0
  219. pidsmaker/resources/Ground_Truth/reapr/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +42 -0
  220. pidsmaker/resources/Ground_Truth/reapr/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +81 -0
  221. pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_firefox_0410.csv +37 -0
  222. pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +9 -0
  223. pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_pine_0413.csv +40 -0
  224. pidsmaker/resources/Ground_Truth/threatrace/E3-CADETS/ground_truth.txt +12858 -0
  225. pidsmaker/resources/Ground_Truth/threatrace/E3-FIVEDIRECTIONS/ground_truth.txt +18420 -0
  226. pidsmaker/resources/Ground_Truth/threatrace/E3-THEIA/ground_truth.txt +25363 -0
  227. pidsmaker/resources/Ground_Truth/threatrace/E3-TRACE/ground_truth.txt +68265 -0
  228. pidsmaker/resources/Ground_Truth/threatrace/README.md +123 -0
  229. pidsmaker/resources/config/anomal_e.yml +25 -0
  230. pidsmaker/resources/config/argus.yml +56 -0
  231. pidsmaker/resources/config/attack_edges/cadets_e3.yml +435 -0
  232. pidsmaker/resources/config/attack_edges/cadets_e5.yml +407 -0
  233. pidsmaker/resources/config/attack_edges/theia_e3.yml +382 -0
  234. pidsmaker/resources/config/attack_edges/theia_e5.yml +387 -0
  235. pidsmaker/resources/config/attack_edges/trace_e3.yml +415 -0
  236. pidsmaker/resources/config/attack_edges/trace_e5.yml +417 -0
  237. pidsmaker/resources/config/default.yml +315 -0
  238. pidsmaker/resources/config/egraphsage.yml +95 -0
  239. pidsmaker/resources/config/euler.yml +104 -0
  240. pidsmaker/resources/config/eval/eval_set_clustering.json +3170 -0
  241. pidsmaker/resources/config/experiments/tuning/components/tuning_featurization_methods.yml +29 -0
  242. pidsmaker/resources/config/experiments/tuning/systems/clearscope_e5/tuning_orthrus.yml +14 -0
  243. pidsmaker/resources/config/experiments/tuning/systems/default/tuning_default_baselines.yml +13 -0
  244. pidsmaker/resources/config/experiments/tuning/systems/default/tuning_orthrus_fixed.yml +16 -0
  245. pidsmaker/resources/config/experiments/uncertainty/none.yml +5 -0
  246. pidsmaker/resources/config/experiments/uncertainty/run_n_times.yml +12 -0
  247. pidsmaker/resources/config/experiments/uncertainty/run_n_times_hyperparameters.yml +12 -0
  248. pidsmaker/resources/config/experiments/uncertainty/uncertainty.yml +22 -0
  249. pidsmaker/resources/config/flash.yml +79 -0
  250. pidsmaker/resources/config/jbeil.yml +65 -0
  251. pidsmaker/resources/config/kairos.yml +121 -0
  252. pidsmaker/resources/config/lares.yml +115 -0
  253. pidsmaker/resources/config/magic.yml +86 -0
  254. pidsmaker/resources/config/nodlink.yml +79 -0
  255. pidsmaker/resources/config/ocrapt.yml +91 -0
  256. pidsmaker/resources/config/orthrus.yml +120 -0
  257. pidsmaker/resources/config/orthrus_fixed.yml +17 -0
  258. pidsmaker/resources/config/orthrus_non_snooped.yml +17 -0
  259. pidsmaker/resources/config/pretrained/README.md +101 -0
  260. pidsmaker/resources/config/pretrained/cybergfm/cybergfm.yml +49 -0
  261. pidsmaker/resources/config/pretrained/pretrained.yml +190 -0
  262. pidsmaker/resources/config/pretrained/pretrained_flash.yml +9 -0
  263. pidsmaker/resources/config/pretrained/pretrained_kairos.yml +12 -0
  264. pidsmaker/resources/config/pretrained/pretrained_magic.yml +1 -0
  265. pidsmaker/resources/config/pretrained/pretrained_nodlink.yml +1 -0
  266. pidsmaker/resources/config/pretrained/pretrained_orthrus.yml +1 -0
  267. pidsmaker/resources/config/pretrained/pretrained_supervised.yml +13 -0
  268. pidsmaker/resources/config/pretrained/pretrained_threatrace.yml +8 -0
  269. pidsmaker/resources/config/pretrained/pretrained_velox.yml +14 -0
  270. pidsmaker/resources/config/prographer.yml +136 -0
  271. pidsmaker/resources/config/rcaid.yml +88 -0
  272. pidsmaker/resources/config/shadewatcher.yml +146 -0
  273. pidsmaker/resources/config/tests.yml +10 -0
  274. pidsmaker/resources/config/threatrace.yml +73 -0
  275. pidsmaker/resources/config/tuned_baselines/optc_net/tuned_argus.yml +4 -0
  276. pidsmaker/resources/config/tuned_baselines/optc_net/tuned_lares.yml +13 -0
  277. pidsmaker/resources/config/velox.yml +10 -0
  278. pidsmaker/resources/config/viz_config.yml +10 -0
  279. pidsmaker/tasks/__init__.py +10 -0
  280. pidsmaker/tasks/batching.py +49 -0
  281. pidsmaker/tasks/construction.py +31 -0
  282. pidsmaker/tasks/evaluation.py +232 -0
  283. pidsmaker/tasks/feat_inference.py +413 -0
  284. pidsmaker/tasks/featurization.py +43 -0
  285. pidsmaker/tasks/training.py +19 -0
  286. pidsmaker/tasks/transformation.py +308 -0
  287. pidsmaker/tasks/triage.py +143 -0
  288. pidsmaker/tgn.py +635 -0
  289. pidsmaker/tokenization/__init__.py +112 -0
  290. pidsmaker/tokenization/base.py +58 -0
  291. pidsmaker/tokenization/bpe_tokenizer.py +83 -0
  292. pidsmaker/tokenization/hf_tokenizer.py +61 -0
  293. pidsmaker/tokenization/hierarchical_tokenizer.py +44 -0
  294. pidsmaker/tokenization/label_tokenizer.py +24 -0
  295. pidsmaker/tokenization/nltk_tokenizer.py +84 -0
  296. pidsmaker/tokenization/substitution.py +295 -0
  297. pidsmaker/triage/__init__.py +0 -0
  298. pidsmaker/triage/tracing_methods/__init__.py +1 -0
  299. pidsmaker/triage/tracing_methods/depimpact.py +213 -0
  300. pidsmaker/triage/tracing_methods/depimpact_utils.py +537 -0
  301. pidsmaker/triage/tracing_methods/ocrapt_subgraph.py +267 -0
  302. pidsmaker/utils/__init__.py +0 -0
  303. pidsmaker/utils/cache_utils.py +256 -0
  304. pidsmaker/utils/data_utils.py +1742 -0
  305. pidsmaker/utils/database.py +204 -0
  306. pidsmaker/utils/dataset_utils.py +413 -0
  307. pidsmaker/utils/dataset_writer.py +1057 -0
  308. pidsmaker/utils/graph_store.py +634 -0
  309. pidsmaker/utils/labelling.py +447 -0
  310. pidsmaker/utils/loss_files.py +193 -0
  311. pidsmaker/utils/process_tags.py +44 -0
  312. pidsmaker/utils/utils.py +730 -0
  313. pidsmaker/vizgen/__init__.py +1 -0
  314. pidsmaker/vizgen/dimensionality_reduction.py +249 -0
  315. pidsmaker/vizgen/embed_exporter.py +467 -0
  316. pidsmaker/vizgen/exporter.py +493 -0
  317. pidsmaker/vizgen/html_builder.py +936 -0
  318. pidsmaker/vizgen/web/__init__.py +1 -0
  319. pidsmaker/vizgen/web/export.py +62 -0
  320. pidsmaker/vizgen/web/static/css/app.css +250 -0
  321. pidsmaker/vizgen/web/static/index.html +182 -0
  322. pidsmaker/vizgen/web/static/js/app.js +627 -0
  323. pidsmaker/vizgen/web/static/js/campaign.js +123 -0
  324. pidsmaker/vizgen/web/static/js/data.js +119 -0
  325. pidsmaker/vizgen/web/static/js/dialogs.js +240 -0
  326. pidsmaker/vizgen/web/static/js/jobs.js +75 -0
  327. pidsmaker/vizgen/web/static/js/scene.js +651 -0
  328. pidsmaker/vizgen/web/static/js/ui.js +370 -0
  329. pidsmaker/vizgen/web/static/vendor/OrbitControls.js +1045 -0
  330. pidsmaker/vizgen/web/static/vendor/d3.v4.min.js +2 -0
  331. pidsmaker/vizgen/web/static/vendor/three.min.js +6 -0
  332. pidsmaker/vizgen/web/viz_server.py +2176 -0
  333. pidsmaker-4.0.0.dist-info/METADATA +596 -0
  334. pidsmaker-4.0.0.dist-info/RECORD +338 -0
  335. pidsmaker-4.0.0.dist-info/WHEEL +5 -0
  336. pidsmaker-4.0.0.dist-info/entry_points.txt +2 -0
  337. pidsmaker-4.0.0.dist-info/licenses/LICENSE +201 -0
  338. pidsmaker-4.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1035 @@
1
+ """
2
+ Canonical neighbor target tokens for provenance graph foundation model.
3
+
4
+ These tokens abstract dataset-specific details (paths, IPs, usernames) into
5
+ OS-agnostic functional categories. When canonicalize_neighbors is enabled,
6
+ these tokens are:
7
+ - Appended to encoder input (full detail + category signal)
8
+ - Used as the ONLY content for decoder targets (existing [] special tokens
9
+ + these category tokens, stripping all dataset-specific BPE words)
10
+
11
+ Design principle: same function = same token, regardless of OS.
12
+ - Linux /var/log/nginx/ = Windows IIS LogFiles/ = [FCAT_LOG_WEB]
13
+ - Linux /etc/shadow = Windows SAM hive = [FCAT_CREDENTIAL]
14
+ - Linux cron = Windows Task Scheduler = [CAT_CRON]
15
+ """
16
+
17
+ from typing import Optional
18
+
19
+
20
+ # ═══════════════════════════════════════════════════════════════════════════
21
+ # PROCESS CATEGORIES (PROC_CATEGORIES)
22
+ # ═══════════════════════════════════════════════════════════════════════════
23
+ #
24
+ # Maps binary names (extracted from command lines, stripped of path and .exe)
25
+ # to functional category tokens. OS-agnostic: nginx on Linux and Windows
26
+ # both map to [CAT_WEBSERVER].
27
+ #
28
+ # Lookup procedure:
29
+ # 1. Extract binary name: /usr/sbin/nginx → nginx
30
+ # C:/Windows/system32/svchost.exe → svchost
31
+ # com.android.chrome → com.android.chrome
32
+ # 2. Look up in PROC_CATEGORIES
33
+ # 3. If not found, fall back to tokenizing the binary name directly
34
+ # ═══════════════════════════════════════════════════════════════════════════
35
+
36
+ PROC_CATEGORIES = {
37
+ # ── Web servers ──
38
+ "nginx": "[CAT_WEBSERVER]",
39
+ "apache2": "[CAT_WEBSERVER]",
40
+ "httpd": "[CAT_WEBSERVER]",
41
+ "lighttpd": "[CAT_WEBSERVER]",
42
+ "caddy": "[CAT_WEBSERVER]",
43
+ "traefik": "[CAT_WEBSERVER]",
44
+ "w3wp": "[CAT_WEBSERVER]",
45
+ "iisexpress": "[CAT_WEBSERVER]",
46
+
47
+ # ── Application servers ──
48
+ "gunicorn": "[CAT_WEBSERVER]",
49
+ "uwsgi": "[CAT_WEBSERVER]",
50
+ "php-fpm": "[CAT_WEBSERVER]",
51
+ "php-fpm7.4": "[CAT_WEBSERVER]",
52
+ "php-fpm8.0": "[CAT_WEBSERVER]",
53
+ "php-fpm8.1": "[CAT_WEBSERVER]",
54
+ "php-fpm8.2": "[CAT_WEBSERVER]",
55
+ "php-fpm8.3": "[CAT_WEBSERVER]",
56
+ "php-cgi": "[CAT_WEBSERVER]",
57
+ "puma": "[CAT_WEBSERVER]",
58
+ "unicorn": "[CAT_WEBSERVER]",
59
+ "daphne": "[CAT_WEBSERVER]",
60
+ "uvicorn": "[CAT_WEBSERVER]",
61
+ "passenger": "[CAT_WEBSERVER]",
62
+ "thin": "[CAT_WEBSERVER]",
63
+ "waitress-serve": "[CAT_WEBSERVER]",
64
+
65
+ # ── Reverse proxy / load balancer ──
66
+ "haproxy": "[CAT_PROXY]",
67
+ "envoy": "[CAT_PROXY]",
68
+ "squid": "[CAT_PROXY]",
69
+ "varnishd": "[CAT_PROXY]",
70
+ "pound": "[CAT_PROXY]",
71
+
72
+ # ── Databases ──
73
+ "mysqld": "[CAT_DATABASE]",
74
+ "mariadbd": "[CAT_DATABASE]",
75
+ "postgres": "[CAT_DATABASE]",
76
+ "mongod": "[CAT_DATABASE]",
77
+ "mongos": "[CAT_DATABASE]",
78
+ "redis-server": "[CAT_DATABASE]",
79
+ "sqlservr": "[CAT_DATABASE]",
80
+ "oracle": "[CAT_DATABASE]",
81
+ "clickhouse-server":"[CAT_DATABASE]",
82
+ "influxd": "[CAT_DATABASE]",
83
+ "cassandra": "[CAT_DATABASE]",
84
+ "couchdb": "[CAT_DATABASE]",
85
+ "etcd": "[CAT_DATABASE]",
86
+
87
+ # ── Database clients ──
88
+ "mysql": "[CAT_DB_CLIENT]",
89
+ "psql": "[CAT_DB_CLIENT]",
90
+ "mongo": "[CAT_DB_CLIENT]",
91
+ "redis-cli": "[CAT_DB_CLIENT]",
92
+ "sqlcmd": "[CAT_DB_CLIENT]",
93
+ "sqlite3": "[CAT_DB_CLIENT]",
94
+ "pg_dump": "[CAT_DB_CLIENT]",
95
+ "pg_restore": "[CAT_DB_CLIENT]",
96
+ "pg_basebackup": "[CAT_DB_CLIENT]",
97
+ "mysqldump": "[CAT_DB_CLIENT]",
98
+ "mongodump": "[CAT_DB_CLIENT]",
99
+ "mongorestore": "[CAT_DB_CLIENT]",
100
+
101
+ # ── Message queues / brokers ──
102
+ "beam.smp": "[CAT_MSGQUEUE]",
103
+ "rabbitmq-server": "[CAT_MSGQUEUE]",
104
+ "kafka": "[CAT_MSGQUEUE]",
105
+ "mosquitto": "[CAT_MSGQUEUE]",
106
+ "nats-server": "[CAT_MSGQUEUE]",
107
+ "activemq": "[CAT_MSGQUEUE]",
108
+
109
+ # ── Cache ──
110
+ "memcached": "[CAT_CACHE]",
111
+
112
+ # ── Shells ──
113
+ "bash": "[CAT_SHELL]",
114
+ "sh": "[CAT_SHELL]",
115
+ "zsh": "[CAT_SHELL]",
116
+ "dash": "[CAT_SHELL]",
117
+ "fish": "[CAT_SHELL]",
118
+ "csh": "[CAT_SHELL]",
119
+ "tcsh": "[CAT_SHELL]",
120
+ "ksh": "[CAT_SHELL]",
121
+ "ash": "[CAT_SHELL]",
122
+ "cmd": "[CAT_SHELL]",
123
+ "powershell": "[CAT_SHELL]",
124
+ "pwsh": "[CAT_SHELL]",
125
+ "explorer": "[CAT_SHELL]",
126
+ "WindowsTerminal": "[CAT_SHELL]",
127
+
128
+ # ── SSH ──
129
+ "sshd": "[CAT_SSH]",
130
+ "ssh": "[CAT_SSH]",
131
+ "scp": "[CAT_SSH]",
132
+ "sftp": "[CAT_SSH]",
133
+ "sftp-server": "[CAT_SSH]",
134
+ "ssh-agent": "[CAT_SSH]",
135
+ "ssh-keygen": "[CAT_SSH]",
136
+ "ssh-add": "[CAT_SSH]",
137
+ "ssh-keyscan": "[CAT_SSH]",
138
+ "dropbear": "[CAT_SSH]",
139
+ "dbclient": "[CAT_SSH]",
140
+ "rsync": "[CAT_SSH]",
141
+ "putty": "[CAT_SSH]",
142
+ "plink": "[CAT_SSH]",
143
+
144
+ # ── Mail ──
145
+ "smtpd": "[CAT_MAIL]",
146
+ "smtp": "[CAT_MAIL]",
147
+ "sendmail": "[CAT_MAIL]",
148
+ "exim": "[CAT_MAIL]",
149
+ "exim4": "[CAT_MAIL]",
150
+ "postfix": "[CAT_MAIL]",
151
+ "dovecot": "[CAT_MAIL]",
152
+ "imap": "[CAT_MAIL]",
153
+ "imap-login": "[CAT_MAIL]",
154
+ "pop3": "[CAT_MAIL]",
155
+ "pop3-login": "[CAT_MAIL]",
156
+ "lmtp": "[CAT_MAIL]",
157
+ "cleanup": "[CAT_MAIL]",
158
+ "qmgr": "[CAT_MAIL]",
159
+ "master": "[CAT_MAIL]",
160
+ "pickup": "[CAT_MAIL]",
161
+ "bounce": "[CAT_MAIL]",
162
+ "local": "[CAT_MAIL]",
163
+ "amavisd-new": "[CAT_MAIL]",
164
+ "spamd": "[CAT_MAIL]",
165
+ "opendkim": "[CAT_MAIL]",
166
+ "OUTLOOK": "[CAT_MAIL]",
167
+ "thunderbird": "[CAT_MAIL]",
168
+
169
+ # ── DNS ──
170
+ "named": "[CAT_INIT]",
171
+ "unbound": "[CAT_INIT]",
172
+ "dnsmasq": "[CAT_INIT]",
173
+ "systemd-resolved": "[CAT_INIT]",
174
+ "coredns": "[CAT_INIT]",
175
+ "dig": "[CAT_INIT]",
176
+ "nslookup": "[CAT_INIT]",
177
+ "host": "[CAT_INIT]",
178
+
179
+ # ── Init / process supervisors ──
180
+ "systemd": "[CAT_INIT]",
181
+ "init": "[CAT_INIT]",
182
+ "busybox": "[CAT_INIT]",
183
+ "openrc": "[CAT_INIT]",
184
+ "upstart": "[CAT_INIT]",
185
+ "services": "[CAT_INIT]",
186
+ "wininit": "[CAT_INIT]",
187
+ "smss": "[CAT_INIT]",
188
+ "launchd": "[CAT_INIT]",
189
+
190
+ # ── Service hosting ──
191
+ "svchost": "[CAT_SVCHOST]",
192
+
193
+ # ── Cron / scheduled tasks ──
194
+ "cron": "[CAT_CRON]",
195
+ "crond": "[CAT_CRON]",
196
+ "CRON": "[CAT_CRON]",
197
+ "anacron": "[CAT_CRON]",
198
+ "atd": "[CAT_CRON]",
199
+ "at": "[CAT_CRON]",
200
+ "schtasks": "[CAT_CRON]",
201
+ "taskeng": "[CAT_CRON]",
202
+ "taskhostw": "[CAT_CRON]",
203
+
204
+ # ── Container / orchestration ──
205
+ "dockerd": "[CAT_EXECUTABLE]",
206
+ "containerd": "[CAT_EXECUTABLE]",
207
+ "containerd-shim": "[CAT_EXECUTABLE]",
208
+ "containerd-shim-runc-v2": "[CAT_EXECUTABLE]",
209
+ "runc": "[CAT_EXECUTABLE]",
210
+ "crun": "[CAT_EXECUTABLE]",
211
+ "conmon": "[CAT_EXECUTABLE]",
212
+ "cri-o": "[CAT_EXECUTABLE]",
213
+ "podman": "[CAT_EXECUTABLE]",
214
+ "buildah": "[CAT_EXECUTABLE]",
215
+ "skopeo": "[CAT_EXECUTABLE]",
216
+ "docker": "[CAT_EXECUTABLE]",
217
+ "docker-compose": "[CAT_EXECUTABLE]",
218
+ "kubelet": "[CAT_EXECUTABLE]",
219
+ "kube-apiserver": "[CAT_EXECUTABLE]",
220
+ "kube-controller-manager": "[CAT_EXECUTABLE]",
221
+ "kube-scheduler": "[CAT_EXECUTABLE]",
222
+ "kube-proxy": "[CAT_EXECUTABLE]",
223
+ "kubectl": "[CAT_EXECUTABLE]",
224
+ "helm": "[CAT_EXECUTABLE]",
225
+
226
+ # ── Logging ──
227
+ "rsyslogd": "[CAT_SYSADMIN]",
228
+ "syslog-ng": "[CAT_SYSADMIN]",
229
+ "syslogd": "[CAT_SYSADMIN]",
230
+ "systemd-journald": "[CAT_SYSADMIN]",
231
+ "filebeat": "[CAT_SYSADMIN]",
232
+ "fluentd": "[CAT_SYSADMIN]",
233
+ "fluent-bit": "[CAT_SYSADMIN]",
234
+ "vector": "[CAT_SYSADMIN]",
235
+ "logstash": "[CAT_SYSADMIN]",
236
+ "logd": "[CAT_SYSADMIN]",
237
+
238
+ # ── Monitoring / observability ──
239
+ "prometheus": "[CAT_MONITORING]",
240
+ "grafana-server": "[CAT_MONITORING]",
241
+ "grafana": "[CAT_MONITORING]",
242
+ "node_exporter": "[CAT_MONITORING]",
243
+ "blackbox_exporter": "[CAT_MONITORING]",
244
+ "alertmanager": "[CAT_MONITORING]",
245
+ "telegraf": "[CAT_MONITORING]",
246
+ "collectd": "[CAT_MONITORING]",
247
+ "zabbix_agentd": "[CAT_MONITORING]",
248
+ "zabbix_server": "[CAT_MONITORING]",
249
+ "nagios": "[CAT_MONITORING]",
250
+ "icinga2": "[CAT_MONITORING]",
251
+
252
+ # ── Security / AV / audit ──
253
+ "clamd": "[CAT_SYSADMIN]",
254
+ "clamscan": "[CAT_SYSADMIN]",
255
+ "freshclam": "[CAT_SYSADMIN]",
256
+ "falco": "[CAT_SYSADMIN]",
257
+ "auditd": "[CAT_SYSADMIN]",
258
+ "osqueryd": "[CAT_SYSADMIN]",
259
+ "ossec": "[CAT_SYSADMIN]",
260
+ "fail2ban-server": "[CAT_SYSADMIN]",
261
+ "MsMpEng": "[CAT_SYSADMIN]",
262
+ "MpCmdRun": "[CAT_SYSADMIN]",
263
+ "NisSrv": "[CAT_SYSADMIN]",
264
+ "Sysmon": "[CAT_SYSADMIN]",
265
+ "Sysmon64": "[CAT_SYSADMIN]",
266
+
267
+ # ── Authentication ──
268
+ "login": "[CAT_SYSADMIN]",
269
+ "su": "[CAT_SYSADMIN]",
270
+ "sudo": "[CAT_SYSADMIN]",
271
+ "passwd": "[CAT_SYSADMIN]",
272
+ "chpasswd": "[CAT_SYSADMIN]",
273
+ "useradd": "[CAT_SYSADMIN]",
274
+ "usermod": "[CAT_SYSADMIN]",
275
+ "userdel": "[CAT_SYSADMIN]",
276
+ "groupadd": "[CAT_SYSADMIN]",
277
+ "chage": "[CAT_SYSADMIN]",
278
+ "kinit": "[CAT_SYSADMIN]",
279
+ "klist": "[CAT_SYSADMIN]",
280
+ "kdestroy": "[CAT_SYSADMIN]",
281
+ "lsass": "[CAT_SYSADMIN]",
282
+ "winlogon": "[CAT_SYSADMIN]",
283
+ "LogonUI": "[CAT_SYSADMIN]",
284
+ "consent": "[CAT_SYSADMIN]",
285
+
286
+ # ── Package managers ──
287
+ "apt": "[CAT_PKGMGR]",
288
+ "apt-get": "[CAT_PKGMGR]",
289
+ "apt-cache": "[CAT_PKGMGR]",
290
+ "dpkg": "[CAT_PKGMGR]",
291
+ "yum": "[CAT_PKGMGR]",
292
+ "dnf": "[CAT_PKGMGR]",
293
+ "rpm": "[CAT_PKGMGR]",
294
+ "pacman": "[CAT_PKGMGR]",
295
+ "zypper": "[CAT_PKGMGR]",
296
+ "apk": "[CAT_PKGMGR]",
297
+ "snap": "[CAT_PKGMGR]",
298
+ "flatpak": "[CAT_PKGMGR]",
299
+ "pip": "[CAT_PKGMGR]",
300
+ "pip3": "[CAT_PKGMGR]",
301
+ "npm": "[CAT_PKGMGR]",
302
+ "yarn": "[CAT_PKGMGR]",
303
+ "cargo": "[CAT_PKGMGR]",
304
+ "gem": "[CAT_PKGMGR]",
305
+ "composer": "[CAT_PKGMGR]",
306
+ "go": "[CAT_PKGMGR]",
307
+ "msiexec": "[CAT_PKGMGR]",
308
+ "choco": "[CAT_PKGMGR]",
309
+ "winget": "[CAT_PKGMGR]",
310
+ "wusa": "[CAT_PKGMGR]",
311
+ "TrustedInstaller": "[CAT_PKGMGR]",
312
+ "UsoClient": "[CAT_PKGMGR]",
313
+ "installd": "[CAT_PKGMGR]",
314
+
315
+ # ── Compilers / build tools ──
316
+ "gcc": "[CAT_COMPILER]",
317
+ "g++": "[CAT_COMPILER]",
318
+ "cc1": "[CAT_COMPILER]",
319
+ "cc1plus": "[CAT_COMPILER]",
320
+ "as": "[CAT_COMPILER]",
321
+ "ld": "[CAT_COMPILER]",
322
+ "collect2": "[CAT_COMPILER]",
323
+ "clang": "[CAT_COMPILER]",
324
+ "clang++": "[CAT_COMPILER]",
325
+ "rustc": "[CAT_COMPILER]",
326
+ "javac": "[CAT_COMPILER]",
327
+ "cl": "[CAT_COMPILER]",
328
+ "link": "[CAT_COMPILER]",
329
+ "MSBuild": "[CAT_COMPILER]",
330
+ "tsc": "[CAT_COMPILER]",
331
+ "swc": "[CAT_COMPILER]",
332
+ "esbuild": "[CAT_COMPILER]",
333
+
334
+ # ── Build systems ──
335
+ "make": "[CAT_BUILD]",
336
+ "gmake": "[CAT_BUILD]",
337
+ "cmake": "[CAT_BUILD]",
338
+ "ninja": "[CAT_BUILD]",
339
+ "bazel": "[CAT_BUILD]",
340
+ "gradle": "[CAT_BUILD]",
341
+ "gradlew": "[CAT_BUILD]",
342
+ "mvn": "[CAT_BUILD]",
343
+ "ant": "[CAT_BUILD]",
344
+ "meson": "[CAT_BUILD]",
345
+
346
+ # ── CI/CD runners ──
347
+ "gitlab-runner": "[CAT_CIRUNNER]",
348
+ "jenkins-agent": "[CAT_CIRUNNER]",
349
+ "github-actions-runner":"[CAT_CIRUNNER]",
350
+
351
+ # ── Version control ──
352
+ "git": "[CAT_VCS]",
353
+ "git-receive-pack": "[CAT_VCS]",
354
+ "git-upload-pack": "[CAT_VCS]",
355
+ "git-remote-https": "[CAT_VCS]",
356
+ "svn": "[CAT_VCS]",
357
+ "hg": "[CAT_VCS]",
358
+
359
+ # ── Browsers ──
360
+ "firefox": "[CAT_BROWSER]",
361
+ "chrome": "[CAT_BROWSER]",
362
+ "chromium": "[CAT_BROWSER]",
363
+ "chromium-browser": "[CAT_BROWSER]",
364
+ "msedge": "[CAT_BROWSER]",
365
+ "iexplore": "[CAT_BROWSER]",
366
+ "opera": "[CAT_BROWSER]",
367
+ "brave": "[CAT_BROWSER]",
368
+ "vivaldi": "[CAT_BROWSER]",
369
+ "epiphany": "[CAT_BROWSER]",
370
+
371
+ # ── Office / productivity ──
372
+ "soffice.bin": "[CAT_OFFICE]",
373
+ "soffice": "[CAT_OFFICE]",
374
+ "WINWORD": "[CAT_OFFICE]",
375
+ "EXCEL": "[CAT_OFFICE]",
376
+ "POWERPNT": "[CAT_OFFICE]",
377
+ "MSACCESS": "[CAT_OFFICE]",
378
+ "ONENOTE": "[CAT_OFFICE]",
379
+
380
+ # ── Runtimes / interpreters ──
381
+ "python": "[CAT_RUNTIME]",
382
+ "python3": "[CAT_RUNTIME]",
383
+ "python3.10": "[CAT_RUNTIME]",
384
+ "python3.11": "[CAT_RUNTIME]",
385
+ "python3.12": "[CAT_RUNTIME]",
386
+ "node": "[CAT_RUNTIME]",
387
+ "ruby": "[CAT_RUNTIME]",
388
+ "perl": "[CAT_RUNTIME]",
389
+ "php": "[CAT_RUNTIME]",
390
+ "java": "[CAT_RUNTIME]",
391
+ "dotnet": "[CAT_RUNTIME]",
392
+ "mono": "[CAT_RUNTIME]",
393
+ "lua": "[CAT_RUNTIME]",
394
+ "Rscript": "[CAT_RUNTIME]",
395
+ "app_process64": "[CAT_RUNTIME]",
396
+ "app_process32": "[CAT_RUNTIME]",
397
+
398
+ # ── Windows system processes ──
399
+ "csrss": "[CAT_WIN_SYSTEM]",
400
+ "dwm": "[CAT_WIN_SYSTEM]",
401
+ "RuntimeBroker": "[CAT_WIN_SYSTEM]",
402
+ "backgroundTaskHost": "[CAT_WIN_SYSTEM]",
403
+ "SearchUI": "[CAT_WIN_SYSTEM]",
404
+ "SearchApp": "[CAT_WIN_SYSTEM]",
405
+ "ShellExperienceHost": "[CAT_WIN_SYSTEM]",
406
+ "ApplicationFrameHost": "[CAT_WIN_SYSTEM]",
407
+ "SystemSettings": "[CAT_WIN_SYSTEM]",
408
+ "wmiprvse": "[CAT_WIN_SYSTEM]",
409
+ "WmiApSrv": "[CAT_WIN_SYSTEM]",
410
+ "WerFault": "[CAT_WIN_SYSTEM]",
411
+ "dllhost": "[CAT_WIN_SYSTEM]",
412
+ "conhost": "[CAT_WIN_SYSTEM]",
413
+ "System": "[CAT_WIN_SYSTEM]",
414
+ "spoolsv": "[CAT_WIN_SYSTEM]",
415
+
416
+ # ── Android system processes ──
417
+ "zygote": "[CAT_ANDROID_SYS]",
418
+ "zygote64": "[CAT_ANDROID_SYS]",
419
+ "system_server": "[CAT_ANDROID_SYS]",
420
+ "surfaceflinger": "[CAT_ANDROID_SYS]",
421
+ "servicemanager": "[CAT_ANDROID_SYS]",
422
+ "hwservicemanager": "[CAT_ANDROID_SYS]",
423
+ "vold": "[CAT_ANDROID_SYS]",
424
+ "netd": "[CAT_ANDROID_SYS]",
425
+ "logd": "[CAT_ANDROID_SYS]",
426
+ "audioserver": "[CAT_ANDROID_SYS]",
427
+ "mediaserver": "[CAT_ANDROID_SYS]",
428
+ "cameraserver": "[CAT_ANDROID_SYS]",
429
+ "installd": "[CAT_ANDROID_SYS]",
430
+ "adbd": "[CAT_ANDROID_SYS]",
431
+ "healthd": "[CAT_ANDROID_SYS]",
432
+ "gatekeeperd": "[CAT_ANDROID_SYS]",
433
+ "tombstoned": "[CAT_ANDROID_SYS]",
434
+ "ueventd": "[CAT_ANDROID_SYS]",
435
+ "storaged": "[CAT_ANDROID_SYS]",
436
+ "lmkd": "[CAT_ANDROID_SYS]",
437
+
438
+ # ── VPN / tunneling ──
439
+ "openvpn": "[CAT_VPN]",
440
+ "wg": "[CAT_VPN]",
441
+ "wg-quick": "[CAT_VPN]",
442
+ "wireguard-go": "[CAT_VPN]",
443
+ "strongswan": "[CAT_VPN]",
444
+ "charon": "[CAT_VPN]",
445
+ "tailscaled": "[CAT_VPN]",
446
+ "tailscale": "[CAT_VPN]",
447
+
448
+ # ── Firewall / network tools ──
449
+ "iptables": "[CAT_SYSADMIN]",
450
+ "ip6tables": "[CAT_SYSADMIN]",
451
+ "nft": "[CAT_SYSADMIN]",
452
+ "ufw": "[CAT_SYSADMIN]",
453
+ "firewalld": "[CAT_SYSADMIN]",
454
+ "netsh": "[CAT_SYSADMIN]",
455
+ "pf": "[CAT_SYSADMIN]",
456
+
457
+ # ── Infra-as-code / config management ──
458
+ "ansible": "[CAT_EXECUTABLE]",
459
+ "ansible-playbook": "[CAT_EXECUTABLE]",
460
+ "terraform": "[CAT_EXECUTABLE]",
461
+ "puppet": "[CAT_EXECUTABLE]",
462
+ "chef-client": "[CAT_EXECUTABLE]",
463
+ "salt-minion": "[CAT_EXECUTABLE]",
464
+ "salt-master": "[CAT_EXECUTABLE]",
465
+ "packer": "[CAT_EXECUTABLE]",
466
+
467
+ # ── Backup tools ──
468
+ "tar": "[CAT_ARCHIVE]",
469
+ "gzip": "[CAT_ARCHIVE]",
470
+ "bzip2": "[CAT_ARCHIVE]",
471
+ "xz": "[CAT_ARCHIVE]",
472
+ "zip": "[CAT_ARCHIVE]",
473
+ "unzip": "[CAT_ARCHIVE]",
474
+ "7z": "[CAT_ARCHIVE]",
475
+ "borg": "[CAT_ARCHIVE]",
476
+ "restic": "[CAT_ARCHIVE]",
477
+ "duplicity": "[CAT_ARCHIVE]",
478
+
479
+ # ── Text editors / IDEs ──
480
+ "vim": "[CAT_EDITOR]",
481
+ "nvim": "[CAT_EDITOR]",
482
+ "nano": "[CAT_EDITOR]",
483
+ "emacs": "[CAT_EDITOR]",
484
+ "code": "[CAT_EDITOR]",
485
+ "Code": "[CAT_EDITOR]",
486
+ "devenv": "[CAT_EDITOR]",
487
+ "gedit": "[CAT_EDITOR]",
488
+ "kate": "[CAT_EDITOR]",
489
+ "mousepad": "[CAT_EDITOR]",
490
+ "notepad": "[CAT_EDITOR]",
491
+ "notepad++": "[CAT_EDITOR]",
492
+ "sublime_text": "[CAT_EDITOR]",
493
+
494
+ # ── File transfer ──
495
+ "curl": "[CAT_TRANSFER]",
496
+ "wget": "[CAT_TRANSFER]",
497
+ "aria2c": "[CAT_TRANSFER]",
498
+ "ftp": "[CAT_TRANSFER]",
499
+ "lftp": "[CAT_TRANSFER]",
500
+
501
+ # ── Network scanning / diagnostic ──
502
+ "nmap": "[CAT_NETSCAN]",
503
+ "masscan": "[CAT_NETSCAN]",
504
+ "ping": "[CAT_NETSCAN]",
505
+ "traceroute": "[CAT_NETSCAN]",
506
+ "tracert": "[CAT_NETSCAN]",
507
+ "mtr": "[CAT_NETSCAN]",
508
+ "ss": "[CAT_NETSCAN]",
509
+ "netstat": "[CAT_NETSCAN]",
510
+ "tcpdump": "[CAT_NETSCAN]",
511
+ "tshark": "[CAT_NETSCAN]",
512
+ "ncat": "[CAT_NETSCAN]",
513
+ "nc": "[CAT_NETSCAN]",
514
+ "socat": "[CAT_NETSCAN]",
515
+
516
+ # ── Crypto / certificate tools ──
517
+ "openssl": "[CAT_CRYPTO]",
518
+ "certbot": "[CAT_CRYPTO]",
519
+ "gpg": "[CAT_CRYPTO]",
520
+ "gpg-agent": "[CAT_CRYPTO]",
521
+ "certutil": "[CAT_CRYPTO]",
522
+
523
+ # ── System info / admin ──
524
+ "systemctl": "[CAT_SYSADMIN]",
525
+ "journalctl": "[CAT_SYSADMIN]",
526
+ "service": "[CAT_SYSADMIN]",
527
+ "sc": "[CAT_SYSADMIN]",
528
+ "tasklist": "[CAT_SYSADMIN]",
529
+ "taskkill": "[CAT_SYSADMIN]",
530
+ "kill": "[CAT_SYSADMIN]",
531
+ "pkill": "[CAT_SYSADMIN]",
532
+ "ps": "[CAT_SYSADMIN]",
533
+ "top": "[CAT_SYSADMIN]",
534
+ "htop": "[CAT_SYSADMIN]",
535
+ "lsof": "[CAT_SYSADMIN]",
536
+ "strace": "[CAT_SYSADMIN]",
537
+ "ltrace": "[CAT_SYSADMIN]",
538
+ "dmesg": "[CAT_SYSADMIN]",
539
+ "mount": "[CAT_SYSADMIN]",
540
+ "umount": "[CAT_SYSADMIN]",
541
+ "fdisk": "[CAT_SYSADMIN]",
542
+ "lsblk": "[CAT_SYSADMIN]",
543
+ "df": "[CAT_SYSADMIN]",
544
+ "du": "[CAT_SYSADMIN]",
545
+ "free": "[CAT_SYSADMIN]",
546
+ "uptime": "[CAT_SYSADMIN]",
547
+ "reboot": "[CAT_SYSADMIN]",
548
+ "shutdown": "[CAT_SYSADMIN]",
549
+ "hostname": "[CAT_SYSADMIN]",
550
+ "uname": "[CAT_SYSADMIN]",
551
+ "id": "[CAT_SYSADMIN]",
552
+ "whoami": "[CAT_SYSADMIN]",
553
+ "w": "[CAT_SYSADMIN]",
554
+ "who": "[CAT_SYSADMIN]",
555
+ "last": "[CAT_SYSADMIN]",
556
+ "regedit": "[CAT_SYSADMIN]",
557
+ "reg": "[CAT_SYSADMIN]",
558
+
559
+ # ── Logrotate / maintenance ──
560
+ "logrotate": "[CAT_SYSADMIN]",
561
+ "fstrim": "[CAT_SYSADMIN]",
562
+ "updatedb": "[CAT_SYSADMIN]",
563
+ "mandb": "[CAT_SYSADMIN]",
564
+ "ldconfig": "[CAT_SYSADMIN]",
565
+
566
+ # ── NFS / file sharing ──
567
+ "nfsd": "[CAT_FILESHARE]",
568
+ "mount.nfs": "[CAT_FILESHARE]",
569
+ "rpc.mountd": "[CAT_FILESHARE]",
570
+ "rpc.statd": "[CAT_FILESHARE]",
571
+ "smbd": "[CAT_FILESHARE]",
572
+ "nmbd": "[CAT_FILESHARE]",
573
+ "winbindd": "[CAT_FILESHARE]",
574
+
575
+ # ── NTP / time ──
576
+ "ntpd": "[CAT_INIT]",
577
+ "chronyd": "[CAT_INIT]",
578
+ "systemd-timesyncd": "[CAT_INIT]",
579
+ "w32tm": "[CAT_INIT]",
580
+
581
+ # ── DHCP ──
582
+ "dhclient": "[CAT_INIT]",
583
+ "dhcpd": "[CAT_INIT]",
584
+ "NetworkManager": "[CAT_INIT]",
585
+ "systemd-networkd": "[CAT_INIT]",
586
+
587
+ # ── Scripting engines (often LOLBins in attack context) ──
588
+ "wscript": "[CAT_SCRIPTING]",
589
+ "cscript": "[CAT_SCRIPTING]",
590
+ "mshta": "[CAT_SCRIPTING]",
591
+
592
+ # ── Windows LOLBins (legitimate tools abused for attacks) ──
593
+ "bitsadmin": "[CAT_EXECUTABLE]",
594
+ "regsvr32": "[CAT_EXECUTABLE]",
595
+ "rundll32": "[CAT_EXECUTABLE]",
596
+ "msiexec": "[CAT_EXECUTABLE]",
597
+ "forfiles": "[CAT_EXECUTABLE]",
598
+ "pcalua": "[CAT_EXECUTABLE]",
599
+ "procdump": "[CAT_EXECUTABLE]",
600
+ }
601
+
602
+
603
+ # ═══════════════════════════════════════════════════════════════════════════
604
+ # FILE PATH CATEGORIES (FILE_DIR_CATEGORIES)
605
+ # ═══════════════════════════════════════════════════════════════════════════
606
+ #
607
+ # Maps directory path substrings to functional categories.
608
+ # Matched most-specific-first (sort by length descending before matching).
609
+ #
610
+ # OS-AGNOSTIC: same function = same token regardless of OS.
611
+ # ═══════════════════════════════════════════════════════════════════════════
612
+
613
+ FILE_DIR_CATEGORIES = {
614
+ # ── Config: service-specific ──
615
+ "/etc/nginx/": "[FCAT_CONFIG_WEB]",
616
+ "/etc/apache2/": "[FCAT_CONFIG_WEB]",
617
+ "/etc/httpd/": "[FCAT_CONFIG_WEB]",
618
+ "/etc/caddy/": "[FCAT_CONFIG_WEB]",
619
+ "/etc/lighttpd/": "[FCAT_CONFIG_WEB]",
620
+ "/etc/traefik/": "[FCAT_CONFIG_WEB]",
621
+ "/inetsrv/": "[FCAT_CONFIG_WEB]",
622
+ "/etc/haproxy/": "[FCAT_CONFIG_WEB]",
623
+ "/etc/squid/": "[FCAT_CONFIG_WEB]",
624
+
625
+ "/etc/ssh/": "[FCAT_CONFIG]",
626
+ "/ProgramData/ssh/": "[FCAT_CONFIG]",
627
+ "/.ssh/": "[FCAT_CONFIG]",
628
+
629
+ "/etc/mysql/": "[FCAT_CONFIG]",
630
+ "/etc/postgresql/": "[FCAT_CONFIG]",
631
+ "/etc/redis/": "[FCAT_CONFIG]",
632
+ "/etc/mongod": "[FCAT_CONFIG]",
633
+ "/MSSQL/": "[FCAT_CONFIG]",
634
+
635
+ "/etc/postfix/": "[FCAT_CONFIG_MAIL]",
636
+ "/etc/dovecot/": "[FCAT_CONFIG_MAIL]",
637
+ "/etc/exim": "[FCAT_CONFIG_MAIL]",
638
+ "/etc/amavis/": "[FCAT_CONFIG_MAIL]",
639
+
640
+ "/etc/pam.d/": "[CAT_SYSADMIN]",
641
+ "/etc/sudoers": "[CAT_SYSADMIN]",
642
+ "/etc/security/": "[CAT_SYSADMIN]",
643
+ "/etc/krb5": "[CAT_SYSADMIN]",
644
+ "/etc/ldap/": "[CAT_SYSADMIN]",
645
+ "/etc/sssd/": "[CAT_SYSADMIN]",
646
+ "/etc/nsswitch": "[CAT_SYSADMIN]",
647
+
648
+ "/etc/systemd/": "[FCAT_CONFIG]",
649
+ "/lib/systemd/": "[FCAT_CONFIG]",
650
+ "/etc/init.d/": "[FCAT_CONFIG]",
651
+ "/etc/rc": "[FCAT_CONFIG]",
652
+
653
+ "/etc/docker/": "[FCAT_CONFIG_CONTAINER]",
654
+ "/etc/containerd/": "[FCAT_CONFIG_CONTAINER]",
655
+ "/etc/kubernetes/": "[FCAT_CONFIG_CONTAINER]",
656
+ "/.kube/": "[FCAT_CONFIG_CONTAINER]",
657
+
658
+ "/etc/prometheus/": "[FCAT_CONFIG_MONITORING]",
659
+ "/etc/grafana/": "[FCAT_CONFIG_MONITORING]",
660
+ "/etc/zabbix/": "[FCAT_CONFIG_MONITORING]",
661
+ "/etc/nagios/": "[FCAT_CONFIG_MONITORING]",
662
+ "/etc/telegraf/": "[FCAT_CONFIG_MONITORING]",
663
+
664
+ "/etc/openvpn/": "[FCAT_CONFIG_VPN]",
665
+ "/etc/wireguard/": "[FCAT_CONFIG_VPN]",
666
+
667
+ "/etc/fail2ban/": "[FCAT_CONFIG_SECURITY]",
668
+ "/etc/audit/": "[FCAT_CONFIG_SECURITY]",
669
+ "/etc/clamav/": "[FCAT_CONFIG_SECURITY]",
670
+ "/Windows Defender/": "[FCAT_CONFIG_SECURITY]",
671
+
672
+ "/etc/logrotate": "[FCAT_CONFIG]",
673
+ "/etc/rsyslog": "[FCAT_CONFIG]",
674
+ "/etc/syslog": "[FCAT_CONFIG]",
675
+ "/etc/filebeat/": "[FCAT_CONFIG]",
676
+ "/etc/fluentd/": "[FCAT_CONFIG]",
677
+ "/etc/fluent-bit/": "[FCAT_CONFIG]",
678
+
679
+ "/etc/cron": "[FCAT_CONFIG]",
680
+ "/system32/Tasks/": "[FCAT_CONFIG]",
681
+
682
+ "/etc/fstab": "[FCAT_CONFIG_FS]",
683
+ "/etc/exports": "[FCAT_CONFIG_FS]",
684
+ "/etc/samba/": "[FCAT_CONFIG_FS]",
685
+ "/etc/nfs": "[FCAT_CONFIG_FS]",
686
+
687
+ "/etc/network/": "[FCAT_CONFIG]",
688
+ "/etc/netplan/": "[FCAT_CONFIG]",
689
+ "/etc/NetworkManager/": "[FCAT_CONFIG]",
690
+ "/etc/resolv.conf": "[FCAT_CONFIG]",
691
+ "/etc/hosts": "[FCAT_CONFIG]",
692
+ "/etc/hostname": "[FCAT_CONFIG]",
693
+ "/etc/iptables/": "[FCAT_CONFIG]",
694
+ "/etc/nftables": "[FCAT_CONFIG]",
695
+
696
+ "/etc/default/": "[FCAT_CONFIG]",
697
+ "/etc/sysctl": "[FCAT_CONFIG]",
698
+ "/etc/environment": "[FCAT_CONFIG]",
699
+ "/etc/profile": "[FCAT_CONFIG]",
700
+ "/etc/login.defs": "[FCAT_CONFIG]",
701
+ "/etc/locale": "[FCAT_CONFIG]",
702
+ "/etc/timezone": "[FCAT_CONFIG]",
703
+ "/etc/os-release": "[FCAT_CONFIG]",
704
+ "/etc/lsb-release": "[FCAT_CONFIG]",
705
+ "/etc/mime.types": "[FCAT_CONFIG]",
706
+ "/etc/": "[FCAT_CONFIG]",
707
+
708
+ # ── Logs ──
709
+ "/var/log/nginx/": "[FCAT_LOG_WEB]",
710
+ "/var/log/apache2/": "[FCAT_LOG_WEB]",
711
+ "/var/log/httpd/": "[FCAT_LOG_WEB]",
712
+ "/LogFiles/W3SVC": "[FCAT_LOG_WEB]",
713
+
714
+ "/var/log/mysql/": "[FCAT_LOG_DB]",
715
+ "/var/log/postgresql/": "[FCAT_LOG_DB]",
716
+ "/var/log/redis/": "[FCAT_LOG_DB]",
717
+ "/var/log/mongodb/": "[FCAT_LOG_DB]",
718
+
719
+ "/var/log/auth": "[FCAT_LOG]",
720
+ "/var/log/secure": "[FCAT_LOG]",
721
+ "/var/log/btmp": "[FCAT_LOG]",
722
+ "/var/log/wtmp": "[FCAT_LOG]",
723
+ "/var/log/lastlog": "[FCAT_LOG]",
724
+ "/var/log/faillog": "[FCAT_LOG]",
725
+ "/var/log/tallylog": "[FCAT_LOG]",
726
+ "/var/run/utmp": "[FCAT_LOG]",
727
+ "/var/log/fail2ban": "[FCAT_LOG]",
728
+
729
+ "/var/log/mail": "[FCAT_LOG]",
730
+
731
+ "/var/log/journal/": "[FCAT_LOG]",
732
+ "/winevt/Logs/": "[FCAT_LOG]",
733
+
734
+ "/var/log/audit/": "[FCAT_LOG_AUDIT]",
735
+ "/var/log/clamav/": "[FCAT_LOG_AUDIT]",
736
+ "Defender/Scans/": "[FCAT_LOG_AUDIT]",
737
+
738
+ "/var/log/syslog": "[FCAT_LOG]",
739
+ "/var/log/messages": "[FCAT_LOG]",
740
+ "/var/log/daemon": "[FCAT_LOG]",
741
+ "/var/log/kern": "[FCAT_LOG]",
742
+ "/var/log/cron": "[FCAT_LOG]",
743
+ "/var/log/dmesg": "[FCAT_LOG]",
744
+ "/var/log/boot": "[FCAT_LOG]",
745
+ "/var/log/dpkg": "[FCAT_LOG]",
746
+ "/var/log/apt/": "[FCAT_LOG]",
747
+ "/var/log/yum": "[FCAT_LOG]",
748
+ "/var/log/dnf": "[FCAT_LOG]",
749
+ "/Logs/CBS/": "[FCAT_LOG]",
750
+ "/var/log/": "[FCAT_LOG]",
751
+
752
+ # ── Data / state ──
753
+ "/var/lib/mysql/": "[FCAT_DATA]",
754
+ "/var/lib/postgresql/": "[FCAT_DATA]",
755
+ "/var/lib/redis/": "[FCAT_DATA]",
756
+ "/var/lib/mongodb/": "[FCAT_DATA]",
757
+ "/var/lib/cassandra/": "[FCAT_DATA]",
758
+
759
+ "/var/lib/docker/": "[FCAT_DATA_CONTAINER]",
760
+ "/var/lib/containerd/": "[FCAT_DATA_CONTAINER]",
761
+ "/var/lib/kubelet/": "[FCAT_DATA_CONTAINER]",
762
+
763
+ "/var/lib/dpkg/": "[FCAT_DATA_PKG]",
764
+ "/var/lib/apt/": "[FCAT_DATA_PKG]",
765
+ "/var/lib/rpm/": "[FCAT_DATA_PKG]",
766
+ "/var/cache/apt/": "[FCAT_DATA_PKG]",
767
+ "/var/cache/yum/": "[FCAT_DATA_PKG]",
768
+ "/var/cache/dnf/": "[FCAT_DATA_PKG]",
769
+ "/var/cache/pacman/": "[FCAT_DATA_PKG]",
770
+ "/SoftwareDistribution/": "[FCAT_DATA_PKG]",
771
+ "/chocolatey/": "[FCAT_DATA_PKG]",
772
+ "/node_modules/": "[FCAT_DATA_PKG]",
773
+ "/site-packages/": "[FCAT_DATA_PKG]",
774
+ "/dist-packages/": "[FCAT_DATA_PKG]",
775
+
776
+ "/var/spool/postfix/": "[FCAT_DATA_MAIL]",
777
+ "/var/spool/mail/": "[FCAT_DATA_MAIL]",
778
+ "/var/mail/": "[FCAT_DATA_MAIL]",
779
+ "/ImapMail/": "[FCAT_DATA_MAIL]",
780
+
781
+ "/var/spool/cron/": "[FCAT_DATA]",
782
+
783
+ "/var/lib/prometheus/": "[FCAT_DATA_MONITORING]",
784
+ "/var/lib/grafana/": "[FCAT_DATA_MONITORING]",
785
+
786
+ "/var/lib/ntp/": "[FCAT_DATA_NTP]",
787
+ "/var/lib/chrony/": "[FCAT_DATA_NTP]",
788
+ "/var/lib/dhcp/": "[FCAT_DATA]",
789
+
790
+ "/var/lib/sss/": "[CAT_SYSADMIN]",
791
+ "/var/run/faillock/": "[CAT_SYSADMIN]",
792
+ "/var/db/nscd/": "[CAT_SYSADMIN]",
793
+
794
+ "/var/lib/letsencrypt/": "[FCAT_DATA]",
795
+ "/etc/letsencrypt/": "[FCAT_DATA]",
796
+ "/etc/ssl/": "[FCAT_DATA]",
797
+ "/etc/pki/": "[FCAT_DATA]",
798
+ "/Crypto/": "[FCAT_DATA]",
799
+ "/SystemCertificates/": "[FCAT_DATA]",
800
+
801
+ # ── Credentials ──
802
+ "/etc/shadow": "[CAT_SYSADMIN]",
803
+ "/etc/passwd": "[CAT_SYSADMIN]",
804
+ "/etc/gshadow": "[CAT_SYSADMIN]",
805
+ "/etc/group": "[CAT_SYSADMIN]",
806
+ "/system32/config/SAM": "[CAT_SYSADMIN]",
807
+ "/system32/config/SECURITY": "[CAT_SYSADMIN]",
808
+ "/system32/config/SYSTEM": "[CAT_SYSADMIN]",
809
+ "/NTDS/ntds.dit": "[CAT_SYSADMIN]",
810
+ "/krb5cc_": "[CAT_SYSADMIN]",
811
+ "/keytab": "[CAT_SYSADMIN]",
812
+ "/.aws/credentials": "[CAT_SYSADMIN]",
813
+ "/.git-credentials": "[CAT_SYSADMIN]",
814
+
815
+ # ── Binaries ──
816
+ "/usr/bin/": "[CAT_EXECUTABLE]",
817
+ "/usr/sbin/": "[CAT_EXECUTABLE]",
818
+ "/usr/local/bin/": "[CAT_EXECUTABLE]",
819
+ "/usr/local/sbin/": "[CAT_EXECUTABLE]",
820
+ "/bin/": "[CAT_EXECUTABLE]",
821
+ "/sbin/": "[CAT_EXECUTABLE]",
822
+ # ── Snap packages ──
823
+ # /snap/<app>/<rev>/ is the read-only mount of bundled package contents.
824
+ # Sub-paths mirror a full filesystem, so classify by internal structure.
825
+ "/snap/firefox/": "[FCAT_BROWSER_DATA]",
826
+ "/snap/chromium/": "[FCAT_BROWSER_DATA]",
827
+ "/snap/": "[CAT_EXECUTABLE]",
828
+ # /var/snap/<app>/common/ is mutable persistent app data (like /var/lib/).
829
+ "/var/snap/firefox/": "[FCAT_BROWSER_DATA]",
830
+ "/var/snap/chromium/": "[FCAT_BROWSER_DATA]",
831
+ "/var/snap/cups/": "[FCAT_SPOOL]",
832
+ "/var/snap/": "[FCAT_APP_DATA]",
833
+ "/system/bin/": "[CAT_EXECUTABLE]",
834
+ "/system32/": "[CAT_EXECUTABLE]",
835
+ "/SysWOW64/": "[CAT_EXECUTABLE]",
836
+
837
+ # ── Libraries ──
838
+ "/usr/lib/": "[FCAT_LIBRARY]",
839
+ "/lib/": "[FCAT_LIBRARY]",
840
+ "/lib64/": "[FCAT_LIBRARY]",
841
+ "/lib/x86_64-linux-gnu/": "[FCAT_LIBRARY]",
842
+ "/system/lib/": "[FCAT_LIBRARY]",
843
+ "/system/lib64/": "[FCAT_LIBRARY]",
844
+ "/system/framework/": "[FCAT_LIBRARY]",
845
+ "/System32/drivers/": "[FCAT_LIBRARY]",
846
+
847
+ # ── User directories ──
848
+ "/.bashrc": "[FCAT_SHELLRC]",
849
+ "/.bash_profile": "[FCAT_SHELLRC]",
850
+ "/.profile": "[FCAT_SHELLRC]",
851
+ "/.zshrc": "[FCAT_SHELLRC]",
852
+ "/.bash_history": "[FCAT_SHELLRC]",
853
+ "/.zsh_history": "[FCAT_SHELLRC]",
854
+
855
+ "/.config/": "[FCAT_CONFIG]",
856
+ "/AppData/Roaming/": "[FCAT_CONFIG]",
857
+ "/.local/share/": "[FCAT_CONFIG]",
858
+
859
+ "/.cache/": "[FCAT_USER_CACHE]",
860
+ "/AppData/Local/": "[FCAT_USER_CACHE]",
861
+
862
+ "/Documents/": "[FCAT_DOCUMENT]",
863
+ "/Downloads/": "[FCAT_USER_DOWNLOADS]",
864
+ "/Desktop/": "[FCAT_USER_DESKTOP]",
865
+ "/Pictures/": "[FCAT_USER_MEDIA]",
866
+ "/Music/": "[FCAT_USER_MEDIA]",
867
+ "/Videos/": "[FCAT_USER_MEDIA]",
868
+
869
+ "/home/": "[FCAT_HOMEDIR]",
870
+ "/Users/": "[FCAT_HOMEDIR]",
871
+ "/root/": "[FCAT_HOMEDIR]",
872
+
873
+ # ── Temp ──
874
+ "/tmp/": "[FCAT_TMP]",
875
+ "/var/tmp/": "[FCAT_TMP]",
876
+ "/dev/shm/": "[FCAT_TMP]",
877
+ "/AppData/Local/Temp/": "[FCAT_TMP]",
878
+ "/Windows/Temp/": "[FCAT_TMP]",
879
+
880
+ # ── Devices ──
881
+ "/dev/pts/": "[FCAT_SYSFS]",
882
+ "/dev/tty": "[FCAT_SYSFS]",
883
+ "/dev/console": "[FCAT_SYSFS]",
884
+ "/dev/stdin": "[FCAT_PIPE]",
885
+ "/dev/stdout": "[FCAT_PIPE]",
886
+ "/dev/stderr": "[FCAT_PIPE]",
887
+ "/dev/null": "[FCAT_SYSFS]",
888
+ "/dev/zero": "[FCAT_SYSFS]",
889
+ "/dev/urandom": "[FCAT_SYSFS]",
890
+ "/dev/random": "[FCAT_SYSFS]",
891
+ "/dev/log": "[FCAT_TMP]",
892
+ "/dev/binder": "[FCAT_TMP]",
893
+ "/dev/hwbinder": "[FCAT_TMP]",
894
+ "/dev/vndbinder": "[FCAT_TMP]",
895
+ "/run/dbus/": "[FCAT_TMP]",
896
+ "/var/run/dbus/": "[FCAT_TMP]",
897
+
898
+ # ── Virtual filesystems ──
899
+ "/proc/": "[FCAT_PROCFS]",
900
+ "/sys/": "[FCAT_SYSFS]",
901
+
902
+ # ── Runtime / PID files ──
903
+ "/var/run/": "[FCAT_RUNTIME]",
904
+ "/run/": "[FCAT_RUNTIME]",
905
+
906
+ # ── App data (Android) ──
907
+ "/data/data/": "[FCAT_APP_DATA]",
908
+ "/data/app/": "[FCAT_APP_DATA]",
909
+ "/sdcard/": "[FCAT_APP_DATA]",
910
+ "/dalvik-cache/": "[FCAT_APP_DATA]",
911
+
912
+ # ── Windows program directories ──
913
+ "/ProgramData/": "[FCAT_PROGDATA]",
914
+ "/Program Files/": "[FCAT_PROGDIR]",
915
+ "/Program Files (x86)/": "[FCAT_PROGDIR]",
916
+ "/WindowsApps/": "[FCAT_PROGDIR]",
917
+
918
+ # ── Windows specific ──
919
+ "/Windows/Prefetch/": "[FCAT_PREFETCH]",
920
+ "/Windows/SoftwareDistribution/": "[FCAT_DATA_PKG]",
921
+ "/$Recycle.Bin/": "[FCAT_RECYCLE]",
922
+ "/Windows/Minidump/": "[FCAT_CRASHDUMP]",
923
+ "/Windows/wdi/": "[CAT_SYSADMIN]",
924
+ "/SRU/": "[CAT_SYSADMIN]",
925
+
926
+ # ── Git ──
927
+ "/.git/": "[FCAT_VCS]",
928
+ "/.gitconfig": "[FCAT_VCS]",
929
+
930
+ # ── Browser data ──
931
+ "/.mozilla/": "[FCAT_BROWSER_DATA]",
932
+ "/Google/Chrome/": "[FCAT_BROWSER_DATA]",
933
+ "/chromium/": "[FCAT_BROWSER_DATA]",
934
+ "/Microsoft/Edge/": "[FCAT_BROWSER_DATA]",
935
+ "/Internet Explorer/": "[FCAT_BROWSER_DATA]",
936
+
937
+ # ── Spool (print, etc.) ──
938
+ "/var/spool/cups/": "[FCAT_SPOOL]",
939
+ "/spool/PRINTERS/": "[FCAT_SPOOL]",
940
+ "/var/spool/": "[FCAT_SPOOL]",
941
+
942
+ # ── Catch-all for known structures ──
943
+ "/opt/": "[FCAT_HOMEDIR]",
944
+ "/srv/": "[FCAT_HOMEDIR]",
945
+ "/mnt/": "[FCAT_MOUNT]",
946
+ "/media/": "[FCAT_MOUNT]",
947
+ "/boot/": "[FCAT_SYSFS]",
948
+ }
949
+
950
+
951
+ # ═══════════════════════════════════════════════════════════════════════════
952
+ # PRE-COMPUTED LOOKUP STRUCTURES
953
+ # ═══════════════════════════════════════════════════════════════════════════
954
+
955
+ # FILE_DIR_CATEGORIES sorted by key length descending for most-specific-first matching
956
+ _FILE_DIR_SORTED = sorted(FILE_DIR_CATEGORIES.items(), key=lambda x: len(x[0]), reverse=True)
957
+
958
+ ALL_PROC_CATEGORY_TOKENS = sorted(set(PROC_CATEGORIES.values()))
959
+ ALL_FILE_CATEGORY_TOKENS = sorted(set(FILE_DIR_CATEGORIES.values()))
960
+ ALL_CATEGORY_TOKENS = sorted(set(ALL_PROC_CATEGORY_TOKENS + ALL_FILE_CATEGORY_TOKENS))
961
+
962
+
963
+ def match_proc_category(label_str: str) -> "Optional[str]":
964
+ """Extract binary name from a process command line and look up its category.
965
+
966
+ Extraction procedure:
967
+ 1. Take the first whitespace-delimited token (the binary/command)
968
+ 2. Strip any path prefix: /usr/sbin/nginx → nginx
969
+ 3. Strip .exe suffix: svchost.exe → svchost
970
+ 4. Look up in PROC_CATEGORIES
971
+
972
+ Returns the category token string or None if not found.
973
+ """
974
+ parts = label_str.split()
975
+ # Strip leading "subject" type prefix if present
976
+ if parts and parts[0] == "subject":
977
+ parts = parts[1:]
978
+ if not parts:
979
+ return None
980
+
981
+ binary = parts[0]
982
+ # Strip path: /usr/sbin/nginx → nginx, C:\Windows\system32\svchost.exe → svchost.exe
983
+ binary = binary.replace("\\", "/")
984
+ if "/" in binary:
985
+ binary = binary.rsplit("/", 1)[-1]
986
+ # Strip .exe suffix
987
+ if binary.lower().endswith(".exe"):
988
+ binary = binary[:-4]
989
+
990
+ # Direct lookup (case-sensitive first, then case-insensitive for Windows)
991
+ if binary in PROC_CATEGORIES:
992
+ return PROC_CATEGORIES[binary]
993
+ binary_lower = binary.lower()
994
+ for name, cat in PROC_CATEGORIES.items():
995
+ if name.lower() == binary_lower:
996
+ return cat
997
+ return None
998
+
999
+
1000
+ def match_file_category(label_str: str) -> "Optional[str]":
1001
+ """Match a file path against FILE_DIR_CATEGORIES (most-specific-first).
1002
+
1003
+ The path is normalized (backslashes → forward slashes) before matching.
1004
+ Returns the category token string or None if not found.
1005
+ """
1006
+ parts = label_str.split()
1007
+ # Strip leading "file" type prefix if present
1008
+ if parts and parts[0] == "file":
1009
+ parts = parts[1:]
1010
+ if not parts:
1011
+ return None
1012
+
1013
+ # Use the first part as the path (file labels are typically a single path)
1014
+ path = parts[0].replace("\\", "/")
1015
+
1016
+ for pattern, category in _FILE_DIR_SORTED:
1017
+ if pattern in path:
1018
+ return category
1019
+ return None
1020
+
1021
+
1022
+ if __name__ == "__main__":
1023
+ print(f"Process categories: {len(PROC_CATEGORIES)} binary names → {len(ALL_PROC_CATEGORY_TOKENS)} tokens")
1024
+ print(f"File categories: {len(FILE_DIR_CATEGORIES)} path patterns → {len(ALL_FILE_CATEGORY_TOKENS)} tokens")
1025
+ print(f"Total new tokens: {len(ALL_CATEGORY_TOKENS)}")
1026
+ print()
1027
+ print("── PROC category tokens ──")
1028
+ for t in ALL_PROC_CATEGORY_TOKENS:
1029
+ count = sum(1 for v in PROC_CATEGORIES.values() if v == t)
1030
+ print(f" {t:30s} ({count} binaries)")
1031
+ print()
1032
+ print("── FILE category tokens ──")
1033
+ for t in ALL_FILE_CATEGORY_TOKENS:
1034
+ count = sum(1 for v in FILE_DIR_CATEGORIES.values() if v == t)
1035
+ print(f" {t:30s} ({count} patterns)")