Sign in to follow this  
Followers 0
Baz

screen keyboard

8 posts in this topic

Hi all.

I would like to create a gui that displays the 26 letters (a-z) as buttons so that a user could click on the buttons and as they do, store this information as a variable.

I have no problems creating the form, but need help with the code to record the buttons pushed and then store the buttons as a variable.

What I am trying to do is get around the use of the keyboard to prevent keystroke recorders from detecting a password as I would fill this gui with buttons to run other programs and provide the program with username and password.

Thanks

Baz

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think the way I would do it is to use GUIOnEventMode, and have an event for every key button pointing to the same function. In that function, you would read the @GUI_CTRLID that made the function be called, and get the corresponding text, and store that into a variable.

Example code:

#include <guiconstants.au3>

Opt ("GUIOnEventMode", 1)

$Buttons_GUI = GUICreate ("Buttons")
GUICtrlSetOnEvent (-1, "closeme")
$Button_a = GUICtrlCreateButton ("a", 1, 0, 20, 20)
GUICtrlSetOnEvent (-1, "ButtonPressed")
$Button_b = GUICtrlCreateButton ("b", 1, 25, 20, 20)
GUICtrlSetOnEvent (-1, "ButtonPressed")
$Button_c = GUICtrlCreateButton ("c", 1, 50, 20, 20)
GUICtrlSetOnEvent (-1, "ButtonPressed")
$Button_d = GUICtrlCreateButton ("d", 1, 75, 20, 20)
GUICtrlSetOnEvent (-1, "ButtonPressed")

GUISetState ()

While 1
    Sleep (100)
WEnd

Func ButtonPressed()
    MsgBox (0, "", GUICtrlRead (@GUI_CtrlId))
EndFunc

Func closeme()
    Exit
EndFunc
Edited by greenmachine

Share this post


Link to post
Share on other sites

I'm pretty sure that windows XP has a built in screen keyboard.


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

You can modify this if you want..

#include <GuiConstants.au3>


$keyboard = GuiCreate("Enter Labserver Name", 726, 362,(@DesktopWidth-726)/2, (@DesktopHeight-362)/2 ,  $WS_VISIBLE + $WS_POPUP)

GuiCtrlCreateLabel ("Input Server Name:", 40, 27, 99, 40)

$Input_1 = GuiCtrlCreateInput("", 140, 20, 140, 30)
GUICtrlSetFont (-1, 14)
$Button_go = GuiCtrlCreateButton("Go", 300, 20, 60, 30)

$Button_1 = GuiCtrlCreateButton("1", 30, 70, 40, 40)
$Button_2 = GuiCtrlCreateButton("2", 90,70, 40, 40)
$Button_3 = GuiCtrlCreateButton("3", 150,70, 40, 40)
$Button_4 = GuiCtrlCreateButton("4", 210,70, 40, 40)
$Button_5 = GuiCtrlCreateButton("5", 270,70, 40, 40)
$Button_6 = GuiCtrlCreateButton("6", 330,70, 40, 40)
$Button_7 = GuiCtrlCreateButton("7", 390,70, 40, 40)
$Button_8 = GuiCtrlCreateButton("8", 450,70, 40, 40)
$Button_9 = GuiCtrlCreateButton("9", 510,70, 40, 40)
$Button_0 = GuiCtrlCreateButton("0", 570,70, 40, 40)

$Button_q = GuiCtrlCreateButton("Q", 50, 130, 40, 40)
$Button_w = GuiCtrlCreateButton("W", 110, 130, 40, 40)
$Button_e = GuiCtrlCreateButton("E", 170, 130, 40, 40)
$Button_r = GuiCtrlCreateButton("R", 230, 130, 40, 40)
$Button_t = GuiCtrlCreateButton("T", 290, 130, 40, 40)
$Button_y = GuiCtrlCreateButton("Y", 350, 130, 40, 40)
$Button_u = GuiCtrlCreateButton("U", 410, 130, 40, 40)
$Button_i = GuiCtrlCreateButton("I", 470, 130, 40, 40)
$Button_o = GuiCtrlCreateButton("O", 530, 130, 40, 40)
$Button_p = GuiCtrlCreateButton("P", 590, 130, 40, 40)

