Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scoring to output #4

Open
dotBATmanNO opened this issue Oct 3, 2019 · 1 comment
Open

Add scoring to output #4

dotBATmanNO opened this issue Oct 3, 2019 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dotBATmanNO
Copy link
Owner

Use a CSV file to define the score to give, this allows for customization by user.

Combine existence of records with strength of records to give total score.

SPF Qualifier | Policy   | Protection
-----------------------------------
+all          | Pass     | None
~all          | Softfail | Weak
-all          | Fail     | Strong

SPF, DKIM and DMARC existence could score as shown below:

SPF_DKIM_DMARC      | Protection
-------------------------------------
False, False, False | None
False, False, True  | None
False, True, False  | Weak
False, True, True   | Weak
True, False, False  | Weak
True, False, True   | Strong
True, True, False   | Strong
True, True, True    | Strong
@dotBATmanNO dotBATmanNO added enhancement New feature or request help wanted Extra attention is needed labels Oct 3, 2019
@FrankSchuurman68
Copy link

FrankSchuurman68 commented Feb 8, 2021

SPF DKIM DMARC SUM Protection
0 0 1 1 none
0 2 0 2 weak
0 2 1 3 weak
3 0 0 3 weak
3 0 1 4 strong
3 2 0 5 strong
3 2 1 6 strong

Maybe giving it a value makes it easier.

 $ProtectionLevel = $dominfoSPF + $dominfoDMARC + $dominfoDKIM
 if ($ProtectionLevel -le 1) {$ProtectionLevel = "None"} 
 elseif ($ProtectionLevel -eq 2) {$ProtectionLevel = "Weak"}  
 elseif ($ProtectionLevel -eq 3) {$ProtectionLevel = "Weak"}  
 elseif ($ProtectionLevel -ge 4) {$ProtectionLevel = "Strong"}
   If ($dominfoSPFDet) 
   { 
     $dominfoSPF = 3
     if ($dominfoSPFDet -like '*+all*') { $dominfoQualifier = 0 } 
     elseif ($dominfoSPFDet -like '*~all*') {$dominfoQualifier = 1 } 
     elseif ($dominfoSPFDet -like '*-all*') {$dominfoQualifier = 2 }
    } 
    else 
    { 
      $dominfoSPF = $dominfoSPFDet = 0 
    }
 $ProtectionLevel = $dominfoSPF + $dominfoDMARC + $dominfoDKIM
 if ($ProtectionLevel -le 1) {$ProtectionLevel = "None"} 
 elseif ($ProtectionLevel -eq 2) {$ProtectionLevel = "Weak"}  
 elseif ($ProtectionLevel -eq 3) {$ProtectionLevel = "Weak"}  
 elseif ($ProtectionLevel -ge 4) {$ProtectionLevel = "Strong"}

 $ProtectionStrength = $dominfoQualifier
 if ( $ProtectionStrength -eq 0) { $ProtectionStrength = "None"} 
 elseif ( $ProtectionStrength -eq 1) { $ProtectionStrength = "Weak"}  
 elseif ( $ProtectionStrength -eq 2) { $ProtectionStrength = "Strong"}
 $row.ProtectionLevel = $ProtectionLevel
 $row.ProtectionStrength = $ProtectionStrength

Could maybe smarter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants