Skip to content

Instantly share code, notes, and snippets.

View maple3142's full-sized avatar

maple maple3142

  • Taiwan
  • 21:10 (UTC +08:00)
  • X @maple3142
View GitHub Profile
@maple3142
maple3142 / README.md
Created February 13, 2023 16:45
zig cc tricks
@maple3142
maple3142 / solve.sage
Last active February 12, 2023 08:19
AIS3 EOF 2023 Game RNG Solver
from hashlib import sha256
from uuid import uuid4
def gen_coef(m, n):
ret = []
for _ in range(n):
m = sha256(m).digest()
print(list(m))
ret.append(int.from_bytes(m, "little"))
@maple3142
maple3142 / README.md
Created January 13, 2023 15:58
socat tty shell

Shell

Server:

socat tcp-l:1337,reuseaddr,fork exec:"/bin/sh",pty,stderr,setsid,sigint,sane

Client:

@maple3142
maple3142 / .config
Created January 12, 2023 02:34
WSL2-Linux-Kernel config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.15.79.1 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23900
P.<a, b, c> = QQ[]
eq = a / (b + c) + b / (a + c) + c / (a + b) - 4
f = EllipticCurve_from_cubic(eq.numerator())
fi = f.inverse()
G = f.codomain().gens(0)[0]
for i in range(20):
a, b, c = fi(i * G)
if a > 0 and b > 0 and c > 0:
l = reduce(lcm, [a.denom(), b.denom(), c.denom()])
a, b, c = a * l, b * l, c * l
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main() {
if (fork() == 0) {
const char *c = "Typing: ";
for (unsigned int i = 0; i < strlen(c); i++) {
ioctl(0, TIOCSTI,
@maple3142
maple3142 / rrngg.py
Created January 9, 2023 08:37
ImaginaryCTF Round 30 rrngg
#!/usr/bin/env python3
import random
from Crypto.Util.number import long_to_bytes as ltb
from Crypto.Util.strxor import strxor
unintended_solution_yeeter = 1
# getPrime(512) from Crypto.Util.number
prime = 9748729228494339631846388699994098788507701354484040512690379598196693697693937149457269291065421274894121574705508351692344913516332264306279955933193803
@maple3142
maple3142 / chall.py
Last active December 14, 2022 05:50
RCTF 2022 - easyRSA
from Crypto.Util.number import getPrime, inverse, bytes_to_long
with open('flag.txt', 'rb') as f:
flag = f.read()
def v(k):
if k == 0:
return 2
if k == 1:
@maple3142
maple3142 / gin.py
Last active December 8, 2022 16:31
Git Index File Parser / Dumper
# Modified from https://github.com/Ebryx/GitDump/blob/master/gin.py
import binascii
import struct
import os
import io
class GitIndexParsingException(Exception):
pass
@maple3142
maple3142 / weak_key.sage
Created December 4, 2022 01:48
RSA weak key
# by @remy_o in CryptoHack Discord
# https://groups.google.com/a/mozilla.org/g/dev-security-policy/c/o2_vKIslDBc
# https://crt.sh/?id=8093628131
N = """00:90:00:00:00:00:00:00:00:00:00:00:00:00:00:
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:
00:00:00:00:00:00:00:06:39:39:c0:18:00:00:00:
18:00:00:00:00:00:00:00:00:00:00:00:24:39:f9:
c0:18:00:00:90:18:c0:00:00:00:00:00:00:00:00:
00:00:b1:3a:b9:c0:18:00:00:00:1c:80:00:00:00:
00:00:00:00:00:00:00:7b:44:79:c6:69:39:c0:18: