Python截图比对,操作鼠标键盘(mhxysy实例)

风花雪月
• 阅读 379

import sys import win32gui from PyQt5.QtWidgets import QApplication import numpy import cv2 from pathlib import Path from ctypes import windll, byref from ctypes.wintypes import HWND, POINT import time

zjb = [] hld = win32gui.FindWindow(None, u"BlueStacks App Player") print('主窗口ID', hld) win32gui.EnumChildWindows(hld, lambda aa, bb: bb.append(aa), zjb) print('子窗口ID', zjb) print(zjb[1])

通过句柄获取窗口的左、上、右、下,位置

left, top, right, bottom = win32gui.GetWindowRect(zjb[1]) print(left, top, right, bottom)

----------------------------------------------------------后台鼠标键盘操作

PostMessageW = windll.user32.PostMessageW ClientToScreen = windll.user32.ClientToScreen WM_MOUSEMOVE = 0x0200 WM_LBUTTONDOWN = 0x0201 WM_LBUTTONUP = 0x202 WM_MOUSEWHEEL = 0x020A WHEEL_DELTA = 120

def move_to(handle: HWND, x: int, y: int): """移动鼠标到坐标(x, y)

Args:
    handle (HWND): 窗口句柄
    x (int): 横坐标
    y (int): 纵坐标
"""
# https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousemove
wparam = 0
lparam = y << 16 | x
PostMessageW(handle, WM_MOUSEMOVE, wparam, lparam)

def left_down(handle: HWND, x: int, y: int): """在坐标(x, y)按下鼠标左键

Args:
    handle (HWND): 窗口句柄
    x (int): 横坐标
    y (int): 纵坐标
"""
# https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-lbuttondown
wparam = 0
lparam = y << 16 | x
PostMessageW(int(handle), int(WM_LBUTTONDOWN), int(wparam), int(lparam))

def left_up(handle: HWND, x: int, y: int): """在坐标(x, y)放开鼠标左键

Args:
    handle (HWND): 窗口句柄
    x (int): 横坐标
    y (int): 纵坐标
"""
# https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-lbuttonup
wparam = 0
lparam = y << 16 | x
PostMessageW(int(handle), int(WM_LBUTTONUP), int(wparam), int(lparam))

-------------------------------------------区域找图,识别截图并返回坐标

class Image: def init(self, image): self.image = cv2.imread(image, cv2.IMREAD_UNCHANGED)

@property
def width(self):
    return self.image.shape[1]

@property
def height(self):
    return self.image.shape[0]

class MatchImg(object): def init(self, source, template, threshod=0.95): """ 匹配一个图片,是否是另一个图片的局部图。source是大图,template是小图。即判断小图是否是大图的一部分。 :param source: :param template: :param threshod: 匹配程度,值越大,匹配程度要求就越高,最好不要太小 """ self.source_img = source self.template_img = template self.threshod = threshod

def match_template(self, method=cv2.TM_CCOEFF_NORMED):
    """
    返回小图左上角的点,在大图中的坐标。
    :param method:
    :return: list[tuple(x,y),...]
    """
    try:
        result = cv2.matchTemplate(self.source_img.image, self.template_img.image, method)
        locations = numpy.where(result >= self.threshod)
        res = list(zip(locations[1], locations[0]))  # 返回的是匹配到的template左上角那个坐标点在image中的位置,可能有多个值
        return res
    except cv2.error as e:
        print(e)

def get_template_position(self):
    """
    获取小图在大图中,左上角和右下角的坐标
    :return: List[list[x,y,x,y],...]
    """
    res = self.match_template()
    new_pos = []
    for r in res:
        r = list(r)
        r.append(r[0]+self.template_img.width)
        r.append(r[1]+self.template_img.height)
        new_pos.append(r)
    return new_pos

def get_img_center(self):
    """
    获取大图中,每个小图中心点所在的坐标
    :return:
    """
    pos = self.match_template()
    points = []
    for p in pos:
        x, y = p[0]+int(self.template_img.width/2), p[1]+int(self.template_img.height/2)
        points.append((x, y))
    return points

def load_image_file(path): path = Path(path) if not path.exists(): print('not exist file') try: image = Image(str(path)) return image except cv2.error as e: print(e)

pyautogui.PAUSE = 1

im = pyautogui.screenshot() # 前台全屏截图

可把窗口遮挡截图并保存

#----------------------------------------------------以下为登录和角色选择------------------------------------------------

def jbdy(canshu): # 自定义类时,需要引号

