Jump to content

Process blocker


electrico
 Share

Recommended Posts

Such a kiddy script vs kids ;) Attention: cpu blocker.

Lame but it was fast to code. Awaits for unwanted process and lock workstation.

You can reconfigure it as startup for one or several processes, if u want.

#include <file.au3>
#include <EditConstants.au3>
Opt("GuiOnEventMode", 1)
Local $pass
Local $ini = FileExists(@CommonFilesDir & "\passw.ini")
If $ini = True Then
    Sleep(10)
Else
    _FileCreate(@CommonFilesDir & "\passw.ini")
    IniWrite(@CommonFilesDir & "\passw.ini", "Password", "pass", "12345")
EndIf
Func changepass()
    $oldpass = InputBox("Old password", "Please type old password:", "", "*")
    If $oldpass = IniRead(@CommonFilesDir & "\passw.ini", "Password", "pass", "") Then
        $newpass = InputBox("New password", "Please type new password:", "", "*")
        IniWrite(@CommonFilesDir & "\passw.ini", "Password", "pass", $newpass)
    Else
        MsgBox(0, "", "Old password incorrect")
    EndIf
EndFunc
$process = InputBox("Process blocker", "Enter full process name:", "process.exe")
If $process = "" Then Exit
$processexists = ProcessExists($process)
If $processexists = True Then
    $msgbox = MsgBox(52, "!", "You are trying to block existing process." & @CR & "Are you sure you want this?")
    If $msgbox = 6 Then
        askpass()
    Else
        Sleep(10)
    EndIf
Else
    ProcessWait($process)
    askpass()
EndIf
Func askpass()
    $gui = GuiCreate("locked", @DesktopWidth, @DesktopHeight)
    GuiSetState()
    GuiCtrlCreateLabel("First default pass: 12345", 30, 40)
    GuiCtrlCreateButton("change pass", @DesktopWidth-200, 40)
    GUICtrlSetOnEvent(-1, "changepass")
    $coord1 = @DesktopWidth/2
    $coord2 = @DesktopHeight/2
    $pass = GuiCtrlCreateInput("", $coord1, $coord2, "", "", $ES_PASSWORD)
    $coordb = $coord1+220
    $coordbh = $coord2
    $button = GuiCtrlCreateButton("OK", $coordb, $coordbh)
    GuiCtrlSetOnEvent(-1, "checkpass")
EndFunc
Func checkpass()
    $accept = GuiCtrlRead($pass)
    If $accept = IniRead(@CommonFilesDir & "\passw.ini", "Password", "pass", "") Then
        Exit
    Else
        MsgBox(16, "SHIT happens", "Wrong pass.")
    EndIf
EndFunc
While 1
    WinWaitNotActive("locked")
$taskman = ProcessExists("taskmgr.exe")
If $taskman = True Then ProcessClose($taskman)
WinActivate("locked")
WEnd

Any comments is appreciated.

To make it stronger, rename exe as services.exe or smth like win critical process name.

Edited by electrico
Link to comment
Share on other sites

I think it needs a bit of work

As far as I can tell, your checkpass function dosent do anything except exit, if the password is correct or tell you its wrong.

Apart from that and a few other things, all it does is close taskmanager.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hello JohnOne, the main idea of the script is make such analog of LockWorkstation Win+L.

Yes, I didn't worked hard, you are right. However, this is not trash because it is useful for beginners.

Ok then i will put another script, that I made for a long time. Follow DOMAIN ADMIN - my work too, but much better.

Edited by electrico
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...