コード例 #1
0
ファイル: human.py プロジェクト: superponible/cuckoo-modified
def get_office_window(hwnd, lparam):
    if USER32.IsWindowVisible(hwnd):
        text = create_unicode_buffer(1024)
        USER32.GetWindowTextW(hwnd, text, 1024)
        if "- Microsoft" in text:
            # send ALT+F4 equivalent
            USER32.SendMessageW(hwnd, WM_CLOSE, None, None)
    return True
コード例 #2
0
ファイル: human.py プロジェクト: obert01/cuckoo
def get_office_window(hwnd, lparam):
    if USER32.IsWindowVisible(hwnd):
        text = create_unicode_buffer(1024)
        USER32.GetWindowTextW(hwnd, text, 1024)
        # TODO Would " - Microsoft (Word|Excel|PowerPoint)$" be better?
        if re.search("- (Microsoft|Word|Excel|PowerPoint)", text.value):
            USER32.SendNotifyMessageW(hwnd, WM_CLOSE, None, None)
            log.info("Closed Office window.")
    return True
コード例 #3
0
ファイル: human.py プロジェクト: Cyber2020/nrl-cuckoo
def get_office_window(hwnd, lparam):
    global CLOSED_OFFICE
    if USER32.IsWindowVisible(hwnd):
        text = create_unicode_buffer(1024)
        USER32.GetWindowTextW(hwnd, text, 1024)
        if "- Microsoft" in text.value or "- Word" in text.value or "- Excel" in text.value or "- PowerPoint" in text.value:
            # send ALT+F4 equivalent
            log.info("Closing Office window.")
            USER32.SendNotifyMessageW(hwnd, WM_CLOSE, None, None)
            CLOSED_OFFICE = True
    return True
コード例 #4
0
ファイル: human.py プロジェクト: kevoreilly/CAPEv2
def get_office_window_click_around(hwnd, lparm):
    global OFFICE_CLICK_AROUND
    if USER32.IsWindowVisible(hwnd):
        text = create_unicode_buffer(1024)
        USER32.GetWindowTextW(hwnd, text, 1024)
        if any(value in text.value
               for value in ("Microsoft Word", "Microsoft Excel",
                             "Microsoft PowerPoint")):
            USER32.SetForegroundWindow(hwnd)
            # first click the middle
            USER32.SetCursorPos(RESOLUTION["x"] // 2, RESOLUTION["y"] // 2)
            click_mouse()
            KERNEL32.Sleep(50)
            click_mouse()
            KERNEL32.Sleep(500)
            # click through the middle with offset for cell position on side and scroll bar
            x = 80
            while x < RESOLUTION["x"] - 40:
                # make sure the window still exists
                if USER32.IsWindowVisible(hwnd):
                    USER32.SetForegroundWindow(hwnd)
                    USER32.SetCursorPos(x, RESOLUTION["y"] // 2)
                    click_mouse()
                    KERNEL32.Sleep(50)
                    click_mouse()
                    KERNEL32.Sleep(50)
                    if not USER32.IsWindowVisible(hwnd):
                        break
                    USER32.SetForegroundWindow(hwnd)
                    USER32.SetCursorPos(
                        x, RESOLUTION["y"] // 2 + random.randint(80, 200))
                    click_mouse()
                    KERNEL32.Sleep(50)
                    click_mouse()
                    KERNEL32.Sleep(50)
                    if not USER32.IsWindowVisible(hwnd):
                        break
                    USER32.SetForegroundWindow(hwnd)
                    USER32.SetCursorPos(
                        x, RESOLUTION["y"] // 2 - random.randint(80, 200))
                    click_mouse()
                    KERNEL32.Sleep(50)
                    click_mouse()
                    KERNEL32.Sleep(50)
                    x += random.randint(150, 200)
                    KERNEL32.Sleep(50)
                else:
                    log.info(
                        "Breaking out of office click loop as our window went away"
                    )
                    break
            KERNEL32.Sleep(20000)
            OFFICE_CLICK_AROUND = True
    return True
コード例 #5
0
ファイル: human.py プロジェクト: SNDBOXLTD/cuckoo_home
def get_window_text(hwnd):
    text = create_unicode_buffer(1024)
    USER32.GetWindowTextW(hwnd, text, 1024)
    return text.value