Skip to content

Instantly share code, notes, and snippets.

View minhtt159's full-sized avatar

Minh Trần minhtt159

View GitHub Profile
@minhtt159
minhtt159 / modulus.py
Created May 22, 2018 08:40
VNPT Secathon 2018
# Took from SO
def egcd(a, b):
if a == 0:
return (b, 0, 1)
g, y, x = egcd(b%a,a)
return (g, x - (b//a) * y, y)
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
@minhtt159
minhtt159 / solve_xor.py
Created July 29, 2018 10:03
ISITDTU CTF - XOR
enc_flag = '1d14273b1c27274b1f10273b05380c295f5f0b03015e301b1b5a293d063c62333e383a20213439162e0037243a72731c22311c2d261727172d5c050b131c433113706b6047556b6b6b6b5f72045c371727173c2b1602503c3c0d3702241f6a78247b253d7a393f143e3224321b1d14090c03185e437a7a607b52566c6c5b6c034047'.decode('hex')
# print len(enc_flag)
key = [i for i in range(10)]
flag = [chr(i) for i in range(len(enc_flag))]
m = []
for a in range(len(key)):
i = a
for b in range(len(flag)/len(key)):
@minhtt159
minhtt159 / baby.py
Created July 29, 2018 10:12
ISITDTU CTF - Baby
import os
import socket
import threading
from hashlib import *
import SocketServer
import random
from flag import flag
host, port = '0.0.0.0', 33337
BUFF_SIZE = 1024
@minhtt159
minhtt159 / love_cryptography.py
Last active July 29, 2018 10:44
ISITDTU CTF - Love CryptoGraphy
import random
from gmpy2 import *
from message import mes
from secret import m,n,c
assert "ISITDTU" in mes
s = []
for i in mes:
x = (m* ord(i) + c) % n
@minhtt159
minhtt159 / AES_CNV.py
Created July 29, 2018 10:54
ISITDTU CTF - AES_CNV
from hashlib import md5
from base64 import b64decode
from base64 import b64encode
from Crypto.Cipher import AES
from time import ctime
from Secret import __SECRET__
import os
BLOCK_SIZE = 16
@minhtt159
minhtt159 / ecc.py
Created July 29, 2018 11:15
ISITDTU CTF - ECC
from random import randint
from sys import argv, stdout
from fastecdsa.curve import P256
from fastecdsa.point import Point
from mathutil import p256_mod_sqrt, mod_inv
def gen_point():
P = P256.G
d = randint(2, P256.q)
e = mod_inv(d, P256.q)
@minhtt159
minhtt159 / final.py
Created August 19, 2018 19:33
WhiteHat - Crypto
from pwn import *
import sys, os
def strxor(a,b):
return ''.join([chr(ord(x)^ord(y)) for (x,y) in zip(a,b)])
records = '''I do nothing.
I'm a chat bot.
I'm from Vietnam.
My name is ChatBot.
@minhtt159
minhtt159 / fake_prince.py
Created August 30, 2018 07:07
MeePwn CTF Final 2018 - Fake Prince
#!/usr/bin/env python2
from gmpy2 import powmod, is_prime
from flag import FLAG
import sys
from hashlib import sha256
from os import urandom
import sys
def write_to_file(num):
@minhtt159
minhtt159 / tiktok.py
Created August 30, 2018 08:36
MeePwn CTF Final 2018 - TikTok
#!/usr/bin/env python3
import sys, hashlib
def decrypt_password(user, pass_enc):
key = hashlib.md5(user + b"283i4jfkai3389").digest()
passw = ""
for i in range(0, len(pass_enc)):
passw += chr(pass_enc[i] ^ key[i % len(key)])
@minhtt159
minhtt159 / dumps.txt
Created August 30, 2018 08:43
MeePwn CTF Final 2018 - Handmade
function name: (null)
number of ops: 39
compiled vars: !0 = $flag, !1 = $_box, !2 = $magic
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, 'FLAG+HERE'
5 1 NOP
13 2 NOP
21 3 NOP
33 4 NOP