Skip to content

Instantly share code, notes, and snippets.

View maple3142's full-sized avatar

maple maple3142

View GitHub Profile
@maple3142
maple3142 / README.md
Created February 28, 2025 03:46
vscode git signing & gpg tty pinentry

A workaround for people who prefer entering password in tty when possible (e.g. using pinentry-mode loopback) but don't want to break vscode commit signing:

  1. Create a ~/.local/bin/my-pinentry.sh:
#!/bin/sh
if [ "$PINENTRY_USER_DATA" = "tty" ]; then
    exec /usr/bin/pinentry-tty "$@"
else
    exec /usr/bin/pinentry "$@"
fi
@maple3142
maple3142 / asdf_shell.zsh
Created February 12, 2025 03:31
asdf shell for asdf 0.16.0+
asdf_shell() {
export "ASDF_${1:u}_VERSION"="$2"
}
# and completion for zsh assuming ASDF_DATA_DIR is set
_asdf_shell_1() {
local -a plugins=( "${ASDF_DATA_DIR:?}/plugins"/*(:t) )
compadd -a plugins
}
_asdf_shell_2() {
@maple3142
maple3142 / Dockerfile
Last active December 1, 2024 17:28
Sage + macaulay2 in docker
# Time usage: <5min
# Net usage: ~200MB
# Disk usage: <800MB docker image
FROM ubuntu:20.04
# Setting up Macaulay2 repository
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common apt-transport-https && \
@maple3142
maple3142 / solve.py
Created November 24, 2024 08:31
SECCON CTF 13 (2024) Quals - seqr
from sage.all import *
from lll_cvp import *
import os
import signal
import time
import random
from secrets import randbelow
from pwn import process, remote
from hashlib import sha1
from Crypto.Cipher import AES
@maple3142
maple3142 / exp1.py
Created November 10, 2024 14:24
HITCON CTF 2024 Final - koh-ed25519 Author's Exploit
import argparse
import json
import os
import subprocess
from base64 import b64decode
from pathlib import Path
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
@maple3142
maple3142 / gf_mul_linear.sage
Created October 13, 2024 18:02
GF multiply by constant to matrix multiplication
x = polygen(GF(2))
mod = x.parent().irreducible_element(8, algorithm='random')
F = GF(2^8, 'a', modulus=mod)
def get_multiply_matrix(mul, mod):
return mul.polynomial()(matrix.companion(mod))
mul = F.random_element()
T = get_multiply_matrix(mul, mod)
for _ in range(100):
@maple3142
maple3142 / solve.sage
Created October 9, 2024 14:10
idk ctf hssp challenge
from sage.all import *
from Crypto.Util.number import *
from os import urandom
from cpmpy import *
from lll_cvp import flatter
flag = b"flag{test_flag}"
def pad(msg, length):
@maple3142
maple3142 / go_duplex_not_working.go
Created October 8, 2024 03:37
HTTP full duplex
package main
import (
"fmt"
"io"
"net"
"net/http"
"time"
)
@maple3142
maple3142 / a.jl
Last active October 6, 2024 13:35
BRICS+ CTF 2024 - xoshiro256++ (works with 4500 outputs)
flag = read("flag.txt") # brics+{...}
for _ in 1:1500
println(bytes2hex(flag .⊻ rand(UInt8, length(flag))))
end
@maple3142
maple3142 / wol_go.go
Created September 26, 2024 14:35
wake on lan go
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"