Skip to content

Instantly share code, notes, and snippets.

@habedi
habedi / test.py
Last active September 21, 2015 12:38 — forked from christianroman/test.py
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()
@habedi
habedi / server.py
Last active September 10, 2015 09:02 — forked from fmoo/server.py
CONNECT-enabled HTTP Proxy Server
from twisted.web.proxy import Proxy, ProxyRequest
from twisted.internet.protocol import Protocol, ClientFactory
import urlparse
from twisted.python import log
class ConnectProxyRequest(ProxyRequest):
"""HTTP ProxyRequest handler (factory) that supports CONNECT"""
connectedProtocol = None
@habedi
habedi / auth-basic.conf
Last active August 29, 2015 14:27 — forked from Thermionix/auth-basic.conf
nginx reverse proxy for sickbeard, couchpotato etc.
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
# If /json route receives header "application/json"
@app.route("/json", methods=['GET','POST'])
def json():
app.logger.debug("JSON received...")
app.logger.debug(request.json)
if request.json:
mydata = request.json # will be
from grab import Grab, GrabError
from multiprocessing.dummy import Pool as ThreadPool
import time
def load_proxy_list(filepath):
f = open(filepath)
proxy_list = f.read().splitlines()
f.close()
return proxy_list
@habedi
habedi / client.py
Last active August 29, 2015 14:22 — forked from micktwomey/client.py
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
#!/usr/bin/env python
import socket
import threading
import select
import sys
terminateAll = False
class ClientThread(threading.Thread):
@habedi
habedi / pingpong.erl
Last active August 29, 2015 14:21 — forked from torgeir/pingpong.erl
% networked ping
% --
% Open firewall ports 4369 (erlang port mapper) and 9100-9105 (communication ports)
%
% On node 1 start your shell with this command:
% erl -name [email protected] -setcookie cook -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9105
%
% On node 2 start your shell with this command:
% erl -name [email protected] -setcookie cook -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9105
%