python模拟真实鼠标轨迹实现滑条验证,nuitka打包python代码,实战我们强【强烈建议收藏】

python安装打包模块

pip install nuitka

核心程序编译成exe

python -m nuitka --standalone tiktok_mouse_move.py

python滑块算法

# coding:utf-8
import sys

import pyautogui as pg

def get_track(distance):
    """
    根据偏移量获取移动轨迹
    :param distance: 偏移量
    :return: 移动轨迹
    """
    # 移动轨迹
    track = []
    # 当前位移
    current = 0
    # 减速阈值
    mid = distance * 3 / 4
    # 计算间隔
    t = 1
    # 初速度
    v = 0

    while current < distance:
        if current < mid:
            # 加速度为正 2
            a = 2
        else:
            # 加速度为负 3
            a = -3

        a = 4 if current < mid / 2 else (5 if current < mid else -3)

        # 初速度 v0
        v0 = v
        # 当前速度 v = v0 + at
        v = v0 + a * t
        move = v0 * t + 1 / 2 * a * t * t
        # 当前位移
        current += move
        # 加入轨迹
        track.append(round(move))
        # print '轨迹    ', track
    return track

def move_hk(x,y,data,_tracks):
    move_distance = 0

    for long in _tracks:
        move_distance=move_distance+long
        pg.moveTo(x + move_distance, y, 0.1)


    move_distance=move_distance+2
    pg.moveTo(x + move_distance, y, 0.081)

    move_distance=move_distance-2
    pg.moveTo(x + move_distance, y, 0.075)


def main():
    #print("第一个传入的参数为:", sys.argv[1])
    distance = sys.argv[1]

    x = sys.argv[2]
    y = sys.argv[3]

    distance = int(distance)
    x = float(x)
    y = float(y)
    #x - -----------> 822.0
    #y - -----------> 688.5

    _tracks = get_track(distance)
    new_1 = _tracks[-1] - (sum(_tracks) - distance)
    _tracks.pop()

    _tracks.append(new_1)

    # 四个节点合并一个节点记得 节点总和-3
    get_1 = _tracks[-1]
    get_2 = _tracks[-2]
    get_3 = _tracks[-3]
    get_4 = _tracks[-4]
    get_two = get_1 + get_2 + get_3 + get_4 - 7
    _tracks.pop()
    _tracks.pop()
    _tracks.pop()
    _tracks.pop()
    _tracks.append(get_two)

    _tracks.append(3)
    _tracks.append(4)


    move_hk(x, y, distance, _tracks)
    print(distance,x,y)

if __name__ == "__main__":
    #python .\test_mouse_move.py 160 822.0 688.5

    main()

python调用exe代码

假设生成的exe目录在tiktok_mouse_move

cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(cur_path)
os.popen(cur_path + '\\' + 'tiktok_mouse_move' + '\\' + 'tiktok_mouse_move.exe {0} {1} {2}'.format(distance,x,y)).read()

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逆向导师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值