Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan DeMarks ca0abinary

  • SPS Commerce
  • West Plains MO US
View GitHub Profile
@ca0abinary
ca0abinary / EbsDirect.py
Created February 2, 2023 21:34
Reads the partition table of an EBS snapshot using Ebs Direct API
View EbsDirect.py
# python -m pip install pyreadpartitions
# Update the volume_id to a volume with one or more snapshots you have access to
# Run the script!
from pyreadpartitions import get_disk_partitions_info
def main():
ebs = EbsDirectIO(volume_id='vol-0ec018d77cf9af4dd')
print(f'''
@ca0abinary
ca0abinary / mptz-protocol-re.md
Created August 12, 2022 13:00
Polycom MPTZ Serial Connection Reverse Engineering Notes
View mptz-protocol-re.md

Polycom Eagle Eye Protocol RE

MPTZ-6

Serial connection at 9600 8-E-1

Device issues e0 until initialized with 81 40. Initialization code can be sent at any time.

import serial
@ca0abinary
ca0abinary / Convert-UPN.ps1
Created December 6, 2021 14:47
Convert UPN
View Convert-UPN.ps1
Import-Module MSOnline
Connect-MsolService
$upn = "delete-me@geniuscentral.com"
Set-MsolUserPrincipalName -UserPrincipalName $upn -NewUserPrincipalName $upn.Replace("geniuscentral","geniuscentral.onmicrosoft")
add to
https://aad.portal.azure.com/#blade/Microsoft_AAD_IAM/GroupDetailsMenuBlade/Members/groupId/d3992f53-022d-4e63-84a7-0d38b0731011
@ca0abinary
ca0abinary / pc.py
Created October 1, 2021 16:59
Python multi-thread producer consumer
View pc.py
# Requires python3.9 and
# pip3.9 install --user requests pyodbc threading
# Outputs results.csv
import requests
import pyodbc
import threading
import queue
from time import sleep
@ca0abinary
ca0abinary / Dockerfile
Created September 25, 2021 00:25
Windows 2003 in a docker container
View Dockerfile
FROM alpine
WORKDIR /root
ADD system.tar.gz /root
RUN apk add --update qemu-system-x86_64 qemu-img spice-server qemu-hw-display-qxl
EXPOSE 80
EXPOSE 3001
ENTRYPOINT ["qemu-system-x86_64", \
"-m", "512", \
"-drive", "file=/root/system.qcow2", \
"--spice", "disable-ticketing=on,addr=0.0.0.0,port=3001", \
@ca0abinary
ca0abinary / websocket-cloudformation.yaml
Last active July 31, 2021 21:23
Creates a really basic websocket service and testing tools
View websocket-cloudformation.yaml
# sample deployment command
# aws cloudformation deploy --template-file template.yaml --capabilities CAPABILITY_NAMED_IAM --stack-name ws-test --profile dev
# sample testing uri
# aws cloudformation describe-stacks --query "Stacks[?contains(@.StackName,'ws-test')].Outputs[0][?OutputKey=='WebSocketURI'].OutputValue" --profile dev | ConvertFrom-Json
# You can test with the test.html produced by the TestHtmlPage output
# or
# npm install -g wscat
# wscat -c $(aws cloudformation describe-stacks --query "Stacks[?contains(@.StackName,'ws-test')].Outputs[0][?OutputKey=='WebSocketURI'].OutputValue" --profile dev | ConvertFrom-Json)
# and paste this test message:
# {"action":"message","message":"Hello, world!"}
@ca0abinary
ca0abinary / main.go
Last active July 12, 2021 15:54
Producer consumer
View main.go
package main
import (
"fmt"
"math/rand"
"sync"
"sync/atomic"
"time"
)
@ca0abinary
ca0abinary / Dockerfile
Created June 22, 2021 22:16
Windows Container + IIS + HTTPS (Self-signed) + ARR 3.0 Proxy
View Dockerfile
# escape=`
FROM mcr.microsoft.com/windows/servercore:20H2
# Windows Features
RUN powershell -Command `
Add-WindowsFeature Web-Server; `
Add-WindowsFeature NET-Framework-45-ASPNET; `
Add-WindowsFeature Web-Asp-Net45; `
Add-WindowsFeature NET-WCF-TCP-Activation45; `
Add-WindowsFeature NET-WCF-HTTP-Activation45;
# Chocolatey
@ca0abinary
ca0abinary / Dockerfile
Last active December 2, 2020 06:10
Docker - Build pyOdbc Microsoft SQL AWS Lambda Layer
View Dockerfile
FROM lambci/lambda:build-python3.7
WORKDIR /root
RUN yum -y update
RUN curl ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.5.tar.gz -O && \
tar xvzf unixODBC-2.3.5.tar.gz && \
cd unixODBC-2.3.5 && \
./configure --sysconfdir=/opt/python --disable-gui --disable-drivers --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE --prefix=/home && \
make install && \
cd .. && \
mv /home/* . && \
@ca0abinary
ca0abinary / keybase.md
Last active November 30, 2020 13:21
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object: