Skip to content

Instantly share code, notes, and snippets.

@mkol5222
mkol5222 / chkp-shiftleft-docker-image-scanner.md
Last active October 7, 2020 14:07
How to scan Docker image with Check Point shiftleft container image scanner

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")
@mkol5222
mkol5222 / ws.ps1
Created November 26, 2021 11:52 — forked from byt3bl33d3r/ws.ps1
Async Websocket PowerShell client (producer/consumer pattern)
<#
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 / ConvertFrom-Xml.ps1
Created November 29, 2021 08:54 — forked from elvarb/ConvertFrom-Xml.ps1
Powershell to convert XML to JSON
# 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 / blog.md
Last active February 3, 2022 16:06
test1

aaa

@mkol5222
mkol5222 / mssp.ps1
Last active February 17, 2022 09:01
Infinity Portal license query
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 / push-gh-pages.sh
Created April 26, 2022 05:52 — forked from motemen/push-gh-pages.sh
Shell script to setup/push GitHub pages
#!/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 / slack-notification.sh
Created May 4, 2022 13:57 — forked from julia-mareike/slack-notification.sh
Send slack message via curl
#!/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 / bash_strict_mode.md
Created June 14, 2022 21:29 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@mkol5222
mkol5222 / Get-AzureADPSPermissionGrants.ps1
Created June 16, 2022 09:53 — forked from psignoret/Get-AzureADPSPermissionGrants.ps1
Get all permissions granted to an app in Azure AD
<#
.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.