From 13e1af6641cdfc8c8427b5c2a81f8b79aef9e26b Mon Sep 17 00:00:00 2001 From: shukuru Date: Sun, 18 Feb 2024 14:50:55 +0100 Subject: Add DMARC report data structure code --- examples/dmarc_report_example.xml | 50 +++++++++++++++++++++++++++++++++++++++ src/data_structures.rs | 35 +++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 examples/dmarc_report_example.xml create mode 100644 src/data_structures.rs diff --git a/examples/dmarc_report_example.xml b/examples/dmarc_report_example.xml new file mode 100644 index 0000000..d560d85 --- /dev/null +++ b/examples/dmarc_report_example.xml @@ -0,0 +1,50 @@ + + + 1.0 + + Enterprise Outlook + dmarcreport@microsoft.com + 3374fb5148ba40c1a5cf8e3d36f34a34 + + 1707436800 + 1707523200 + + + + boitalett.re + s + s +

reject

+ reject + 100 + 0 +
+ + + 195.154.102.43 + 1 + + none + pass + pass + + + + babilou.com + boitalett.re + boitalett.re + + + + boitalett.re + 2023101501 + pass + + + boitalett.re + mfrom + pass + + + +
\ No newline at end of file diff --git a/src/data_structures.rs b/src/data_structures.rs new file mode 100644 index 0000000..a90b7b0 --- /dev/null +++ b/src/data_structures.rs @@ -0,0 +1,35 @@ +enum DMARCPolicy { + None, + Quarantine, + Reject +} + +enum DMARCAlignment { + Relaxed, + Strict +} + +enum DMARCFailureOption { + AlignedPassFailure, + OtherAlignedPassFailure, + SignatureAlignmentFailure, + SPFFailure +} + +struct DMARCRecord { + domain: String, + adkim: DMARCAlignment, + aspf: DMARCAlignment, + policy: DMARCPolicy, + subdomain_policy: DMARCPolicy, + percentage: u64, + failure_opt: DMARCFailureOption +} + +pub struct DMARCReport { + id: String, + org: String, + record: DMARCRecord, + dkim_pass: bool, + spf_pass: bool +} -- cgit v1.2.3