Skip to content

Instantly share code, notes, and snippets.

View chitoge's full-sized avatar
🐱
Permanently sad

Thanh Do chitoge

🐱
Permanently sad
View GitHub Profile
@chitoge
chitoge / 0ctf_satbeginner.py
Last active August 29, 2015 14:17
0ctf SATBeginner
import socket,random, zlib, struct, string
import pycosat
import hashlib, re, itertools
import bitstring
host = '202.112.26.111'
port = 23333
#host = '127.0.0.1'
#port = 6996
@chitoge
chitoge / 0ctf_geo.py
Last active August 29, 2015 14:17
0ctf geo newbie
import telnetlib
import pycountry
from geopy import GoogleV3
import re
import sys
import shelve
host = '202.112.26.111'
port = 29995
#google_geocoding_key = 'wat'
@chitoge
chitoge / 0ctf_polyquine.py
Last active August 29, 2015 14:18
0ctf PolyQuine
#include/*
q='''*/<stdio.h>
main(){char*_;/*=;sub _:lvalue{$_}<<q;#';<<q#'''
def printf(a,*b):__import__('sys').stdout.write(a%b)
q
#*/
_=" #include/*%cq='''*/<stdio.h>%cmain(){char*_;/*=;sub _:lvalue{%c_}<<q;#';<<q#'''%cdef printf(a,*b):__import__('sys').stdout.write(a%%b)%cq%c#*/%c_=%c%s%c;printf(_,10,10,36,10,10,10,10,34,_,34,10,10,10,10);%c#/*%cq='''*/%c}//'''#=%c";printf(_,10,10,36,10,10,10,10,34,_,34,10,10,10,10);
#/*
q='''*/
}//'''#=
@chitoge
chitoge / backdoorctf_rapidfire.py
Created April 2, 2015 04:46
backdoorctf rapidfire
import socket, hashlib, time, requests
from geopy import GoogleV3
import re
import shelve
import omdb
host = '128.199.107.60'
port = 8008
rep_countrycode = False
@chitoge
chitoge / volgactf_math.py
Last active August 29, 2015 14:20
VolgaCTF mathproblem
import telnetlib
import re
import time
flag = '{you_count_as_fast_as_a_calculator}'
class Telnet(telnetlib.Telnet):
# inherit from Telnetlib and add new method
def __init__(self,host,port):
telnetlib.Telnet.__init__(self,host,port)
@chitoge
chitoge / volgactf_yacst.py
Created May 4, 2015 16:10
VolgaCTF YACST
import wave
import requests
import base64
from bs4 import BeautifulSoup
import os
sess = requests.Session()
samp = []
def solveCaptcha(x):
@chitoge
chitoge / asisctf_grids.py
Created May 11, 2015 14:21
ASIS CTF 2015 Quals - grids
from scipy.spatial import ConvexHull
import numpy as np
import ast
import telnetlib
import re
class Telnet(telnetlib.Telnet):
# inherit from Telnetlib and add new method
def __init__(self,host,port):
telnetlib.Telnet.__init__(self,host,port)
@chitoge
chitoge / asisctf_dump.py
Created May 11, 2015 15:43
ASIS CTF 2015 Quals - dump
import hashlib
# calculate key
key_ar = [0 for i in range(5)]
key_ar[0] = hex(58559604012647)[2:].decode('hex')
key_ar[1] = hex(27697077611219024)[2:].decode('hex')
key_ar[2] = hex(28839576914310229)[2:].decode('hex')
key_ar[3] = hex(14469853439423811)[2:].decode('hex')
key_ar[4] = hex(21189029315236706)[2:].decode('hex')
key = '-'.join(key_ar)
@chitoge
chitoge / mmactf_ppc40_1.py
Last active September 7, 2015 13:21
MMA CTF 2015 Lock Pattern - 20
from functools import lru_cache
from math import sqrt
from itertools import product
from collections import defaultdict, deque
size = 3
def gcd(x, y):
if (y == 0): return x
else: return gcd(y, x%y)
from functools import lru_cache
from math import sqrt
from itertools import product
from collections import defaultdict, deque
size = 4
def gcd(x, y):
if (y == 0): return x
else: return gcd(y, x%y)