Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier

Sergey Ponomarev stokito

Self-hosting become easier
View GitHub Profile
@asterite3
asterite3 / nginx.sh
Last active October 12, 2023 20:39
Serve current directory with nginx. As a regular (non-root) user (a replacement for python -m SimpleHTTPServer)
#!/bin/bash
# Usage:
# ./nginx.sh
# ./nginx.sh 8888
# ./nginx.sh 0.0.0.0 8080
set -e
HOST="127.0.0.1"
@Paratron
Paratron / docker-shell.sh
Created February 5, 2019 13:29
Open a shell into a running docker container
docker exec -ti container_id bash
@riccardomc
riccardomc / dns.go
Created November 29, 2018 10:14
Minimal DNS proxy in golang. Reply NXDOMAIN for AAAA queries.
package main
import (
"log"
"net"
"os"
"strconv"
"github.com/miekg/dns"
)
@mtigas
mtigas / onion-svc-v3-client-auth.sh
Last active April 22, 2024 07:31
experiments with using v3 onions with client auth (as of tor 0.3.5.X)
#!/bin/bash
# needs openssl 1.1+
# needs `basez` https://manpages.debian.org/testing/basez/base32hex.1.en.html
# (but something else that decodes the base64 and re-encodes the raw key bytes
# to base32 is probably fine too)
##### generate a key
openssl genpkey -algorithm x25519 -out /tmp/k1.prv.pem
@KevCui
KevCui / jwtDecoder.sh
Last active September 7, 2020 09:08
A Bash script to decode JWT token
#!/usr/bin/env bash
# HOW TO USE:
# ~$ chmod +x jwtDecoder.sh
# ~$ ./jwtDecoder.sh "<JWT token>"
padding() {
# $1: base64 string
local m p=""
m=$(( ${#1} % 4 ))
[[ "$m" == 2 ]] && p="=="

Trying to deploy WPA3 on my home network

Introduction

Recently, news broke about a new possible offline attack on WPA2 using PMKID. To summarize the attack, WPA2 protected APs can end up broadcasting PMKID values which can then be used to offline-brute-force the password.

These PMKID values are computed this way:

PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
@jayluxferro
jayluxferro / OpenWrt_Virtualbox.md
Created June 13, 2018 12:45
OpenWrt Virtualbox
  1. Download and install VirtualBox
  2. Get an OpenWrt image:
  3. Either use an existing image,
  4. Download the generic combined image for x86 (32-bit), e.g. chaos_calmer/15.05.1/x86/) LEDE 17.01.1 x86
  5. Download the generic combined image for x86_x64 (64-bit), e.g. chaos_calmer/15.05.1/x86/64) LEDE 17.01.1 x86_x64
  6. Uncompress the image if needed: gunzip openwrt.img.gz
  7. Convert it to native VirtualBox format:
VBoxManage convertfromraw --format VDI openwrt.img openwrt.vdi (in virtualbox version 5.0.12 the "--format VDI" is at the end of command)
@samyranavela
samyranavela / Example health-check script with systemd socket activation
Created April 18, 2018 12:56 — forked from kouk/Example health-check script with systemd socket activation
Simple HTTP health-check by abusing systemd socket activation with shell scripts
$ curl --dump-header - localhost:12345
HTTP/1.0 404 Not Found
Content-Type: text/html
Content-Length: 43
Date: Fri, 05 Dec 2014 17:48:56 +0000
<html>
<body>
<h1>WUT</h1>
</html>
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 2, 2024 15:08
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@sandeeprenjith
sandeeprenjith / DNSSEC-Signing.md
Last active March 23, 2024 18:15
DNSSEC Keys and Signing Process Simplified

cyber-security-2296269_1920

DNSSEC Keys and Signing Process Simplified

This article describes what happens when a zone is signed with DNSSEC. This document helps to understand the concept of zone signing and does not detail the actual steps for signing a zone.