Skip to content

Instantly share code, notes, and snippets.

View Mike-Crowley's full-sized avatar

Mike Crowley Mike-Crowley

View GitHub Profile
# Define parameters
$captureFile = "C:\tmp\mycapture.pcap"
$tsharkPath = "C:\Program Files\Wireshark\tshark.exe"
$RemoteIP = "192.168.1.10"
$TestShare = "\\server1.example.com\admin$"
$User = "[email protected]"
$Password = "FAKE-Password"
$TestPassword = ConvertTo-SecureString -AsPlainText -String $Password -Force
$TestCred = [Management.Automation.PSCredential]::new($User, $TestPassword)
$Headers = @{
"Accept" = "application/json"
"authorization" = "Bearer BQAJ" # Can acquire from the browser
}
$uri = @'
https://api.spotify.com/v1/me/top/tracks?limit=50
'@
$QueryResults = [Collections.Generic.List[Object]]::new()
@Mike-Crowley
Mike-Crowley / log.log.log
Created April 20, 2024 02:50
Test Log File
What rolls down stairs
alone or in pairs,
and over your neighbor's dog?
What's great for a snack,
And fits on your back?
It's log, log, log
It's log, it's log,
It's big, it's heavy, it's wood.
It's log, it's log, it's better than bad, it's good."
@Mike-Crowley
Mike-Crowley / Get-ShodanIpLookup.ps1
Last active March 18, 2023 05:06
Query a single IP against shodan from PowerShell. I'm sure this has been done before...
function Get-ShodanIpLookup {
param (
[ipaddress]$Ip,
[string]$ApiKey = ""
)
if ($ApiKey -eq "") { Invoke-RestMethod -Uri "https://internetdb.shodan.io/$Ip" }
else { Invoke-RestMethod -uri "https://api.shodan.io/shodan/host/$($ip)?key=$ApiKey" }
# Free Service: https://internetdb.shodan.io/
# Paid API access: https://developer.shodan.io/api
@Mike-Crowley
Mike-Crowley / Get-Superscript.ps1
Last active March 18, 2023 05:06
Replace a given letter with the superscript letter (except q).
function Get-Superscript {
param ($letter)
switch ($letter) {
"a" { [char]::ConvertFromUtf32(7491 )}
"b" { [char]::ConvertFromUtf32(7495 )}
"c" { [char]::ConvertFromUtf32(7580 )}
"d" { [char]::ConvertFromUtf32(7496 )}
"e" { [char]::ConvertFromUtf32(7497 )}
"f" { [char]::ConvertFromUtf32(7584 )}
"g" { [char]::ConvertFromUtf32(7501 )}
Function Get-ADSiteByIp {
param (
[parameter(Mandatory = $true)][ipaddress]
[ipaddress]$IP,
[bool]$CheckForScript = $true # faster
)
if ($CheckForScript -eq $true) {
try { Get-InstalledScript IP-Calc | Out-Null }
catch {
Install-Script -Name IP-Calc -Scope CurrentUser -Force -Confirm:$false
@Mike-Crowley
Mike-Crowley / Get-WordscapesResults.ps1
Last active March 18, 2023 05:08
Get-WordscapesResults
<# Wordscapes solver
14Jul2021
https://apps.apple.com/us/app/wordscapes/id1207472156
https://play.google.com/store/apps/details?id=com.peoplefun.wordcross&hl=en_US&gl=US
#>
#import Get-StringPermutation from https://learn-powershell.net/2013/02/21/fun-with-powershell-and-permutations/
$wordArray = Get-Content C:\tmp\words.txt
$wordHash = @{}
@Mike-Crowley
Mike-Crowley / Test-AdPassword.ps1
Last active May 30, 2025 11:32
PowerShell use of PrincipalContext.ValidateCredentials
<#To do
-Test local machine
-Test remote domains
-Explore AADJ experience
#>
function Test-Credential {
<#
.SYNOPSIS
This function validates the credentials of a PSCredential (Get-Credential) object against the local machine or Active Directory.
Active Directory users are first queried to add support for UPNs. Unfortunately this approach ignores the netbios name of the