$Button_a = GuiCtrlCreateButton("A", 70,  190, 40, 40)
$Button_s = GuiCtrlCreateButton("S", 130, 190, 40, 40)
$Button_d = GuiCtrlCreateButton("D", 190, 190, 40, 40)
$Button_f = GuiCtrlCreateButton("F", 250, 190, 40, 40)
$Button_g = GuiCtrlCreateButton("G", 310, 190, 40, 40)
$Button_h = GuiCtrlCreateButton("H", 370, 190, 40, 40)
$Button_j = GuiCtrlCreateButton("J", 430, 190, 40, 40)
$Button_k = GuiCtrlCreateButton("K", 490, 190, 40, 40)
$Button_l = GuiCtrlCreateButton("L", 550, 190, 40, 40)

$Button_z = GuiCtrlCreateButton("Z", 100, 250, 40, 40)
$Button_x = GuiCtrlCreateButton("X", 160, 250, 40, 40)
$Button_c = GuiCtrlCreateButton("C", 220, 250, 40, 40)
$Button_v = GuiCtrlCreateButton("V", 280, 250, 40, 40)
$Button_b = GuiCtrlCreateButton("B", 340, 250, 40, 40)
$Button_n = GuiCtrlCreateButton("N", 400, 250, 40, 40)
$Button_m = GuiCtrlCreateButton("M", 460, 250, 40, 40)

GuiCtrlCreateLabel ("Special Chrs", 120, 320, 70, 40)
$Button_underscore = GuiCtrlCreateButton("_", 190, 310, 40, 40)
$Button_minus = GuiCtrlCreateButton("-", 250, 310, 40, 40)
$Button_stop = GuiCtrlCreateButton(".", 310, 310, 40, 40)

$Button_del = GuiCtrlCreateButton("Delete", 540, 20, 90, 40)

GuiSetState()
WinsetonTop ($Keyboard, "",1)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        pressed ("1")
    Case $msg = $Button_2
        pressed ("2")
    Case $msg = $Button_3
        pressed ("3")
    Case $msg = $Button_4
        pressed ("4")
    Case $msg = $Button_5
        pressed ("5")
    Case $msg = $Button_6
        pressed ("6")
    Case $msg = $Button_7
        pressed ("7")
    Case $msg = $Button_8
        pressed ("8")
    Case $msg = $Button_9
        pressed ("9")
    Case $msg = $Button_0
        pressed ("0")
    Case $msg = $Button_q
        pressed ("Q")
    Case $msg = $Button_w
        pressed ("W")
    Case $msg = $Button_e
        pressed ("E")
    Case $msg = $Button_r
        pressed ("R")
    Case $msg = $Button_t
        pressed ("T")
    Case $msg = $Button_y
        pressed ("Y")
    Case $msg = $Button_u
        pressed ("U")
    Case $msg = $Button_i
        pressed ("I")
    Case $msg = $Button_o
        pressed ("O")
    Case $msg = $Button_p
        pressed ("P")
    Case $msg = $Button_a
        pressed ("A")
    Case $msg = $Button_s
        pressed ("S")
    Case $msg = $Button_d
        pressed ("D")
    Case $msg = $Button_f
        pressed ("F")
    Case $msg = $Button_g
        pressed ("G")
    Case $msg = $Button_h
        pressed ("H")
    Case $msg = $Button_j
        pressed ("J")
    Case $msg = $Button_k
        pressed ("K")
    Case $msg = $Button_l
        pressed ("L")
    Case $msg = $Button_z
        pressed ("Z")
    Case $msg = $Button_x
        pressed ("X")
    Case $msg = $Button_c
        pressed ("C")
    Case $msg = $Button_v
        pressed ("V")
    Case $msg = $Button_b
        pressed ("B")
    Case $msg = $Button_n
        pressed ("N")
    Case $msg = $Button_m
        pressed ("M")
    Case $msg = $Button_underscore
        pressed ("_")
    Case $msg = $Button_minus
        pressed ("-")
    Case $msg = $Button_stop
        pressed (".")
    Case $msg = $Button_del
        $String = GuictrlRead ($Input_1)
        $String = Stringtrimright ($String,1)
        GuiCtrlSetData ($Input_1, $String)
    Case $msg = $Button_go
        GuiSetState (@SW_DISABLE, $keyboard)
        $String = GuictrlRead ($Input_1)
        $answer = MsgBox (262148,"You have entered", $String & " is this correct?")
        If $Answer = 6 then 
            GuiSetState (@SW_Enable, $keyboard)
            GuiDelete ($keyboard)
            ExitLoop
        Else
            
            GuiSetState (@SW_Enable, $keyboard)
            Endif
        
        
    Case Else
    ;;;
    EndSelect
