Jump to content

Block wins with a password


ludocus
 Share

Recommended Posts

Hi everybody..

It's been a long time since I posted here :D

This is very simple but effective..

When you try to open a window that's blocked, the window will hide and you will be prompted to enter a password..

If it's correct the window shows again, else it closes..

Check it out:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Ludocus

 Script Function:
    Block windows with a password

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Opt("WinTitleMatchMode", 1) ; = 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
$nopasstime = 60000         ; = 1 minute (1000*60=60000)
$num = 5                    ; = number of titles
$setpass = 'somepassword'   ; = password for blocked window
global $titles[$num+1] = ['Notepad', 'Calculator', 'Minesweeper', 'Windows Live Messenger', 'My documents']
While 1
    sleep(200)
    $titlez = WinList()
    For $i = 1 to $titlez[0][0]
        For $p = 0 to ($num-1)
            if $titlez[$i][0] = $titles[$p] then
                if _Password($titlez[$i][0]) Then 
                    Sleep($nopasstime)
                Else
                    WinClose($titlez[$i][0])
                EndIf
                exitloop
            EndIf
        Next
    Next
WEnd

Func _Password($title)
    WinSetState($title, '', @SW_HIDE)
    $pass = InputBox('Forbidden!', 'Please enter your password', '', '*', 100, 100, -1, -1, 30)
    if $pass = $setpass then
        WinSetState($title, '', @SW_SHOW)
        return 1
    EndIf
    return 0
EndFunc
Link to comment
Share on other sites

you could use:

If ProcessExists('taskman.exe') Then ProcessClose('taskman.exe')

or you could edit the registry:

RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 1 )

(to enable taskmanager use: RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 0 )

Link to comment
Share on other sites

you could use:

If ProcessExists('taskman.exe') Then ProcessClose('taskman.exe')

or you could edit the registry:

RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 1 )

(to enable taskmanager use: RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 0 )

Don't post things that could end up in the wrong lazy hands.
Link to comment
Share on other sites

Nice script but still need major improvement to be more secure.

I did bypassed the security easily.

Run the script, open My Documents.

The script hide it and prompt for password.

Without entering the password, try to open My Documents again, and the script will not hide it and not bothering for password again.

AUTOIT[sup] I'm lovin' it![/sup]

Link to comment
Share on other sites

This would be better if it worked through processes and not window titles.

Yes, a much better idea. you could have it get the process of the window when setting the password and get the window of the process when the program is running, or something like that

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Run the script, open My Documents.

The script hide it and prompt for password.

Without entering the password, try to open My Documents again, and the script will not hide it and not bothering for password again.

That's because of this:

If $titlez[$i][0] = $titles[$p] Then
    If _Password($titlez[$i][0]) Then
        Sleep($nopasstime)
    Else
        WinClose($titlez[$i][0])
    EndIf
    ExitLoop
EndIf

It's sleeping till the password is entered.

Yes, a much better idea. you could have it get the process of the window when setting the password and get the window of the process when the program is running, or something like that

Well that would bugger up any multi-lingual support.
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...