Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
How to click controls
How to use mouse and keyboard commands to input to a tool under test’s GUI:
Step-by-step guide
Examine the tool using Resource Hacker, or equivalent, to examine the structure that defines the different controls. Note the red * that appears beside the entry for Hide Password since I have selected the control in the representation of the GUI.
Things needed in your code:
from tyutils.window_and_controls_util import setup_wincon
…
workingdir = 'C:\\Users\\tester\\Desktop'
rarname = 'test.rar'
tool_app_title = 'Goldie Small'
StartButNum = 1 # This is the first occurrence of type BUTTON in the structure (not the ‘1’ in the structure)
StartButTyp = 'Button' # Type BUTTON – case is not important
ExitButNum = 2 # This is the second occurrence of type BUTTON (not the ‘2’ in the structure)
ExitButTyp = 'Button'
FileButNum = 2 # This is the second occurrence of type EDIT (5th entry)
FileButTyp = 'Edit'
PassButNum = 3 # This is the third occurrence of type BUTTON (7th entry)
PassButTyp = 'Edit'
HideButNum = 4 # This is the fourth occurrence of type BUTTON (the entry with the red *)
HideButTyp = 'Button'
PassWd = 'passwd'
…
def run(self):
…
target = host.createEmissary()
if not target.path_exists(workingdir):
return self.FAILURE, 'target.path_exists failure'
# Setting up Windows and Controls
Rwincon,Rsend = setup_wincon(target)
… start execution of tool under test
# Find tool
proc_hwnd = Rwincon.getWindowByAppxTitle(tool_app_title)
if proc_hwnd == 0:
return self.FAILURE, "Can't find window by title: "+tool_app_title
# Entering Fields
Rsend.controlClick(proc_hwnd, PassButTyp, PassButNum, 2) # double click Password
Rsend.Send(PassWd) # Write to password control
Rsend.controlClick(proc_hwnd, HideButTyp, HideButNum, 1) # click Hide Passwd
Rsend.controlClick(proc_hwnd, FileButTyp, FileButNum, 2) # double click Filename
Rsend.Send(rarname) # Write to filename control
Rsend.controlClick(proc_hwnd, StartButTyp, StartButNum, 1) # Click start
Related articles
('contentbylabel' missing)
('details' missing)