吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2370|回复: 21
收起左侧

[Python 原创] 开源整蛊特效库

  [复制链接]
pythonhnm 发表于 2023-7-26 20:27
本帖最后由 pythonhnm 于 2023-7-27 12:44 编辑

写的不是很好,就是图个乐子。
本人承诺,绝对无害!!!
里面就是各种各样的特效,具体意思看类名就能理解了。
可以使用pip安装
pip install SupyCool
效果图的话就有别人补充吧,不会录动图。。。
给代码加点注释,大家估计就更清楚了
这里直接上代码:
[Python] 纯文本查看 复制代码
import time
import ctypes
import random
import win32con
import win32gui
import win32api

class SupyCool:
    class cursor:
        @staticmethod
        def DrawIcon(icon_ids=[]):
            user32 = ctypes.windll.user32
            gdi32 = ctypes.windll.gdi32
            hwnd = win32gui.GetDesktopWindow()
            hdc = user32.GetDC(hwnd)
            icon_size = win32api.GetSystemMetrics(win32con.SM_CXICON)

            # Save the original cursor.
            original_cursor = user32.CopyIcon(user32.GetCursor())

            while True: # Funny fucking=)
                point = win32gui.GetCursorPos()

                # Draw original icons.
                user32.DrawIcon(hdc, point[0], point[1], original_cursor)

                for i, icon_id in enumerate(icon_ids):
                    hicon = user32.LoadImageW(None, icon_id, win32con.IMAGE_ICON, icon_size, icon_size, win32con.LR_DEFAULTCOLOR | win32con.LR_SHARED)
                    user32.DrawIcon(hdc, point[0] + (i + 1) * icon_size, point[1] + (i + 1) * icon_size, hicon)

                # flush
                user32.UpdateWindow(hwnd)

                time.sleep(0.001)
        @staticmethod
        def Jitter(sway=2):
            user32 = ctypes.windll.user32
            kernel32 = ctypes.windll.kernel32
            class POINT(ctypes.Structure):
                 _fields_ = [("x", ctypes.c_long), ("y", ctypes.c_long)]
            x, y, a = 0, 0, 0
            p = POINT()
            while True: # Funny fucking=)
                user32.GetCursorPos(ctypes.byref(p))
                x = random.randint(0, sway)
                y = random.randint(0, sway)
                a = random.randint(0, 1)

                if a == 1:
                    user32.SetCursorPos(p.x + x, p.y + y)
                elif a == 0:
                    user32.SetCursorPos(p.x - x, p.y - y)

                kernel32.Sleep(15)
    class screen:
        @staticmethod
        def InvertColor(sleep_time=1):
            class RECT(ctypes.Structure):
                _fields_ = [("left", ctypes.c_long),
                            ("top", ctypes.c_long),
                            ("right", ctypes.c_long),
                            ("bottom", ctypes.c_long)]
            user32 = ctypes.WinDLL("user32.dll")
            gdi32 = ctypes.WinDLL("gdi32.dll")
            desktop = user32.GetDesktopWindow()
            hdc = user32.GetWindowDC(desktop)
            rect = RECT()
            user32.GetWindowRect(desktop, ctypes.byref(rect))
            while True: # Funny fucking=)
                gdi32.BitBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hdc, 0, 0, 3342344)
                time.sleep(sleep_time)
            user32.ReleaseDC(desktop, hdc)
        @staticmethod
        def ChaosBlock(sleep_time=0.1):
            SRCCOPY = 0x00CC0020
            CAPTUREBLT = 0x40000000
            bitblt = ctypes.windll.gdi32.BitBlt
            user32 = ctypes.windll.user32
            screen_width = user32.GetSystemMetrics(0)
            screen_height = user32.GetSystemMetrics(1)
            hdc_src = user32.GetDC(0)
            try:
                while True: # Funny fucking=)
                    x_src = random.randint(0, screen_width)
                    y_src = random.randint(0, screen_height)
                    width = random.randint(100, screen_width)
                    height = random.randint(100, screen_height)
                    x_dst = random.randint(0, screen_width)
                    y_dst = random.randint(0, screen_height)
                    bitblt(hdc_src, x_dst, y_dst, width, height, hdc_src, x_src, y_src, SRCCOPY | CAPTUREBLT)
                    time.sleep(sleep_time)
            finally:
                user32.ReleaseDC(0, hdc_src)
        @staticmethod
        def Tunnel(sleep_time=1):
            user32 = ctypes.windll.user32
            gdi32 = ctypes.windll.gdi32
            desktop = user32.GetDesktopWindow()
            hdc = user32.GetWindowDC(desktop)
            class POINT(ctypes.Structure):
                _fields_ = [("x", ctypes.c_long), ("y", ctypes.c_long)]
            while True: # Funny fucking=)
                width = user32.GetSystemMetrics(1)
                height = user32.GetSystemMetrics(0)
                point = POINT()
                user32.GetCursorPos(ctypes.byref(point))
                user32.DrawIcon(hdc, point.x - 5, point.y - 5, user32.LoadIconW(None, 32513))
                randx = random.randint(0, width)
                randy = random.randint(0, height)
                desktop_dc = user32.GetDC(None)
                gdi32.BitBlt(desktop_dc, random.randint(0, width), random.randint(0, height), randx + 200, randy + 200, desktop_dc, randx, randy, 0x00CC0020)
                user32.ReleaseDC(None, desktop_dc)
                a = user32.GetSystemMetrics(1)
                b = user32.GetSystemMetrics(0)
                gdi32.StretchBlt(user32.GetDC(None), 50, 50, a - 100, b - 100, user32.GetDC(None), 0, 0, a, b, 0x00CC0020)
                time.sleep(sleep_time)
        @staticmethod
        def GrayMirror():
            user32 = ctypes.windll.user32
            gdi32 = ctypes.windll.gdi32
            screen_width = user32.GetSystemMetrics(0)
            screen_height = user32.GetSystemMetrics(1)
            desktop_dc = user32.GetDC(0)
            mem_dc = gdi32.CreateCompatibleDC(desktop_dc)
            bitmap = gdi32.CreateCompatibleBitmap(desktop_dc, screen_width, screen_height)
            gdi32.SelectObject(mem_dc, bitmap)
            gdi32.BitBlt(mem_dc, 0, 0, screen_width, screen_height, desktop_dc, 0, 0, 0x00CC0020)
            buffer_size = screen_width * screen_height * 4
            buffer = ctypes.create_string_buffer(buffer_size)
            gdi32.GetBitmapBits(bitmap, buffer_size, buffer)
            for i in range(screen_width * screen_height):
                b, g, r, _ = buffer[i * 4:i * 4 + 4]
                gray = int(0.3 * r + 0.59 * g + 0.11 * b)
                buffer[i * 4:i * 4 + 3] = bytes((gray, gray, gray))
            gdi32.SetBitmapBits(bitmap, buffer_size, buffer)
            gdi32.BitBlt(desktop_dc, 0, 0, screen_width, screen_height, mem_dc, 0, 0, 0x00CC0020) # Funny fucking=)
            gdi32.DeleteObject(bitmap)
            gdi32.DeleteDC(mem_dc)
            user32.ReleaseDC(0, desktop_dc)
    class window:
        @staticmethod
        def ShakeFirst():
            user32 = ctypes.windll.user32
            user32.GetWindowRect.restype = ctypes.c_bool
            user32.MoveWindow.restype = ctypes.c_bool
            hwnd = user32.GetForegroundWindow()
            class RECT(ctypes.Structure):
                _fields_ = [("left", ctypes.c_long),
                            ("top", ctypes.c_long),
                            ("right", ctypes.c_long),
                            ("bottom", ctypes.c_long)]
            while True: # Funny fucking=)
                current_hwnd = user32.GetForegroundWindow()
                if current_hwnd != hwnd: # If first window isn't original window.
                    hwnd = current_hwnd
                rect = RECT()
                user32.GetWindowRect(hwnd, ctypes.byref(rect))
                shake_amount = random.randint(10, 50)
                user32.MoveWindow(hwnd, rect.left, rect.top + shake_amount, rect.right - rect.left, rect.bottom - rect.top, True)
                time.sleep(0.1)
                user32.MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, True)
                time.sleep(0.1)
        @staticmethod
        def MinimizeAll():
            keybd_event = ctypes.windll.user32.keybd_event
            VK_LWIN = 0x5B
            VK_M = 0x4D
            KEYEVENTF_KEYUP = 0x2
            keybd_event(VK_LWIN, 0, 0, 0)
            keybd_event(VK_M, 0, 0, 0)
            keybd_event(VK_M, 0, KEYEVENTF_KEYUP, 0)
            keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0) # Funny fucking=)
