Skip to content

Instantly share code, notes, and snippets.

View s4parke's full-sized avatar

Steve J. s4parke

View GitHub Profile
@s4parke
s4parke / Remove-ASCDefaultPolicyAssignment.ps1
Last active July 11, 2022 15:45
Removes ASC Default policy assignment at subscription level.
<#
.Synopsis
Forked from: https://github.com/Azure/Microsoft-Defender-for-Cloud
Can be used when there are dual levels of ASC policies assignments at Management group and subscription level. If you want ASC policy to be inherited correctly at the management group,
this script Removes ASC Default policy assignment at subscription level by doing the following steps
1. Seeking all of your management groups and a match for a ASC Default definition in policy assignment at Management Group Level.
@s4parke
s4parke / Get-AzLastCall.ps1
Last active January 29, 2024 05:53
Get the last caller from the ActivityLog on a resource or resource group. Useful to find who what & when.
function Get-AzLastCall {
<#
.SYNOPSIS
Get the last caller from the ActivityLog on a resource or resource group.
Useful to find who what & when.
.DESCRIPTION
Inputs: ResourceGroupName (required) and ResourceName (optional).
Outputs: Array-list of PSEvent Objects
@s4parke
s4parke / gist:587f7939f6bb93debd4b8c446559d583
Created March 29, 2022 17:39 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@s4parke
s4parke / Search-SendersAndDomains.ps1
Created January 26, 2022 16:22
Search for Blocked or Trusted Senders and Domains in Exchange Online
function Search-BlockedSendersAndDomains {
<#
.DESCRIPTION
Search by keyword in a user's blocked senders and domains.
Wildcards are automatically added before and after the search string.
.PARAMETER Identity
Email address of the user. "[email protected]".
.PARAMETER Term
@s4parke
s4parke / password.txt
Last active September 27, 2022 15:37
qpdf bash script to remove PDF passwords
--password=THISISTHEPDFPASSWORD
@s4parke
s4parke / security-alert-entity-extraction.kql
Created January 4, 2021 18:18
[KQL] Entity extraction for Azure Security Alerts
// Extract the entities for high severity AATP alerts
SecurityAlert
| where ProviderName == "Azure Advanced Threat Protection"
| where AlertSeverity == "High"
| extend Ent = parse_json(Entities)
| mvexpand Ent
| extend AccountCustomEntity = tostring(Ent.Name)
| extend HostCustomEntity = tostring(Ent.HostName)
| extend IPCustomEntity = tostring(Ent.Address)
@s4parke
s4parke / gist:0f991d604c03b5c4fccb230ddb10aeb4
Created January 4, 2021 17:57
Extract Entities for incident Creation for AATP
// Extract the enti8ties for high severity AATP alerts
SecurityAlert
| where ProviderName == "Azure Advanced Threat Protection"
| where AlertSeverity == "High"
| extend Ent = parse_json(Entities)
| mvexpand Ent
| extend AccountCustomEntity = tostring(Ent.Name)
| extend HostCustomEntity = tostring(Ent.HostName)
| extend IPCustomEntity = tostring(Ent.Address)
@s4parke
s4parke / photo-meta.sh
Last active October 3, 2019 22:11
Create sidecar files for each photo in a directory.
#!/bin/bash
shopt -s nullglob
PHOTOS=$HOME/tmp/pics/
for p in $PHOTOS/*.jpg
do
echo "Creating XMP sidecar file for $p ...\n"
touch $PHOTOS/$p.xmp.xml
echo "\n\n Creating SHA256 sidecar file for ... $p\n"
openssl dgst -sha256 $p > $PHOTOS/$p.sha.txt
@s4parke
s4parke / Digital Signature.sh
Last active August 14, 2019 20:01
Server-side commands to create digital signature for image
# Make a hash of the image data
openssl dgst -sha256 wreckage.jpg > digest.txt
# Make a hash of DC metadata from XMP sidecar file
xml sel -N dc="http://purl.org/dc/elements/1.1/" -t -m "//dc:title" -c . -m "//dc:creator" -c . -m "//dc:description" -c . -n gator-meta.jpg.xml | openssl dgst -sha256 >> digest.txt
# Sign and base64 encode the digest
openssl rsautl -sign -inkey private_key.pem -keyform PEM -in digest.txt | base64 > signature
# Put the signature into the XMP sidecar file
@s4parke
s4parke / truncate-participant-data.sql
Last active August 21, 2018 18:16
Clear out participant data from old SHUTi codebase site
-- USE shuti_private_production;
UPDATE participant_private_data SET
participant_id = 999999,
prop_value_binary = 1,
prop_value_boolean = 1,
prop_value_integer = 999999,
prop_key = 'Zxd2lcwZUPDy1Aqv3dQpjOIhqOxqVJeBsy307mjijZ5gD9LHNB0N7GZoXfRTiN3JSDvOpjyu0k7UVm6Fr6k4m9I8kbAg23E3emZ0VitX3Cy46RJ01h0Pw6H07SH5skumig60p5PNolR2HUklD4eBVXqCXCSsodQbaHGjgUaIz1Z8ydRvURo3gzGKvSG48keEivOgPFV8',
prop_value = '1DqGViFRX8fHWRcD7Q4Rjjzinvf1pgWqXSM8o3DBkFxYrNOqjqUcUwNBPH33q03xpTbjbAOYgwnTiEgx5WWOk5QukDVKW8p5PQ9WOrzXZMnoZ3EFINWsp5XB88sz91N6a8P59aH4M5jIewOqfuJMybH2uKIe0nIcaDeapuQMRYigo33uUpR8rRhAj4FNxUlf2PLYjEerw9pTyMGeSmSN7lsteR2hYw3RzR25VEC2TxgkK3uDeT6BBFDfpq',
prop_value_text = 'fFiii6z9r071aNawt95XKfD9g8t6AyeYxGTzRkULiTz8zn9GL0NcFEyltwNplprNpGfKHNZ8yNqoZIo2JsaP6OnhmOb7hXij7z1YKqtheABKtsZ6NHiFSpEpLVqfnNiDAimo1PZXbejen2SnAMEfGtXrFD7W9oXswMIH19vONAe4LlrhfstaKUaGT7soeMAl8Kmaqe63uUttEOGn3W7jIY1L7YsYlSFam7rrXfTxkNBpBkkW6muyUES3mMKA8zwTARV4BuRoBJOFQZ7Rc98ngq4FqVahu16EVWUN5WKui8Kzq0bCzA8UIzq9Mp87tS9q0r0AruEKMaay1P