Skip to content

Instantly share code, notes, and snippets.

@mkol5222
mkol5222 / Get-AzureADPSPermissionGrants.ps1
Created Jun 16, 2022 — forked from psignoret/Get-AzureADPSPermissionGrants.ps1
Get all permissions granted to an app in Azure AD
View Get-AzureADPSPermissionGrants.ps1
<#
.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 slack-notification.sh
#!/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"'"}' \
@mkol5222
mkol5222 / push-gh-pages.sh
Created Apr 26, 2022 — forked from motemen/push-gh-pages.sh
Shell script to setup/push GitHub pages
View push-gh-pages.sh
#!/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)
@mkol5222
mkol5222 / mssp.ps1
Last active Feb 17, 2022
Infinity Portal license query
View mssp.ps1
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" } `
@mkol5222
mkol5222 / ConvertFrom-Xml.ps1
Created Nov 29, 2021 — forked from elvarb/ConvertFrom-Xml.ps1
Powershell to convert XML to JSON
View ConvertFrom-Xml.ps1
# 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)
@mkol5222
mkol5222 / ws.ps1
Created Nov 26, 2021 — forked from byt3bl33d3r/ws.ps1
Async Websocket PowerShell client (producer/consumer pattern)
View ws.ps1
<#
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]'
@mkol5222
mkol5222 / chkp-shiftleft-docker-image-scanner.md
Last active Oct 7, 2020
How to scan Docker image with Check Point shiftleft container image scanner
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")