if __name__ == "__main__":
    # 自定义图标列表
    my_icon_ids = [
        win32con.IDI_ERROR,  # 错误图标
        win32con.IDI_QUESTION,  # 问题图标
        win32con.IDI_INFORMATION,  # 信息图标
        win32con.IDI_WARNING
    ]

    #SupyCool.cursor.DrawIcon(my_icon_ids) # 鼠标画图,不选则是单个默认图标,可以由列表参数自定义需要展示的图标和顺序
    #SupyCool.cursor.Jitter(2) # 鼠标跳动,参数默认是2,为鼠标跳动的范围,越大越难控制
    #SupyCool.screen.InvertColor(1) # 屏幕反色,参数是反色的间隔(秒为单位),不要调成0,不然你眼睛就废了
    #SupyCool.screen.ChaosBlock() # 屏幕变成多个大小不一的矩形后旋转并随机变换位置
    #SupyCool.screen.Tunnel() # 屏幕隧道
    #SupyCool.screen.GrayMirror() # 屏幕灰色滤镜,不是很好请见谅
    #SupyCool.window.ShakeFirst() # 上下摇晃第一个窗口,对于任务管理器等窗口可能无效,如果第一个窗口变了,摇动的对象也会变
    #SupyCool.window.MinimizeAll() # 最小化所有窗口

有新特效(必须无害)的代码,可以私聊提供,bug反馈同上。做得不好勿喷

免费评分

参与人数 2吾爱币 +9 热心值 +2 收起 理由
hrh123 + 2 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

66fox66 发表于 2023-7-27 07:11
想看看效果展示图。嘻嘻嘻
清江堤畔 发表于 2023-7-27 10:17
无法从源解析导入“win32con”
无法从源解析导入“win32gui”
无法从源解析导入“win32api”
ljzbox 发表于 2023-7-27 07:10
梁茵 发表于 2023-7-27 08:05
我以为有成品的,楼主放个效果看看也可以嘛
头像被屏蔽
mokson 发表于 2023-7-27 08:18
提示: 作者被禁止或删除 内容自动屏蔽
lzd1168 发表于 2023-7-27 08:44
这个是什马东西
kll545012 发表于 2023-7-27 08:46

python,脚本语言,上面的代码就是成品了~~自己复制运行一下就行
Wapj_Wolf 发表于 2023-7-27 08:52
9494,,楼主贴几张效果图三。
java420 发表于 2023-7-27 09:08
给个效果图看看啊
k448161413 发表于 2023-7-27 09:37
看看是什么?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 22:23

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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