Code Monkey home page Code Monkey logo

show-antispoof's Introduction

Show-AntiSpoof

PowerShell based script that checks every accepted domain of Exchange and will show the DNS configuration of SPF and DMARC for each domain using an external DNS server. Alternatively you can request the same information on a specific domain not necessarily configured as Accepted Domain.

Author

License

MIT License Copyright (c) 2018-2020 Dave Stork

Version

  • Version 1.00 17 August 2018
  • Version 1.01 20 August 2018
  • Version 1.02 21 August 2018
  • Version 1.03 12 December 2019
  • Version 1.04 07 Februari 2020
  • Version 1.10 30 October 2020
  • Version 1.10 30 October 2020
  • Version 1.20 13 Februari 2022
  • Version 1.30 29 April 2022
  • Version 1.40 22 July 2022

Revision History

  • 1.00 Private release
  • 1.01 Added support for custom DNS server at commandline
  • 1.02 Added support for custom domain at commandline, overrules checking Exchange
  • 1.03 Added MX records lookup
  • 1.04 Small bugfixes: Using Get-AcceptedDomains correctly, better DNS server check.
  • 1.10 Added more extensive DKIM checks for known selectors AND added parameter to check for a custom selector
  • 1.20 Added MTA-STS and TLS-RPT checks
  • 1.30 Added batch file support for domains. Changed default DNS server to 1.1.1.1. Fixed AcceptedDomains issue with Exchange
  • 1.40 Added BIMI support. More effecient use of functions, some small bugfixes

Known Limitations

  • Required to be run in Exchange PowerShell in order to check all of your accepted domains in one run. Alternatively use batch file support.
  • Can't resolve the exact DKIM selector DNS record as that is a variable in most cases. And due to security, most domain services don't allow complete zone transfers, which you would need to find an unknown record. Since v1.1 you can add a customer record though.
  • Requires at last Windows Server 2012, or PowerShell v3.0 due to Resolve-DnsName
  • DNS check not working as intended, but should be no issue

Link

Dave Stork's IMHO

Description

Run the script in Exchange PowerShell (remote or in your current environment) and a report will be show with the current external SPF and DMARC configuration. Edit the variable if you require another default DNS server. Without Exchange PowerShell, you can run the script and get the same information by explicitly stating a domain.

Examples

.\Show-AntiSpoof
Checks all Exchange Accepted Domains 

.\Show-AntiSpoof -TranscriptOn 
Enables the creation of a transscript file in the same folder as where the script is run.

.\Show-AntiSpoof -DNSServer 1.2.3.4
Overrides the default DNS server (8.8.8.8) with one specified.

.\Show-AntiSpoof -DomainName contoso.com
Overrides checking Accepted Domains from the Exchange environment and checks only the provides domain
No Exchange PowerShell required when this is used.

.\Show-AntiSpoof -DomainName contoso.com -Selector Selector1
Will check whether the specified domain has the DKIM selector specified by the -Selector parameter.

.\Show-AntiSpoof -DomainBatchfile domains.csv
Will check all domains in CSV file with header "DomainName"

show-antispoof's People

Contributors

dmstork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

show-antispoof's Issues

Add SPF Include and Redirect resolvement

SPF records can contain Include= and Redirect= tags that refer to other DNS names & records. Would be nice to resolve those as well. There is a danger for endless recursion though when SPF records refers to itself in the end.

Timeout at the cmd line

Hi - I downloaded the script this AM (by copy and paste from the RAW page). Got an error w/ just the DNS name. Deets below (can I say deets these days, is that what the kewel kidz are doing...?)

This worked - meaning I got results.
PS C:\PowerShell> .\getantispoof.ps1 something.com -DNSserver 208.67.222.222

In my case, I have VMware Pro installed, and 3 NIC's, so maybe this is a matter of how the code pulls the DNS servers for the "Ethernet" adapter... These lines work to get me my "default DNS servers".

$dneservers = Get-DnsClientServerAddress -InterfaceAlias "Ethernet" -AddressFamily IPv4

$dneservers | ForEach-Object {$_.ServerAddresses }
208.67.222.222
208.67.220.220

When I try " PS C:\PowerShell> .\getantispoof.ps1 something.com "
This did not - meaning I got the errors below - I used a real domain like ibm.com.

Error with DNS server, using default. internet.nl : This operation returned because the timeout period expired
Get-AcceptedDomain : The term 'Get-AcceptedDomain' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At C:\PowerShell\getantispoof.ps1:131 char:24

  • $AcceptedDomains = Get-AcceptedDomain
    
  •                    ~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Get-AcceptedDomain:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Accepted Domains parameter wrong?

Might have to check usage of name and identity, could differ resulting in mismatching in domains.
Also; working for on-prem and online?

Add report as an export

Now the findings are outputed to screen, would be nice to have a report file. Especially handy if you have multiple domains.

Add batchfile support

Checking multiple domains from CSV file. Alternative to the Get-AcceptedDomain approach. Independent of being logged into an Exchange environment.

Export report would complement this greatly (so that has priority over this, I guess)

DKIM selector updates

Perhaps add online check of a file with all known DKIM selectors from SaaS services like Mailchimp.

Investigate ARC addition

Have to read into ARC further if it would make sense to check for it. (which DNS records? etc.).

Handling of catchall DNS and empty TXT values

Some domains let every FQDN resolve to their website or an IP, which is understandable. However, the script makes assumptions that when there is a response to for instance _mta-sts.domain.tld that it probably has a value.
Currently it just shows the response which is $null (or ""). More explicit notification is probably better.

DNS Server issues

DNS server check does not work optimally, also default usage of 8.8.8.8 is a thing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.