# coding:utf-8

from ctypes import *

import requests

import json

import random

import binascii

from config import config

class Dama2():

"""打码兔打码."""

_username = ''

_password = ''

__attrs__ = ['DM', 'username', 'password', 'softuuid', 'timeout']

def __init__(self):

self.DM = WinDLL('lib/CrackCaptchaAPI.dll')

if not self._username:

Dama2._username = config['dama']['dama2']['username']

Dama2._password = config['dama']['dama2']['password']

self.username = c_char_p(self._username)

self.password = c_char_p(self._password)

self.softuuid = c_char_p('6fbc06efdc777eee854842572102daec')

self.timeout = c_ushort(30)

def recv_byte(self, imgdata, imgtype=42):

# imgdata = c_void_p(imgdata)

imgleng = c_uint(len(imgdata))

imgtype = c_ulong(imgtype)

res = c_char_p('')

code = self.DM.D2Buf(self.softuuid, self.username, self.password, imgdata, imgleng, self.timeout, imgtype, res)

if code > 0:

return res.value

return False

def report_err(self, imgid):

return False

class Chaoren():

_username = ''

_password = ''

__attrs__ = ['DM', 'username', 'password', 'softuuid', 'timeout']

def __init__(self):

if not self._username:

Chaoren._username = config['dama']['chaoren']['username']

Chaoren._password = config['dama']['chaoren']['password']

self.s = requests.Session()

self.s.encoding = 'utf-8'

self.s.timeout = 16

self.data = {

'username': self.username,

'password': self.password,

'softid': '1234',#1234换成自己的

'imgid': '',

'imgdata': ''

}

def get_left_point(self):

try:

r = self.s.post('http://apib.sz789.net:88/GetUserInfo.ashx', self.data)

return r.json()

except requests.ConnectionError:

return self.get_left_point()

except:

return False

def recv_byte(self, imgdata):

self.data['imgdata'] = binascii.b2a_hex(imgdata).upper()

try:

r = self.s.post('http://apib.sz789.net:88/RecvByte.ashx', self.data)

res = r.json()

if res[u'info'] == -1:

self.report_err(res[u'imgid'])  # 识别错误

return False

return r.json()[u'result']

except requests.ConnectionError:

return self.recv_byte(imgdata)

except:

return False

def report_err(self, imgid):

self.data['imgid'] = imgid

if self.data['imgdata']:

del self.data['imgdata']

try:

r = self.s.post('http://apib.sz789.net:88/ReportError.ashx', self.data)

return r.json()

except requests.ConnectionError:

return self.report_err(imgid)

except:

return False

class Dama():

flag = 'dama2'

def __init__(self):

if self.flag == 'dama2':

self.w = Dama2()

elif self.flag == 'chaoren':

self.w = Chaoren()

else:

self.w = Dama2()  # 默认

def recv_byte(self, imgdata):

return self.w.recv_byte(imgdata)

def report_err(self, imgid):

return self.w.report_err(imgid)

# test

if __name__ == '__main__':

pass

"""

username and password 更换为自己的

"""

python绘图打码_python实现的利用打码兔和超人打码封装的打码类相关推荐

  1. python绘图和可视化_Python 绘图和可视化详细介绍

    Python之绘图和可视化 1. 启用matplotlib 最常用的Pylab模式的IPython(IPython --pylab) 2. matplotlib的图像都位于Figure对象中. 可以使 ...

  2. python绘图 添加文字_Python | 将文字添加到绘图中

    python绘图 添加文字 Adding text to a plot is one of the most used features of matplotlib.pyplot and there ...

  3. python多核运行程序_python单进程能否利用多核cpu的测试结论

    在很早的时候,就听网上的文章说: python有GIL,所以在单进程内,即使使用多线程也无法利用到多核的优势,同一时刻,python的字节码只会运行在一个cpu上. 以前也是奉为真理,直到今天在对自己 ...

  4. python绘图课设_python课程设计笔记(三)turtle绘图库(海龟库)

    实例:绘制一条蟒蛇 #turtle:绘图库(海龟库) importturtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-250) ...

  5. python绘图矩阵散点图_Python实践:seaborn的散点图矩阵(Pairs Plots)可视化数据

    如何快速创建强大的可视化探索性数据分析,这对于现在的商业社会来说,变得至关重要.今天我们就来,谈一谈如何使用python来进行数据的可视化! 一旦你有了一个很好的被清理过的数据集,下一步就是探索性数据 ...

  6. python爬斗鱼直播_Python爬虫:利用API实时爬取斗鱼弹幕

    原标题:Python爬虫:利用API实时爬取斗鱼弹幕 这些天一直想做一个斗鱼爬取弹幕,但是一直考试时间不够,而且这个斗鱼的api接口虽然开放了但是我在github上没有找到可以完美实现连接.我看了好多 ...

  7. python输出生日程序_Python中:利用七段数码管输出自己的生日及系统当前时间

    1.问题描述:利用七段数码管将自己的生日输出,带有年月日,并用不同的颜色表示. import turtle, time def drawLine(draw): #绘制单段数码管 drawGap() # ...

  8. python绘图函数返回_python – Matplotlib返回一个绘图对象

    我有一个包装pyplot.plt的函数,所以我可以使用经常使用的默认值快速创建图形: def plot_signal(time, signal, title='', xlab='', ylab='', ...

  9. python 绘图 背景颜色_python作图坐标轴与图像标签、画布背景的颜色设置

    续接上篇,先说画布颜色设置. 颜色设置,需要两处,画布及绘图区(绘图区就按Excel作图的来吧) 画布的背景颜色设置 fig = plt.figure(figsize=(15,12),facecolo ...

最新文章

  1. 【ACM】杭电OJ 1004
  2. .NET 2.0 泛型在实际开发中的一次小应用
  3. nginx log response_python+pandas分析nginx日志的实例
  4. Java内部类与静态内部类
  5. javascript怎么监听 form.submit事件
  6. 爬虫之proxy(代理)
  7. 数据库逻辑删除的sql语句_SQL查询优化的数据库设计和逻辑断言
  8. Android:Fragment官方文档
  9. HDU - 2047
  10. windows安装MySQL详细步骤
  11. 课程表里的表表机器人_酷Q机器人课程表查询插件 QianSW.Com系列插件
  12. sphinx使用笔记
  13. Flutter 监听返回键
  14. 《C语言程序设计》第4版 何钦铭、颜晖主编 课后习题答案
  15. 有趣的设计模式——从一杯奶茶品味装饰模式
  16. 【日常】纪录一个愚蠢的问题
  17. ubuntu挂载raid硬盘_Ubuntu服务器挂载新硬盘的步骤
  18. 广东2007新登记软件产品清单(转载)
  19. rk3368一些定制修改
  20. 智慧矿山GIS可视化运营管理平台解决方案

热门文章

  1. 什么是服务器?超详细
  2. 非全局安装npm,在项目目录下执行命令
  3. adb pull安装的apk
  4. Extract temperature and bt from station of Tib
  5. (三) 区块链数据结构 – 交易
  6. Python 十进制转换为二进制 高位补零
  7. 查看linux raid级别,已安装系统查看raid级别信息
  8. A Two-stage Unsupervised Approach for Low light Image Enhancement(一种两阶段无监督的微光图像增强方法)
  9. 分辨率、DPI、PPI和屏幕尺寸,你都知道是啥么?
  10. 现实迷途 第三十章 若即若离