Skip to content

Instantly share code, notes, and snippets.

View Rugby-Ball's full-sized avatar

Ed Walsh Rugby-Ball

View GitHub Profile
@Rugby-Ball
Rugby-Ball / dkim-spf-dmarc-inventory.ps1
Created October 5, 2023 02:59
From an array pulls the SPF, DMARC and DKIM of a domain. for DKIM you need to know the DKIM_Selector or leave it blank to skip pulling the DKIM. #Utility #Inventory #SPF #email #Public #DMARC #DKIM
# dkim-spf-dmarc-inventory.ps1
#Install-Module -name DomainHealthChecker # Only needed if you don't already have the Module installed
import-module -name DomainHealthChecker
$all = @()
# List of the domains to check, and there dkim selector used in the DNS. If you don't have the dkim selector leave blank "".
$urls_check = @( [pscustomobject]@{'domain'="example2.com";'dkim_selector'="t9959"},
[pscustomobject]@{'domain'="example2.com";'dkim_selector'="ps0717"},
[pscustomobject]@{'domain'="google.com";'dkim_selector'=""} #example of a blank dkim_selector
)
$runon = Get-date -Format "MM/dd/yyyy hh:mm tt K"
@Rugby-Ball
Rugby-Ball / aws-rt53-hostedzone-spf-inventory.ps1
Last active October 5, 2023 02:44
Using the PowerShell Module DomainHealthChecker, pull all AWS Hostedzone ID's and pull inventory of SPF records for each HostedZone. #Utility #Inventory #AWS #Route_53 #SPF #email #Public
# aws-rt53-hostedzone-spf-inventory.ps1
#Install-Module -name DomainHealthChecker # Only needed if you don't already have the Module installed
import-module -name DomainHealthChecker, AWSPowerShell.netcore
$all = @()
$urls_check = Get-R53HostedZoneList
foreach ($url in $urls_check) {
$all += get-spfrecord -Name $url.name | Select-Object @{ name="HostedZoneID";e={$url.id.substring(12)} }, @{ name="HostedZone";e={$url.name.trimend(".")} } , SPFRecord
}
@Rugby-Ball
Rugby-Ball / Azure-Subscription-Inventory.ps1
Created September 14, 2023 19:24
For Azure, get inventory of items in a Subscription. #Utility #Public #Inventory #Azure
# Azure-Subscription-Inventory.ps1
<#
Description: For Azure, get inventory of items in a Subscription.
Written: Ed Walsh
PowerShell.Core tested: Yes
MS-Graph: No
Version: 1.0.0
Create Date: 9/14/2023
Revised Date: 9/14/2023
#>
@Rugby-Ball
Rugby-Ball / FSx-List-ALL-Regions.ps1
Last active September 11, 2023 16:27
Pull an Inventory of all FSx across all regions. Export to a CSV file. #Utility #Public #AWS #Inventory #File_System #AWS_FSx
#FSx-List-ALL-Regions.ps1
<#
Description: Pull an Inventory of all FSx across all regions. Export to a CSV file.
Written: Ed Walsh
PowerShell.Core tested: Yes
MS-Graph: No
Version: 1.1
Create Date: 9/11/2023
Revised Date: 9/11/2023
#>
@Rugby-Ball
Rugby-Ball / CloudFront-Distro-List-ALL-Regions.ps1
Created September 6, 2023 17:20
Pull an Inventory of all Cloudfront distributions across all regions. Export to a CSV file. You will see the regions a CloudFront distribution is in. #Public #Utility #Inventory #AWS #CloudFront
#CloudFront-Distro-List-ALL-Regions.ps1
<#
Description: Pull an Inventory of all Cloudfront distributions across all regions. Export to a CSV file.
You will see the regions a CloudFront distribution is in.
Written: Ed Walsh
PowerShell.Core tested: Yes
MS-Graph: No
Version: 1.0
Create Date: 9/6/2023
Revised Date: 9/6/2023
@Rugby-Ball
Rugby-Ball / folder-size.ps1
Last active August 18, 2023 14:24
Run this to get folder file count, and size in Byte, KB, MB and GB #Utility #Inventory #Public #Windows #File_System
$targetfolder='\\computer_name\data\' # Can use Drive letters, or UNC Paths that you have permissions to.
#
##Check if c:\temp exists, if it doesnt create it.
If (-not(Test-Path -Path "c:\temp"))
{ New-Item -ItemType Directory -Force -Path C:\temp }
$dataColl = @()
Get-ChildItem -force $targetfolder -recurse -ErrorAction SilentlyContinue | Where-Object { $_ -is [io.directoryinfo] } | % {
$len = 0
@Rugby-Ball
Rugby-Ball / ACM-Service-list-with-ACM-InUse.ps1
Last active July 31, 2023 02:24
Pull an Inventory of AWS Certificate Manager (ACM) that are `ISSUED` and the AWS Service using them across all AWS regions. Export to a CSV file. #Utility #Inventory #Public #AWS #AWS_ACM
# ACM-Service-list-with-ACM-InUse.ps1
<#
Description: Pull an Inventory of AWS Certificate Manager (ACM) that are `ISSUED` and the AWS Service using them across all AWS regions. Export to a CSV file.
Written: Ed Walsh
PowerShell.Core tested: Yes
MS-Graph: No
Version: 1.3
Create Date: 7/25/2023
Revised Date: 7/28/2023
#>
@Rugby-Ball
Rugby-Ball / Domain_spf_dkim_dmarc_check.ps1
Last active August 2, 2023 15:21
Check a list of domains for SPF, DKIM, and DMARC entries #AWS #Utility #Inventory #Security #Public #email
#Install-Module -name DomainHealthChecker # Only needed if you don't already have the Module installed
import-module -name DomainHealthChecker
$all = @()
#You need the DKIM selector to pull the correct DKIM record.
$urls_check = @( [pscustomobject]@{'domain'="domain0.com";'dkim_selector'="s6840"},
[pscustomobject]@{'domain'="domain1.com";'dkim_selector'="cast717"}
)
$runon = Get-date -Format "MM/dd/yyyy HH:mm tt K"
foreach ($url in $urls_check) {
#There is a bug in Invoke-SpfDkimDmarc, v1.6 where it only uses `dkim` as a selector value, so need to use the Get-DKIMRecord cmdlet so you can use the DKIM Selector.
@Rugby-Ball
Rugby-Ball / nmap - Pull Subject Alternative Names SAN from website SSL
Last active July 14, 2023 14:07
This works with nmap Windows, MacOS and Linux to get the Subject Alternative Names (SAN) from a websites SSL Cert. Requires GREP be installed to work. #Public #nmap #shell #Utility
nmap -p 443 --script ssl-cert mrisimmons.com | grep "Subject Alternative Name"
@Rugby-Ball
Rugby-Ball / Test-ADAuthentication
Created July 3, 2023 17:01
Used to test AD credentials. Function can be added to PowerShell $PROFILE #Security #Public #Utility #Active_Directory #Snippet #Function
Function Test-ADAuthentication {
param(
$username,
$password)
(New-Object DirectoryServices.DirectoryEntry "",$username,$password).psbase.name -ne $null
}
Test-ADAuthentication -username {Enter User Name} -password {Enter Password}