一个超级简单的验证码识别。
1.png 的样本有问题,所以看情况使用吧
依赖:pip install Pillow
来源是 V2EX 上被喷惨的帖子:
#!/usr/bin/env python | |
# coding: utf-8 | |
import os | |
import sys | |
from PIL import Image, ImageChops | |
templates = [] |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# CURRENT SOURCE: https://github.com/szepeviktor/debian-server-tools/blob/master/backup/mega-get.py | |
# origin: http://julien-marchand.fr/blog/using-mega-api-with-python-examples/ |
import socket, sys, select, SocketServer, struct, time | |
class ThreadingTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): pass | |
class Socks5Server(SocketServer.StreamRequestHandler): | |
def handle_tcp(self, sock, remote): | |
fdset = [sock, remote] | |
#raw_size = 1024 | |
while True: | |
r, w, e = select.select(fdset, [], []) | |
if sock in r: |
# -*- coding: utf-8 -*- | |
import time, random | |
import urllib | |
import urllib2 | |
import cookielib | |
usr = 'cee' | |
pwd = '490896040' | |
''' |
imAmachine@vv:/tmp$ wget "http://filex.sdufe.edu.cn/downex.php?url=201402031148081721801.zip&name=%5C%27c3f50234434664e6.zip" -O 1.zip --header "Cookie: cookie_vcode_ok=1" --header "Referer: http://filex.sdufe.edu.cn/down.php" | |
--2014-03-02 19:23:36-- http://filex.sdufe.edu.cn/downex.php?url=201402031148081721801.zip&name=%5C%27c3f50234434664e6.zip | |
Resolving filex.sdufe.edu.cn (filex.sdufe.edu.cn)... 123.232.100.78 | |
Connecting to filex.sdufe.edu.cn (filex.sdufe.edu.cn)|123.232.100.78|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 33035658 (32M) [application/zip] | |
Saving to: `1.zip' | |
0% [ ] 151,613 428K/s |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> | |
<title>文件下载</title> | |
<link href="main.css" rel="stylesheet" type="text/css"> | |
<script language="javascript"> | |
function Form1_Validator(theForm) | |
{ | |
if (theForm.code.value==''){ |
# -*- coding: utf-8 -*- | |
import urllib2, urllib, sys | |
import random, time | |
starttime = time.time() | |
_error=0 | |
times=3 | |
g_url = 'http://filex.sdufe.edu.cn/down.php' | |
r_url = 'http://filex.sdufe.edu.cn/' |
#!/usr/bin/env python | |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer | |
class MyHandler(BaseHTTPRequestHandler): | |
protocol_version = 'HTTP/1.1' | |
server_version = 'nginx' | |
sys_version = '1.0' | |
def do_GET(self): | |
self.send_response(302) | |
self.send_header('Location','http://z.cn') |
# -*- coding: utf-8 -*- | |
import smtplib, email | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
def send(sub, text, smtp_debug, content, send_mail_host, send_mail_port, send_mail_user_name, send_mail_pswd, send_mail_postfix, get_mail_user, get_mail_postfix, charset): | |
send_mail_address = send_mail_user_name + '@' + send_mail_postfix | |
to_adress = get_mail_user + '@' + get_mail_postfix | |
msg = MIMEMultipart() | |
msg['Subject'] = email.Header.Header(sub,charset) |