Jump to content

Autoit WindowInfo can't see Kaspersky Endpoint Security 10 Window


Recommended Posts

Wow, people need to stop posting the UIAutomation, assuming it works...it does NOT on this application

The title you can go off of:

Kaspersky Endpoint Security 10 for Windows

OR, you can use the windows class;

AVP.MainWindow

Once you have the window, there are no controls that you can grab except for one button, so you'll have to use relative x/y coords to automate anything (or pixel|Image searches...this is the 1 time out of 1000 where pixel|image searching questions is a valid, non gaming, question)

$hWin = WinGetHandle("[CLASS:AVP.MainWindow]")
WinGetAllControls($hWin)
Func WinGetAllControls($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Set the array and its size to be returned
    Local $aControls[UBound($aClassList)][8]

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $sText = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        $aControls[$i][0] = $sControlID
        $aControls[$i][1] = $hControl
        $aControls[$i][2] = $iCurrentClass & $iCurrentCount
        $aControls[$i][7] = $sText
        If IsArray($aPos) Then
            $aControls[$i][3] = $aPos[0]
            $aControls[$i][4] = $aPos[1]
            $aControls[$i][5] = $aPos[2]
            $aControls[$i][6] = $aPos[3]
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $sText & "]." & @CRLF)
        Else
            $aControls[$i][3] = "winclosed"
            $aControls[$i][4] = "winclosed"
            $aControls[$i][5] = "winclosed"
            $aControls[$i][6] = "winclosed"
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $sText & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

    If IsArray($aControls) Then
        Return $aControls
    Else
        Return -1
    EndIf
EndFunc

excuse me, there are 2 controls:

Func=[Var_GetAllWindowsControls]: ControlCounter=[  1] ControlID=[56171] Handle=[0x00371A5E] ClassNN=[        AVP.Button1] XPos=[ 232] YPos=[ 175] Width=[ 106] Height=[  23] Text=[Application Monitor].
Func=[Var_GetAllWindowsControls]: ControlCounter=[  2] ControlID=[ 9518] Handle=[0x007C06B6] ClassNN=[          AVP.List1] XPos=[  32] YPos=[ 475] Width=[ 673] Height=[ 151] Text=[].
 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

@JDelaney: Whats wrong with IUIAutomation. I just tried on kaspersky antivirus  2014 and 95% of the controls I can recognize with the simple spy

I unfortunately do not have the endpoint security product but would be surprised if endpoint security uses different controls compared to their antivirus produkt (but could be an additional measure for preventing automation)

But for those applications really resisting stuff you could try to integrate http://www.nektra.com/products/deviare-api-hook-windows/

To create a similar result to see if IUIAutomation can help on this application

#include "UIAWrappers.au3"

;~  Overrule some defaults
_UIA_setVar("Global.Debug",True)  ;~ If set false you will not get any output
_UIA_setVar("Global.Debug.File",false) ;~ If set false you get detailed log to scitewindow, if true you get a log.txt

$cMainWindow="class:=AVP.MainWindow"   ;~ "class:=CalcFrame"                  ;~ For calculator window this would be "class:=CalcFrame"

;enum TreeScope
;~ Global Const $TreeScope_Element=1
;~ Global Const $TreeScope_Children=2
;~ Global Const $TreeScope_Descendants=4
;~ Global Const $TreeScope_Parent=8
;~ Global Const $TreeScope_Ancestors=16
;~ Global Const $TreeScope_Subtree=7

_UIA_Dumpthemall($UIA_odesktop,$TreeScope_Children)

$mainWindow=_UIA_getFirstObjectOfElement($UIA_oDesktop,$cMainWindow, $treescope_children)
_UIA_Dumpthemall($mainWindow, $treescope_subtree)
Exit
Link to comment
Share on other sites

On 2010, I could only identify the two controls above, even with iuiautomation.

This is the window that you can open from your systray.

I'll try again, next week.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

And what about adding your exe file as trusted application in Kaspersky ? (I don't think it works, just because an antivirus product like Kaspersky is not a sieve).

Tekkion, can you explain what you are trying to automate ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...