WEnd


Func Pressed ($Key)
    $String = GuictrlRead ($Input_1)
    $String = $String & $Key
    GuiCtrlSetData ($Input_1, $String)
EndFunc

Share this post


Link to post
Share on other sites

I'm pretty sure that windows XP has a built in screen keyboard.

Yes, but the output of that keyboard can be trapped by software.

The OP is attempting "to prevent keystroke recorders from detecting a password".


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks to all those who repiled. Below is a copy of what I am using. I have also tested with four key loggers and none pickup user name or password. The only issue is that if the exe file is on a networked dirve, then the @windowsdir and @systemdir don't seem to work.

Cheers

Baz

#include <GUIConstants.au3>

; == GUI generated with Koda ==

Opt ("GUIOnEventMode", 1)

Dim $pw

Dim $word

Dim $blank

$blank="#"

$HelpDeskTools = GUICreate("HelpDeskTools", 439, 376)

$Tab1 = GUICtrlCreateTab(8, 8, 425, 201)

$TabSheet1 = GUICtrlCreateTabItem("Registry")

$Button1 = GUICtrlCreateButton("Regedit", 24, 40, 121, 33, 0)

GUICtrlSetOnEvent (-1, "regme")

$TabSheet2 = GUICtrlCreateTabItem("File Shares")

$Button2 = GUICtrlCreateButton("Explore ZEN Images", 24, 40, 121, 33, 0)

GUICtrlSetOnEvent (-1, "zenimg")

$Button30 = GUICtrlCreateButton("Explore ZEN APPS", 24, 80, 121, 33, 0)

GUICtrlSetOnEvent (-1, "zenapps")

$Button31 = GUICtrlCreateButton("J Drive Site1", 24, 120, 121, 33, 0)

GUICtrlSetOnEvent (-1, "pjdrv")

$Button32 = GUICtrlCreateButton("J Drive Site 2", 24, 160, 121, 33, 0)

GUICtrlSetOnEvent (-1, "cjdrv")

$TabSheet3 = GUICtrlCreateTabItem("Windows")

GUICtrlSetState(-1,$GUI_SHOW)

$Button33 = GUICtrlCreateButton("Add/Remove Software", 24, 40, 121, 33, 0)

GUICtrlSetOnEvent (-1, "AddRem")

$Button34 = GUICtrlCreateButton("Computer Management", 24, 80, 121, 33, 0)

GUICtrlSetOnEvent (-1, "ComMang")

$Button35 = GUICtrlCreateButton("Defrag C Drive", 24, 120, 121, 33, 0)

GUICtrlSetOnEvent (-1, "DFrag")

$Button36 = GUICtrlCreateButton("Manage Local Users", 24, 160, 121, 33, 0)

GUICtrlSetOnEvent (-1, "MLU")

$Button37 = GUICtrlCreateButton("Windows Services", 160, 40, 121, 33, 0)

GUICtrlSetOnEvent (-1, "Service")

$Button38 = GUICtrlCreateButton("Task Manager", 160, 80, 121, 33, 0)

GUICtrlSetOnEvent (-1, "TaskMGR")

GUICtrlCreateTabItem("")

$Group1 = GUICtrlCreateGroup("", 8, 216, 425, 81)

