コード例 #1
0
def foreach_window(hwnd, lparam):
    # If the window is visible, enumerate its child objects, looking
    # for buttons.

    if USER32.IsWindowVisible(hwnd):
        classname = create_unicode_buffer(50)
        USER32.GetClassNameW(hwnd, classname, 50)

        # If the window is one of the known class types that are inaccessible by User32, send Enter
        # This may proceed if there is a default action
        for win in default_action_win:
            if win in classname.value.lower():
                log.info(
                    "Found inaccessible window of class %s. Sending Enter" %
                    classname.value.lower())
                USER32.SetActiveWindow(hwnd)
                USER32.SetForegroundWindow(hwnd)
                type_keyboard(0x09, 0x8F)
                type_keyboard(0x0D, 0x9C)

        USER32.EnumChildWindows(hwnd, EnumChildProc(foreach_child), 0)

#Turning off the ability of pressing objects in PDF, URL is good enough
#try:
#Get PID of current window
#	win_pid = c_ulong(0)
#	USER32.GetWindowThreadProcessId(hwnd,byref(win_pid))

#Get application name from PID
#	procname = psutil.Process(win_pid.value)
#	applicname = procname.name()

#	tabVal = get_tab_val(win_pid.value)

#If this is PDF
#	if "AcroRd" in applicname:
#		log.info("App Name %s",applicname)
#		log.info("TabValue: %s",str(tabVal))
#		USER32.SetActiveWindow(hwnd)
#	        USER32.SetForegroundWindow(hwnd)
#		log.info("Sending Tab and Enter")
#We are sending Tab different number of times
# to cover different URLs
#for y in range(0,tabVal):
#	#Sending Tab
#	type_keyboard(0x09,0x0F)
#	time.sleep(0.1)
#Sending Enter
#type_keyboard(0x0D,0x1C)
#time.sleep(10)
#update_tab_val(win_pid.value)

#except:
#	log.info("Raised exception")
#	e = sys.exc_info()[0]
#       log.info(str(e))
#        e1 = sys.exc_info()[1]
#        log.info(str(e1))

    return True
コード例 #2
0
ファイル: human.py プロジェクト: Cyber2020/nrl-cuckoo
def foreach_window(hwnd, lparam):
    # If the window is visible, enumerate its child objects, looking
    # for buttons.
    if USER32.IsWindowVisible(hwnd):
        # we also want to inspect the "parent" windows, not just the children
        foreach_child(hwnd, lparam)
        USER32.EnumChildWindows(hwnd, EnumChildProc(foreach_child), 0)
    return True
コード例 #3
0
ファイル: human.py プロジェクト: SNDBOXLTD/cuckoo_home
def foreach_window(hwnd, lparam):
    '''Callback procedure invoked for every enumerated window. 
    '''

    # If the window is visible, enumerate its child objects, looking
    # for buttons.
    if USER32.IsWindowVisible(hwnd):
        USER32.EnumChildWindows(hwnd, EnumChildProc(foreach_child), 0)
    return True
コード例 #4
0
def foreach_window(hwnd, lparam):
    # If the window is visible, enumerate its child objects, looking
    # for buttons.
    if USER32.IsWindowVisible(hwnd):
        USER32.EnumChildWindows(hwnd, EnumChildProc(foreach_child), 0)
    return True