Skip to content

Instantly share code, notes, and snippets.

.loader {
position: absolute;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
border: 16px solid #f3f3f3;
border-top: 16px solid #3498db;
border-radius: 50%;
@JBirdVegas
JBirdVegas / CertificatePinning.swift
Created October 14, 2020 18:27
Swift Certificate pinning example via cert.ist api
#!/usr/bin/env swift -suppress-warnings
import Foundation
import Security
import CommonCrypto
import CryptoKit
let sema = DispatchSemaphore(value: 0)
// Structure to hold the api response values we need
@JBirdVegas
JBirdVegas / main.rb
Created October 13, 2020 15:41
cert.ist certificate chain pinning example Ruby
#!/usr/bin/env ruby -W0
require 'net/http'
require 'openssl'
require 'json'
require 'digest'
def validate_cert_for_domain(domain)
uri = URI("https://api.cert.ist/#{domain}")
response = Net::HTTP.get(uri)
@JBirdVegas
JBirdVegas / Program.cs
Created September 23, 2020 15:24
Certificate pinning example using C#
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;
namespace CertificatePinningTutorial
{
internal class Program
import time
import netifaces
from scapy import sendrecv
from scapy.layers import l2
_SLEEP_INTERVAL = 5
DEBUG = True
import typing
def safer_execute(method: typing.Callable[[typing.Any, typing.Optional[typing.Dict[str, typing.Any]]], typing.Any],
errors: typing.List[typing.Type[Exception]],
*args, default=None, **kwargs):
try:
return method(*args, **kwargs)
except tuple(errors):
if callable(default):
@JBirdVegas
JBirdVegas / s3_undelete.py
Created September 14, 2018 05:22
Bulk undelete of versioned s3 objects
#!/usr/bin/env python
import json
from datetime import datetime
from boto3 import Session
BUCKET_NAME = "my-sweet-bucket"
prefix = 'my-sweet-dir'
session = Session(region_name='us-east-1', profile_name='my.sweet.profile.name')
@JBirdVegas
JBirdVegas / pinned_request.py
Last active November 19, 2023 16:50
Example of how to perform certificate pinning in python without host or chain validation
import hashlib
import io
import json
import socket
import ssl
from base64 import b64encode
from json import JSONDecodeError
from typing import Any, Dict, Optional
from urllib import parse
@JBirdVegas
JBirdVegas / tf_0_11_error.tf
Created November 21, 2017 16:59
Gist to showcase configuration to trigger error in terraform
resource "null_resource" "write_py" {
triggers {
time = "${timestamp()}"
}
provisioner "local-exec" {
command = <<PYTHON
echo "import json
from concurrent.futures import ThreadPoolExecutor
from time import sleep
@JBirdVegas
JBirdVegas / error_from_terraform_0_11.txt
Created November 21, 2017 16:52
ERROR: $ TF_LOG=trace terraform plan
$ TF_LOG=trace terraform plan
2017/11/21 10:50:23 [INFO] Terraform version: 0.11.0 ec9d4f1d0f90e8ec5148f94b6d634eb542a4f0ce+CHANGES
2017/11/21 10:50:23 [INFO] Go runtime version: go1.9
2017/11/21 10:50:23 [INFO] CLI args: []string{"/Users/Jonathan.Stanford/bin/terraform", "plan"}
2017/11/21 10:50:23 [DEBUG] Attempting to open CLI config file: /Users/jonathan.stanford/.terraformrc
2017/11/21 10:50:23 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/11/21 10:50:23 [INFO] CLI command args: []string{"plan"}
2017/11/21 10:50:23 [INFO] command: empty terraform config, returning nil
2017/11/21 10:50:23 [DEBUG] command: no data state file found for backend config
2017/11/21 10:50:23 [DEBUG] New state was assigned lineage "c46e7369-871e-4fa2-a20b-a6586036d0e9"