app = QApplication(sys.argv) screen = QApplication.primaryScreen() xhcs = 0 while xhcs<4: for canshu in range(1, 7): # 此处1-7可以登陆6个账号重复循环 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\dl.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() if points==[]: ii = 0 while points==[]: # 如果返回的坐标为空,继续循环查找 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\dl.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() ii+=1 if ii>100: print('没有') exit() # exit()和quit()都是直接退出程序 # points1 = process.get_template_position() # print(points1) # 找到图的左上角和右下角的坐标 print(points, '登录') # 找到图的中心点坐标 print(points[0][0], points[0][1]) left_down(zjb[1], points[0][0], points[0][1]-40) # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(0.1) left_up(zjb[1], points[0][0], points[0][1]-40) # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(3) # 不知道为什么要减40,但是减去40就可以正确点击 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\fwq.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() if points==[]: ii = 0 while points==[]: # 如果返回的坐标为空,继续循环查找 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\fwq.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() ii+=1 if ii>100: print('没有') exit() # exit()和quit()都是直接退出程序 # points1 = process.get_template_position() # print(points1) # 找到图的左上角和右下角的坐标 print(points, '选择服务器') # 找到图的中心点坐标 print(points[0][0], points[0][1]) left_down(zjb[1], points[0][0], points[0][1]-40) # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(0.1) left_up(zjb[1], points[0][0], points[0][1]-40) # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(10) img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\js'+str(canshu)+'.bmp') # 路径字符中有变量的写法。6个角色的选择,给角色图片编上号 process = MatchImg(img1, img2, 0.9) points = process.get_img_center() if points==[]: ii = 0 while points==[]: # 如果返回的坐标为空,继续循环查找 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jt.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jt.bmp') img2 = load_image_file(r'D:\findpic\js'+str(canshu)+'1.bmp') # 路径字符中有变量的写法 process = MatchImg(img1, img2, 0.9) points = process.get_img_center() ii+=1 if ii>100: print('没有') exit() # exit()和quit()都是直接退出程序 # points1 = process.get_template_position() # print(points1) # 找到图的左上角和右下角的坐标 print(points, '选择角色') # 找到图的中心点坐标 print(points[0][0], points[0][1]) left_down(zjb[1], points[0][0], points[0][1]-40) # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(0.1) left_up(zjb[1], points[0][0], points[0][1]-40) # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标 time.sleep(6) #-------------------------------------------以上为登录和角色选择-------------------------------------------------------- #-----------------------------------------------以下为运镖任务--------------------------------------------- img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jietu.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jietu.bmp') img2 = load_image_file(r'D:\findpic\hd.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() if points==[]: ii = 0 while points==[]: # 如果返回的坐标为空,继续循环查找 img = screen.grabWindow(hld).toImage() img.save(r'D:\findpic\jietu.bmp') time.sleep(2) img1 = load_image_file(r'D:\findpic\jietu.bmp') img2 = load_image_file(r'D:\findpic\hd.bmp') process = MatchImg(img1, img2, 0.9) points = process.get_img_center() ii+=1 if ii>100: print('没有') exit() # exit()和quit()都是直接退出程序

    print(points, '点活动--运镖')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    print(points[0][0], points[0][1])
    left_down(zjb[1], points[0][0], points[0][1]-40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)   # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(3)
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(2)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\ybrw.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\ybrw.bmp')
            process = MatchImg(img1, img2, 0.90)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points)  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1, '点击运镖')  # 找到图的左上角和右下角的坐标
    #---------------------------------------------------------------------
    i=120
    j=35 # 不知道为什么坐标位置,始终有点差别
    print(points1[0][2])
    print(points1[0][3])
    left_down(zjb[1], points1[0][2]+i, points1[0][3]-j)  # 此处我们按下的点是:横坐标为返回右下角横坐标,纵坐标为返回右下角纵坐标-j
    time.sleep(0.1)
    left_up(zjb[1], points1[0][2]+i, points1[0][3]-j)   # 此处我们弹起的点是:横坐标为返回右下角横坐标,纵坐标为返回右下角纵坐标-j
    time.sleep(2)
    #----------------------------------------------------------------------
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\ybrw-1.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\ybrw-1.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '接收运镖任务')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1]-40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)   # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(3)
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\ybrw-2.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\ybrw-2.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '开始运镖')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1]-40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)   # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\mjxy-tc1.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points == []:
        ii = 0
        while points == []:  # 如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\mjxy-tc1.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii += 1
            print('重试' + str(ii))
            if ii > 100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '左上角点击打开隐藏按钮')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1] - 40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1] - 40)  # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(2)
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\mjxy-tc2.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points == []:
        ii = 0
        while points == []:  # 如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\mjxy-tc2.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii += 1
            print('重试' + str(ii))
            if ii > 100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '点击系统')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1] - 40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1] - 40)  # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(2)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\qhzh.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\qhzh.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '点击切换账号')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1]-40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)   # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(2)
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\dc.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\dc.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '点击登出')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1]-40)  # 此处我们按下的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)   # 此处我们弹起的点是:横坐标为返回中心横坐标+i,纵坐标为返回中心坐标的纵坐标
    time.sleep(10)
    img = screen.grabWindow(hld).toImage()
    img.save(r'D:\findpic\jietu.bmp')
    time.sleep(3)
    img1 = load_image_file(r'D:\findpic\jietu.bmp')
    img2 = load_image_file(r'D:\findpic\cxdl.bmp')
    process = MatchImg(img1, img2, 0.9)
    points = process.get_img_center()
    if points==[]:
        ii = 0
        while points==[]:  #  如果返回的坐标为空,继续循环查找
            img = screen.grabWindow(hld).toImage()
            img.save(r'D:\findpic\jietu.bmp')
            time.sleep(2)
            img1 = load_image_file(r'D:\findpic\jietu.bmp')
            img2 = load_image_file(r'D:\findpic\cxdl.bmp')
            process = MatchImg(img1, img2, 0.9)
            points = process.get_img_center()
            ii+=1
            print('重试' + str(ii))
            if ii>100:
                print('没有')
                exit()  # exit()和quit()都是直接退出程序
    print(points, '点击红色登录')  # 找到图的中心点坐标
    points1 = process.get_template_position()
    print(points1)  # 找到图的左上角和右下角的坐标
    left_down(zjb[1], points[0][0], points[0][1]-40)
    time.sleep(0.1)
    left_up(zjb[1], points[0][0], points[0][1]-40)
    time.sleep(50)
    #---------------------------------------------结束一个账号任务---------------------------------------------------
