Skip to content

Instantly share code, notes, and snippets.

from io import BytesIO
from time import sleep, time
from picamera import PiCamera
from PIL import Image, ImageChops
import numpy as np
def take_image(cam, stream):
cam.capture(stream, resize=(320, 240), format='jpeg')
# "Rewind" the stream to the beginning so we can read its content
stream.seek(0)
# Start matrix with tor proxy:
# torsocks python3 -m synapse.app.homeserver --config-path /etc/matrix/homeserver.yaml
# /etc/matrix/homeserver.yaml
listeners:
- port: 8448
type: http
tls: false # <-- needs to be false
bind_addresses: ['127.0.0.1']
resources:
Problem:
Error TS2688: Cannot find type definition file for 'frida-gum'
Solution:
yarn add --dev @types/frida-gum
Problem:
[TypeScript error: /node_modules/@types/frida-gum/index.d.ts(2317,15): Error TS2300: Duplicate identifier 'File'.]
Solution:
@NicolaiSoeborg
NicolaiSoeborg / BME680-logger.py
Last active January 30, 2022 16:03
Save and plot data from BME680 (Raspberry Pi)
#!/usr/bin/env python3
import json, os, sqlite3
from datetime import datetime
from random import randint
from time import time, sleep
try:
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient # pip3 install azure-storage-blob
except: pass
def get_db():
from time import time
from functools import partial
import random
import trio # python3 -m pip install --upgrade trio
FTP_RESPONSE = "\r\n".join([
"220 ProFTPD 1.3.1 Server (ProFTPD)",
"220 " + "".join(random.choice('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') for _ in range(1001)),
"331 Password required"
])
@NicolaiSoeborg
NicolaiSoeborg / forwarder.py
Last active March 18, 2021 10:35
MITM proxy program to forward (tee) traffic between two TCP ports
import trio # python3 -m pip install --upgrade trio
from functools import partial
async def forward_from_a_to_b(a, b):
async for chunk in a:
print(f"=> {chunk}", flush=True)
await b.send_all(chunk)
@NicolaiSoeborg
NicolaiSoeborg / smittestop-scrape.py
Created November 17, 2020 23:11
Scrape smittestop status
import re
import time
import httpx
URL = "https://smittestop.dk/status/"
r = httpx.get(URL)
assert r.status_code == 200, f'{r.status_code}: {r.content}'
@NicolaiSoeborg
NicolaiSoeborg / harden.sh
Last active April 27, 2024 12:59
deb/apt based security tools
# Verify deb checksums:
sudo apt install debsums
# RNG tools:
sudo apt install rng-tools5
# TPM tools
sudo apt install tpm2-tools
# Monitor for ARP spoofing
@NicolaiSoeborg
NicolaiSoeborg / build-ghidra.sh
Last active September 27, 2020 09:37
Building Ghidra
git clone git@github.com:NationalSecurityAgency/ghidra.git
cd ghidra
# You need gradle v5.x or higher! (Ubuntu 20.04 ships 4.x)
gradle --init-script gradle/support/fetchDependencies.gradle init
gradle buildGhidra
# Now ghidra will be in: build/dist/ghidra_*_DEV_*.zip
@NicolaiSoeborg
NicolaiSoeborg / facebook-bridge.md
Created September 9, 2020 22:05
Setting up matrix - facebook bridge