Skip to content

Instantly share code, notes, and snippets.

View wparad's full-sized avatar
🇨🇭
I solve security in SaaS.

Warren Parad wparad

🇨🇭
I solve security in SaaS.
View GitHub Profile
@wparad
wparad / generateKmsSignedCert.js
Created August 18, 2023 13:26
Get a cert signed by KMS
const { KMS } = require('aws-sdk');
const kmsClient = new KMS();
const keyId = 'alias/DELETE_ME';
let forge = require('node-forge');
// a hexString is considered negative if it's most significant bit is 1
// because serial numbers use ones' complement notation
// this RFC in section 4.1.2.2 requires serial numbers to be positive
@wparad
wparad / gist:a6bdf4acba22f9531a58e3675bef3630
Created August 12, 2023 20:24 — forked from jatcwang/gist:ae3b7019f219b8cdc6798329108c9aee
List of all setxkbmap configuration options (including models/layout/etc)
! model
pc101 Generic 101-key PC
pc102 Generic 102-key (Intl) PC
pc104 Generic 104-key PC
pc105 Generic 105-key (Intl) PC
dell101 Dell 101-key PC
latitude Dell Latitude series laptop
dellm65 Dell Precision M65
everex Everex STEPnote
flexpro Keytronic FlexPro
@wparad
wparad / json-secure-logger.js
Created June 7, 2023 15:39
A wrapper for console.log that is safe and secure
const stringify = require('json-stringify-safe');
const shortUuid = require('short-uuid');
// Remove unnecessary strings from logging
function replacer(key, value) {
if (key === 'body' && typeof value === 'string') {
try {
return JSON.parse(value);
} catch (error) {
return value;
@wparad
wparad / symantec-vip-access-totp.md
Created April 27, 2023 11:22 — forked from jarbro/symantec-vip-access-totp.md
Generate Symantec VIP Access Token as TOTP

Generate Symantec VIP Access Token as OTP

Recently I came across a web service that required two-factor authentication using the Symantec VIP Access App. I already manage all of my OTP tokens in a different app (If you are on iOS I highly recommend using OTP Auth by Roland Moers.) and did not want to have to use yet another app to generate the TOTP.

There is a way to generate a Symantec VIP Access compatible token very easily if you have access to an environment which can run Python PIP. I happen to have Ubuntu Windows Subsystem Linux running on my machine. (If you are running Windows 10 and don't have this you should really check it out.) Let's get started...

hello

Instructions

Here we install python3-pip and qrencode so we can generate our secret, I

@wparad
wparad / gcpCloudCdnProxy.tf
Created January 21, 2023 11:23
ChatGPT says this is a GCP proxy using Cloud CDN, but I don't believe it
resource "google_compute_ssl_certificate" "proxy_cert" {
name = "proxy-cert"
domain = "new-domain.com"
cert_file = "cert.pem"
private_key_file = "key.pem"
}
resource "google_compute_target_https_proxy" "proxy" {
name = "proxy-target"
url_map = google_compute_url_map.proxy.self_link
@wparad
wparad / awsDelegatedStsAccessViaUI.py
Last active October 3, 2022 14:24
Start an AWS Console Session via a third party UI
# Documentation: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html
def getfedlink(account, user, policy):
“”"get a URL for signin for a given account/user/policy”“”
session = boto3.Session()
sts_connection = session.client(“sts”)
assumed_role_object = sts_connection.assume_role(
RoleArn=getsessionrole(account),
RoleSessionName=f”{account}-{user}“,
SourceIdentity=user,
@wparad
wparad / removeNulls.js
Created May 1, 2022 20:23
Remove nulls/undefineds so isEqual works
function removeNulls(obj, level = 0) {
if (level > 10) {
return obj;
}
if (obj === null || obj === undefined) {
return undefined;
}
if (Array.isArray(obj)) {
return obj.map(v => removeNulls(v, level + 1)).filter(v => v !== null && v !== undefined);
}
N-P-D.ext
async onEvent(trigger) {
logger.log({ title: 'Starting new Triggered work', level: 'INFO', trigger });
if (trigger.context && trigger.context.StateMachine) {
const processorId =
`${trigger.context.StateMachine.Name}|${trigger.context.State.Name}`;
const payload = trigger.context.Execution.Input;
const parameters = trigger.parameters;
const context = trigger.context.State;
const processors = {
{
"StartAt": "Start",
"States": {
"Start": {
"Type": "Task",
"Resource": { "Ref": "LambdaFunctionProductionAlias" },
"Parameters": {
"context.$": "$$",
"parameters.$": "$"
},