xhcs+=1
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
双十一预售活动分析
2022年双十一促销活动已经开始,大家应该都提前开始关注今年双十一活动的时间表了吧?2022年10月24日晚8:00天猫双11预售时间,第一波销售时间10月31日晚8:0,第二波销售时间11月10日晚8:00;天猫双11的优惠力度是跨店每满30050
Karen110 Karen110
2年前
​一篇文章总结一下Python库中关于时间的常见操作
前言本次来总结一下关于Python时间的相关操作,有一个有趣的问题。如果你的业务用不到时间相关的操作,你的业务基本上会一直用不到。但是如果你的业务一旦用到了时间操作,你就会发现,淦,到处都是时间操作。。。所以思来想去,还是总结一下吧,本次会采用类型注解方式。time包importtime时间戳从1970年1月1日00:00:00标准时区诞生到现在
Stella981 Stella981
2年前
Python Challenge Level 18
初学Python,挑战一下流行的PythonChallenge,很不幸,卡在了18关~~被字符字节码之间的转换搞得焦头烂额,不过终于搞定了还是很happy的~~~主要的问题就是16进制形式的字符如何转成字节码(注意:不是encoding)如:\'89','50','4e','47','0d','0a','1a','0a','00
Stella981 Stella981
2年前
Python3:sqlalchemy对mysql数据库操作,非sql语句
Python3:sqlalchemy对mysql数据库操作,非sql语句python3authorlizmdatetime2018020110:00:00coding:utf8'''
Stella981 Stella981
2年前
Scapy 从入门到放弃
0x00前言最近闲的没事,抽空了解下地表最强的嗅探和收发包的工具:scapy。scapy是一个python模块,使用简单,并且能灵活地构造各种数据包,是进行网络安全审计的好帮手。0x01安装因为2020年python官方便不再支持python2,所以使用python3安装。!(https://oscimg.oschina.net/os
Wesley13 Wesley13
2年前
FLV文件格式
1.        FLV文件对齐方式FLV文件以大端对齐方式存放多字节整型。如存放数字无符号16位的数字300(0x012C),那么在FLV文件中存放的顺序是:|0x01|0x2C|。如果是无符号32位数字300(0x0000012C),那么在FLV文件中的存放顺序是:|0x00|0x00|0x00|0x01|0x2C。2.  
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_