找回密码
 立即注册
查看: 1106|回复: 4

python注册脚本 凿壁借光

[复制链接]

3

主题

19

回帖

110

积分

注册会员

积分
110
发表于 2019-12-4 19:33:45 | 显示全部楼层 |阅读模式
本帖最后由 czs 于 2019-12-5 17:24 编辑

凿壁借光机场,给自己刷推荐
from selenium import webdriver
from selenium.webdriver.common.keys importKeys
from selenium.webdriver.support.ui importSelect
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui importWebDriverWait
from selenium.webdriver.support importexpected_conditions as EC
import random
import requests
import urllib.request
from bs4 import BeautifulSoup
import base64
from PIL import Image
import numpy as np
from selenium.webdriver import ActionChains
import time
import PIL.Image as image
from PIL import ImageChops, PngImagePlugin

#依赖python环境,chrome浏览器以及webdriver,依赖包参考报错,推荐anaconda

INIT_LEFT = 60
BORDER = 6
table = []
for i in range(256):
   if i < 50:
        table.append(0)
   else:
       table.append(1)


def is_pixel_equal(image1, image2, x, y):
   pixel1 = image1.load()[x, y]
   pixel2 = image2.load()[x, y]
   threshold =60
   if abs(pixel1[0] - pixel2[0]) < threshold and abs(pixel1[1] -pixel2[1]) < threshold and abs(pixel1[2] - pixel2[2]) < threshold:
       return True
   else:
       return False

def compute_gap(img1, img2):
   img1 = img1.convert("RGB")
   img2 = img2.convert("RGB")
   diff = ImageChops.difference(img1, img2)
   diff = diff.convert("L")
   diff = diff.point(table,'1')

   left = 43

   for w in range(left, diff.size[0]):
       lis = []
       for h in range(diff.size[1]):
           if diff.load()[w, h] == 1:
                lis.append(w)
           if len(lis) > 5:
                return w

def ease_out_quad(x):
   return 1 - (1 - x) * (1 - x)

def ease_out_quart(x):
   return 1 - pow(1 - x, 4)

def ease_out_expo(x):
   if x == 1:
       return 1
   else:
       return 1 - pow(2, -10 * x)

def get_track(distance, seconds,ease_func):
   tracks = [0]
   offsets = [0]
   for t in np.arange(0.0, seconds, 0.1):
       ease = ease_func
       offset = round(ease(t / seconds) * distance)
       tracks.append(offset - offsets[-1])
       offsets.append(offset)
   return tracks
i=0
while i< 10:        #获取临时邮箱,仅针对此网站,可设置注册次数#
   try:
       r = requests.get("https://10minutemail.net", verify=True)
       r.encoding = 'utf-8'
       soup = BeautifulSoup(r.text, 'html.parser')
       print(soup.input["value"])

       driver = webdriver.Chrome()
       driver.get("https://hi.ssrcf.top/auth/register")        #此处为注册地址,该站域名会更换,所以此处需更换#
       driver.find_element_by_xpath('//input[@id="name"]').send_keys('***')       #名称,自定义#
       driver.find_element_by_xpath('//input[@id="email"]').send_keys(soup.input["value"])
       driver.find_element_by_xpath('//input[@id="passwd"]').send_keys('********')        #密码#
       driver.find_element_by_xpath('//input[@id="repasswd"]').send_keys('********')       #重复密码#
       driver.find_element_by_xpath('//button[@id="imtype"]').click()
       WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.LINK_TEXT, "QQ"))).click()
       driver.find_element_by_xpath('//input[@id="wechat"]').send_keys(random.randint(666666,9999999999))
       driver.find_element_by_xpath('//input[@id="code"]').send_keys('****')         #邀请码#
       button=WebDriverWait(driver,5).until(EC.element_to_be_clickable((By.CLASS_NAME, 'geetest_radar_tip')))
        button.click()
       im=WebDriverWait(driver,5).until(EC.presence_of_element_located((By.CSS_SELECTOR,'.geetest_canvas_bg')))
       im.screenshot('captcha.png')
       JS ='returndocument.getElementsByClassName("geetest_canvas_fullbg")[0].toDataURL("image/png");'
       im_info = driver.execute_script(JS)
       im_base64 = im_info.split(',')[1]
       captcha1 = base64.b64decode(im_base64)
       with open('captcha1.png','wb') as f:
           f.write(captcha1)
       JS ='return document.getElementsByClassName("geetest_canvas_bg")[0].toDataURL("image/png");'
       im_info = driver.execute_script(JS)
       im_base64 = im_info.split(',')[1]
       captcha2 = base64.b64decode(im_base64)
       with open('captcha2.png','wb') as f:
            f.write(captcha2)

       image1 = Image.open('captcha1.png')
       image2 = Image.open('captcha2.png')

       gap=compute_gap(image1,image2)
       print('缺口位置' , gap)
       gap -= BORDER
       track = get_track(gap,0.3,ease_out_quart)
       print('滑动轨迹:',track)

       slider=WebDriverWait(driver,10).until(EC.presence_of_element_located((By.CSS_SELECTOR,'.geetest_slider_button')))
       ActionChains(driver).click_and_hold(slider).perform()
       for x in track:
           ActionChains(driver).move_by_offset(xoffset=x, yoffset=0).perform()
           time.sleep(0.1)
       ActionChains(driver).release().perform()

       time.sleep(2)

       driver.find_element_by_xpath('//button[@id="tos"]').send_keys(Keys.ENTER)
       time.sleep(2)
       driver.find_element_by_xpath('//button[@id="reg"]').click()
       flag=1

       while flag==1:
           try:
                time.sleep(5)
                driver.find_element_by_xpath('//button[@id="tos"]').send_keys(Keys.ENTER)
                time.sleep(2)
               driver.find_element_by_xpath('//button[@id="reg"]').click()
           except:
                flag=0
                driver.close()

       i=i+1
       print(i)
   except:
       driver.quit()

保存为.py文件,安装python环境使用
ssr       https://sub.sswow.xyz/link/NCGkw0iPi4NMUABU?mu=1
大概15天,VIP5,

还有天天向上也可以白嫖?   我的推广链接https://edu.lovessr.top/register?aff=96897



回复

使用道具 举报

509

主题

1158

回帖

2万

积分

管理员

积分
22898
发表于 2019-12-4 21:07:33 | 显示全部楼层
大家看不懂
回复 支持 反对

使用道具 举报

16

主题

1095

回帖

16

积分

版主

翻墙党第一帅

积分
16
发表于 2019-12-5 08:39:38 | 显示全部楼层


+1, 高深莫测。
专业抢沙发~
回复 支持 反对

使用道具 举报

5

主题

5

回帖

55

积分

注册会员

积分
55
发表于 2019-12-5 08:52:23 | 显示全部楼层
哥 撸好了把订阅地址分享下就好
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|翻墙党

GMT+8, 2026-11-4 14:39 , Processed in 0.032236 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表