$Button4 = GUICtrlCreateButton("a", 16, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button5 = GUICtrlCreateButton("b", 48, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button6 = GUICtrlCreateButton("c", 80, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button7 = GUICtrlCreateButton("d", 112, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button8 = GUICtrlCreateButton("e", 144, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button9 = GUICtrlCreateButton("f", 176, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button10 = GUICtrlCreateButton("g", 208, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button11 = GUICtrlCreateButton("h", 240, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button12 = GUICtrlCreateButton("i", 272, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button13 = GUICtrlCreateButton("j", 304, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button14 = GUICtrlCreateButton("k", 336, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button15 = GUICtrlCreateButton("l", 368, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button16 = GUICtrlCreateButton("m", 400, 232, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button17 = GUICtrlCreateButton("n", 16, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button18 = GUICtrlCreateButton("o", 48, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button19 = GUICtrlCreateButton("p", 80, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button20 = GUICtrlCreateButton("q", 112, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button21 = GUICtrlCreateButton("r", 144, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button22 = GUICtrlCreateButton("s", 176, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button23 = GUICtrlCreateButton("t", 208, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button24 = GUICtrlCreateButton("u", 240, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button25 = GUICtrlCreateButton("v", 272, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button26 = GUICtrlCreateButton("w", 304, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button27 = GUICtrlCreateButton("x", 336, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button28 = GUICtrlCreateButton("y", 368, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button29 = GUICtrlCreateButton("z", 400, 264, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button41 = GUICtrlCreateButton("0", 16, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button42 = GUICtrlCreateButton("1", 48, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button43 = GUICtrlCreateButton("2", 80, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button44 = GUICtrlCreateButton("3", 112, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button45 = GUICtrlCreateButton("4", 144, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button46 = GUICtrlCreateButton("5", 176, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button47 = GUICtrlCreateButton("6", 208, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button48 = GUICtrlCreateButton("7", 240, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button49 = GUICtrlCreateButton("8", 272, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button50 = GUICtrlCreateButton("9", 304, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button51 = GUICtrlCreateButton("#", 336, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

$Button52 = GUICtrlCreateButton("*", 368, 296, 25, 25, 0)

GUICtrlSetOnEvent (-1, "ButtonPressed")

GUICtrlCreateGroup("", -99, -99, 1, 1)

$MaskEdit1 = GUICtrlCreateInput("", 320, 334, 113, 33, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$Button3 = GUICtrlCreateButton("Exit", 200, 334, 97, 33, 0)

GUICtrlSetOnEvent (-1, "Close")

$Button39 = GUICtrlCreateButton("Restart", 104, 334, 81, 33, 0)

GUICtrlSetOnEvent (-1, "ClrPW")

;$Button40 = GUICtrlCreateButton("Enter", 8, 336, 81, 33, 0)

;GUICtrlSetOnEvent (-1, "Enter")

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;;;;;

EndSelect

WEnd

Func ButtonPressed()

$MaskEdit1 = GUICtrlCreateInput($blank, 320, 334, 113, 33, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

$pw=$pw & GUICtrlRead (@GUI_CtrlId)

$blank=$blank & "#"

EndFunc

Func Close()

Exit

EndFunc

#cs

Func Enter()

MsgBox (0,"Your Password is: ", $pw)

$word=$pw

EndFunc

#ce

Func ClrPW()

$MaskEdit1 = GUICtrlCreateInput("", 320, 334, 113, 33)

$pw=""

$blank="#"

EndFunc

Func TaskMGR()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\Taskmgr.exe")

RunAsSet()

EndFunc

Func Service()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\mmc.exe " & @WindowsDir & "\system32\services.msc")

RunAsSet()

EndFunc

Func AddRem()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\control.exe " & @WindowsDir & "\system32\appwiz.cpl")

RunAsSet()

EndFunc

Func ComMang()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\mmc.exe " & @WindowsDir & "\system32\compmgmt.msc")

RunAsSet()

EndFunc

Func DFrag()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\mmc.exe " & @WindowsDir & "\system32\dfrg.msc")

RunAsSet()

EndFunc

Func MLU()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\system32\mmc.exe " & @WindowsDir & "\system32\lusrmgr.msc")

RunAsSet()

EndFunc

Func regme()

If $pw=""Then Exit

RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\regedit.exe")

RunAsSet()

EndFunc

Func zenimg()

If $pw=""Then Exit

;RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\explorer.exe /e, \\zensvr\zen\images")

;RunAsSet()

EndFunc

Func zenapps()

If $pw=""Then Exit

;RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\explorer.exe /e, \\zensvr\zen\zfd")

;RunAsSet()

EndFunc

Func pjdrv()

If $pw=""Then Exit

;RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\explorer.exe /e, \\site1\data\course_data")

;RunAsSet()

EndFunc

Func cjdrv()

If $pw=""Then Exit

;RunAsSet("Administrator", @Computername, $pw)

RunWait(@WindowsDir & "\explorer.exe /e, \\site2\data\course_data")

;RunAsSet()

EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0