View Get-AzureADPSPermissionGrants.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Lists delegated permission grants (OAuth2PermissionGrants) and application permissions grants (AppRoleAssignments) granted to an app. | |
.PARAMETER ObjectId | |
The ObjectId of the ServicePrincipal object for the app in question. | |
.PARAMETER AppId | |
The AppId of the ServicePrincipal object for the app in question. |
View install_elasticsearch_and_kibana_on_macos_and_ubuntu.md
MacOS - Running Locally (Easy Mode)
https://www.elastic.co/guide/en/kibana/current/brew.html https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
brew install elastic/tap/kibana-full
View slack-notification.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MESSAGE="Message" | |
SLACK_CHANNEL="#slack-channel" | |
SLACK_TOKEN=xoxb-1234-000000000000 | |
curl -X POST \ | |
-H "Authorization: Bearer $SLACK_TOKEN" \ | |
-H "Content-type: application/json; charset=utf-8" \ | |
--data '{"channel":"'$SLACK_CHANNEL'","text":"'"$MESSAGE"'"}' \ |
View push-gh-pages.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: push-gh-pages DIRECTORY # DIRECTORY is where GitHub pages contents are in (eg. build) | |
# LICENSE: Public Domain | |
set -e | |
remote=$(git config remote.origin.url) | |
described_rev=$(git rev-parse HEAD | git name-rev --stdin) |
View mssp.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-CPPortalSession ($key, $secret) { | |
$body = @{ | |
clientId = $key; | |
accessKey = $secret | |
} | ConvertTo-Json | |
try { | |
$res = Invoke-RestMethod -Uri "https://cloudinfra-gw.portal.checkpoint.com/auth/external" ` | |
-Headers @{"Content-Type" = "application/json" } ` |
View blog.md
aaa
View ConvertFrom-Xml.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://stackoverflow.com/questions/42636510/convert-multiple-xmls-to-json-list | |
# Use | |
# [xml]$var = Get-Content file.xml | |
# Convert to JSON with | |
# $var | ConvertFrom-XML | ConvertTo-JSON -Depth 3 | |
# Helper function that converts a *simple* XML document to a nested hashtable | |
# with ordered keys. | |
function ConvertFrom-Xml { | |
param([parameter(Mandatory, ValueFromPipeline)] [System.Xml.XmlNode] $node) |
View ws.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
References: | |
- https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocket?view=netframework-4.5 | |
- https://github.com/poshbotio/PoshBot/blob/master/PoshBot/Implementations/Slack/SlackConnection.ps1 | |
- https://www.leeholmes.com/blog/2018/09/05/producer-consumer-parallelism-in-powershell/ | |
#> | |
$client_id = [System.GUID]::NewGuid() | |
$recv_queue = New-Object 'System.Collections.Concurrent.ConcurrentQueue[String]' |
View chkp-shiftleft-docker-image-scanner.md
How to scan Docker container image using Check Point shiftleft command-line scanner
Requirements
Have your CloudGuard Dome9 API keys ready. They are obtained from Dome 9 web UI at Settings / Credentials section
Env. variable | Description |
---|---|
CHKP_CLOUDGUARD_ID | your D9 API key identifier ("username") |
CHKP_CLOUDGUARD_SECRET | D9 API key secret ("password") |
NewerOlder