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 / 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}
@Rugby-Ball
Rugby-Ball / Upgrade PowerShell Modules Function
Created June 2, 2023 21:25
Update all PowerShell Modules with a Function added to your $PROFILE #Public #Utility #Maintenance #Snippet #Powershell #Windows #Function
<# Add this to your $Profile
To edit, from inside cli or ISE type: notepad $Profile
If its not created then create it.
The add below and save.
Now to update all your Modules you type the function name, upgrade
#>
@Rugby-Ball
Rugby-Ball / aws-ec2-snapshot-count-and-aged-out-with-cost.ps1
Last active February 6, 2024 22:35
Get the count of Snapshots for an AWS account across all AWS Regions, along with count over set days old, and what is oldest date of snapshot. calculate the cost per GB for old snapshots #Inventory #Utility #AWS #Public #Snapshots #EBS
# aws-ec2-snapshot-count-and-aged-out-with-cost.ps1
Import-Module AWSPowerShell.netcore
## Powershell.Core safe (PoSh 6+)
#Import-Module AWSPowerShell.NetCore
## Ed Walsh
## Date: 12/9/2020
## Modified: 02/06/2024
<# Get the count of Snapshots for an AWS account across all AWS Regions, along with count over set days old, and what is oldest date of snapshot.
calculate the cost per GB for old snapshots
$AllSnapshotsForRemoval variable can be fed to a foreach to delete the aged out snapshots
@Rugby-Ball
Rugby-Ball / aws-ec2-elb-detail-inventory-with-SecurityGroups-all-aws-regions.ps1
Last active March 25, 2024 15:21
Pull all EC2's and all ELB's with details includes the Security Groups each EC2 has accross all AWS Regions. #Inventory #Utility #AWS #Public #EC2 #AWS_Security_Groups #AWS_ELB #AWS_ALB
# aws-ec2-elb-detail-inventory-with-SecurityGroups-all-aws-regions.ps1
<#
Description: Pull all EC2's and all ELB's with details includes the Security Groups each EC2 has accross all AWS Regions.
Written: Ed Walsh
PowerShell.Core tested: Tested
Version: 1.2.0
Create Date : 5/1/2023
Revised Date: 10/13/2023
#>
@Rugby-Ball
Rugby-Ball / AWS-IAM-Users-with-IAMGroups-Memberships.ps1
Created April 26, 2023 18:14
This will show the IAM Users and the IAM Group memberships they are in. #Utility #Inventory #Public #AWS #IAM #Security #Audit
# AWS-IAM-Users-with-IAMGroups-Memberships.ps1
<#
Description: This will show the IAM Users and the IAM Group memberships they are in.
For Password_LastUsed, if the account does not have a password, which means no access to AWS Console, or if the password was never used, it outputs "1/1/0001 12:00:00 AM", I capture this and replace with a blank.
Written: Ed Walsh
PowerShell.Core tested: Not Tested
Version: 1.0.0
Create Date: 04/26/2023
Revised Date: 04/26/2023
#>
@Rugby-Ball
Rugby-Ball / change_IIS_site_ID.ps1
Last active August 15, 2023 14:42
This is how to change the IIS Site ID using Site ID # or IIS Site Name. #Utility #Inventory #WebServer #Public #Windows #IIS
#This is how to change the IIS Site ID using Site ID # or IIS Site Name.
Import-Module WebAdministration
# Pull all of the IIS Sites into variable $sm, after ; says to display on screen $sm.Sites list
$sm = Get-IISServerManager ; $sm.Sites
# Change site with Id 5 to Id 7
$site = $sm.Sites | where-object { $_.Id -eq 5 }
@Rugby-Ball
Rugby-Ball / dotNET_framework_Installed.ps1
Created April 21, 2023 01:34
This will check what .NET Framework installed on the server. #Utility #Inventory #Public #Windows #Framework #.NET
# This will check what .NET Framework installed on the server.
#
#From: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
$release = Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release
switch ($release) {
{ $_ -ge 533320 } { $version = '4.8.1 or later'; break }
{ $_ -ge 528040 } { $version = '4.8'; break }
{ $_ -ge 461808 } { $version = '4.7.2'; break }
@Rugby-Ball
Rugby-Ball / aws-acm-inventory.ps1
Last active March 30, 2023 14:50
Pull a AWS Certificate Manager inventory list #Utility #AWS #Inventory #Public #AWS_ACM
# aws-acm-inventory.ps1
<#
Description: Pull an Inventory List from AWS Certificate Manager (ACM) across all AWS regions. Export to a CSV file.
Written: Ed Walsh
PowerShell.Core tested: Not Tested
MS-Graph: No
Version: 1.1.0
Create Date: 3/30/2023
Revised Date: 3/30/2023
#>