Jump to content

Computer key


mikidutza
 Share

Recommended Posts

hey mikidutza, u need change your source to :):

opt("TrayIconHide",1)
While 1
If FileExists("H:\123.txt") = 1 Then ; <== the "=1"
BlockInput(0)
While FileExists("H:\123.txt") = 1 ; <== the "=1"
sleep(10000)
WEnd
EndIf
sleep(100)
BlockInput(1)
WEnd

note: while "H" is the drive.. and "123.txt" is the file..

i dont get the change in this one...
Link to comment
Share on other sites

i dont get the change in this one...

when u use this source:

opt("TrayIconHide",1)
While 1
    If FileExists("F:\Mikidutza") Then ;--- change this
        BlockInput(0)
    While FileExists("F:\Mikidutza") ;--- change this
        sleep(10000)
    WEnd
EndIf

    sleep(100)
    
    
BlockInput(1)

WEnd

and the disk allready in drive.. all ok.. but if u exit the disk, the pc send message:

"not found disk" try again, ok, cancle..

try yourself..

burn disk and inset file name "Mikidutza"..

Link to comment
Share on other sites

well the idea of the script is awesome but i find the script it self strange :/

take a look here

opt("TrayIconHide",1)
HotKeySet("w+t+f","terminate")
do
If Not FileExists("H:\Anani.mp3") Then 
BlockInput(1)
sleep(10000)
Else 
    BlockInput(0)
    sleep(10000)
EndIf
if "{LCTRL} + {alt}" Then
    BlockInput(1)
    sleep(100)
ElseIf "{rctrl} + {alt}" Then
    BlockInput(1)
    sleep(100)
EndIf
until 1 = 1337 

Func terminate()
    Exit
EndFunc

but still alt + ctrl + del works and the other problem i used the cd rom and the windows gives u that annoying msg telling that autoit uses the cd rom insert the cd and it keeps disabling the BlockInput

Link to comment
Share on other sites

well the idea of the script is awesome but i find the script it self strange :/

take a look here

opt("TrayIconHide",1)
HotKeySet("w+t+f","terminate")
do
If Not FileExists("H:\Anani.mp3") Then 
BlockInput(1)
sleep(10000)
Else 
    BlockInput(0)
    sleep(10000)
EndIf
if "{LCTRL} + {alt}" Then
    BlockInput(1)
    sleep(100)
ElseIf "{rctrl} + {alt}" Then
    BlockInput(1)
    sleep(100)
EndIf
until 1 = 1337 

Func terminate()
    Exit
EndFunc

but still alt + ctrl + del works and the other problem i used the cd rom and the windows gives u that annoying msg telling that autoit uses the cd rom insert the cd and it keeps disabling the BlockInput

well my improve nice too, its block Ctrl+Alt+Del and work sucsfull..
Link to comment
Share on other sites

didnt work for me :/

this topic is interesting to me

edit:

If you are using Windows XP then you should be aware that a hotfix released in between SP1 and SP2 limited Blockinput so that the ALT key could NOT be sent. This is fixed in XP SP2. as online documentation said

so the problem with u is that u r not using sp2

but iam using it and the keys dont get blocked

Edited by yehia
Link to comment
Share on other sites

  • 5 months later...

didnt work for me :/

this topic is interesting to me

edit:

If you are using Windows XP then you should be aware that a hotfix released in between SP1 and SP2 limited Blockinput so that the ALT key could NOT be sent. This is fixed in XP SP2. as online documentation said

so the problem with u is that u r not using sp2

but iam using it and the keys dont get blocked

the truth is my code was shit, the idea was to gat an outside factor as a bolean, the way to disable the |Task Manager is to put the Blockimput in a loop, this way you dont have enough time to press the three magic butons ...

if the outside factor is true then the blockinput(0) is called and the program goes to a loop whith verifies that the outside factor remains true ...

Link to comment
Share on other sites

  • 3 weeks later...

Hey mikidutza,

I've read the entire post.

In my situation I use a similar solution.

#NoTrayIcon
Opt("TrayAutoPause",0)

If $CmdLine[0] <> 1 Then
    splashTextOn("Computer-Lock","Account-Locker"&@CRLF&@CRLF&"Start applicatie met ÉÉN parameter!"&@CRLF&"Start application with ONE parameter!",400,100,-1,-1,33,"",14,500)
    Sleep(5000)
    SplashOff()
    Exit
EndIf

$KeyFile = $CmdLine[1]

While 1
    Sleep(1000)
    If Not FileExists($KeyFile) Then
        Run("rundll32 user32.dll,LockWorkStation")
    EndIF
WEnd

In my situation (private and at work) I must logon with a password.

I to use a USB-stick as a unlock-key.

The code I wrote checks every second for a specifick file and if not found it puts my computer in lockdown.

When in lockdown, the computer will be asking for my login-credentials.

I can enter my login-credentials and the computer will unlock.

If the specific USB-stick is not present, the computer will immediatly be put in lockdown.

Even if someone knows my login-credentials, it will be useless without the specific USB-stick.

When compiled it runs under Windows 2000 and XP, no matter the edition or service packs.

Wether it runs under Windows Vista, I don't know.

Application will only start if started with ONE parameter.

The parameter schould contain the file to look for, like: "G:\Account-Locker\Account-Locker".

An empty file is oke.

You can use any removable storage media as your unlock-key.

It can only be stopped using the taskmanager.

So be carefull if started from startup group.

Greetz,

JohRid.

Link to comment
Share on other sites

I would have thought it is easier to simply close the task manager after it had been called rather than try to intercept Ctrl-Alt-Del or the Windows Hotkeys (if active). Depending on how quickly your timing loop is recycled, the Task Manager could be shut down within milliseconds of it's window becoming active (possibly before it even became visible).

Link to comment
Share on other sites

PartyPooper,

It's not about blocking the taskmanager or blocking Ctrl + Alt + Delete, it's about a hardware security simpler/cheaper then a securitydongle or -card.

That is what it is about (I think).

If I would change my code, I would try to block any keyboard-input when USB-stick is NOT present. So you can only unlock when USB-stick is present. In this case it would mean it has to run as a service, which is do-able.

A second change would be not to look for a file but to look voor de deviceID, which is normally unique.

I am lokking into both ideas but any suggestion is welcome.

Greetz

Link to comment
Share on other sites

Oke, one problem solved.

#NoTrayIcon
Opt("TrayAutoPause",0)

$FileRead = FileOpen("Account-Locker.ini",0)
$KeyFile = FileReadLine($FileRead,1)
FileClose($FileRead)

While 1
    Sleep(250)
    If Not FileExists($KeyFile) Then
        BlockInput(1)
        MouseMove(@DesktopWidth,@DesktopHeight,1)
        Run("rundll32 user32.dll,LockWorkStation")
    Else
        BlockInput(0)
    EndIf
WEnd

This new code works well voor Windows 2000 and XP, other versions not tested.

Also you need to create a file "Account-Locker.ini"

Inside type the exact lokation of the file to look for, like: G:\Account-Locker\Account-Locker

Start the program without any parameters.

When running the programm, and the removeble media is removed, the account will pe put in lockdown.

When account is in lockdown, mousemovement and keyboard-input will not be possible.

After reinserting removeable media, mousemovement and keyboard-input will be possible again.

You are allowed to login again.

Also have been trying to run it as a service.

Used

RunAsSvc.exe

.

It installed as a service and it will start automatic but it stops a few seconds later.

If try to start in manually it give an error someting like

Sevce started but stopped because programm seemes to do noting

(exuse my translation, my system is dutch).

I could use some help in this.

Greetz

Link to comment
Share on other sites

Yes,

All but one problem resolved.

This is my latest code. I call it Account-Locker.au3

#NoTrayIcon
Opt("TrayAutoPause",0)
Opt("MustDeclareVars",0)

If FileExists("Account-Locker.ini") Then
    $FileRead = FileOpen("Account-Locker.ini",0)
    If $FileRead = -1 Then
        FileClose($FileRead)
        Exit
    Else
        $DriveSerial = Number(FileReadLine($FileRead,1))
        FileClose($FileRead)
    EndIf
Else
    $NumberOfDrives = DriveGetDrive("removable")
    If Not @error Then
        $DriveSerial = DriveGetSerial($NumberOfDrives[1])
        $FileWrite = FileOpen("Account-Locker.ini",1)
        FileWrite($FileWrite,$DriveSerial)
        FileClose($FileWrite)
    Else
        Exit
    EndIf
EndIf

$NumberOfDrives = DriveGetDrive("all")

If Not @error Then
    For $Drives = 1 To $NumberOfDrives[0]
        $SerialOfDrive = DriveGetSerial($NumberOfDrives[$Drives])
        If $SerialOfDrive = $DriveSerial Then $KeyDrive = $NumberOfDrives[$Drives]
    Next
Else
    FileClose($FileRead)
    Exit
EndIf

While 1
    Sleep(250)
    $StatusDrive = DriveStatus($KeyDrive)
    If $StatusDrive = "INVALID" Then
        Call("LockDown")
    Else
        If Not $DriveSerial = DriveGetSerial($KeyDrive) Then
            Call("LockDown")
        Else
            BlockInput(0)
        EndIf
    EndIf
WEnd
Exit

Func LockDown()
    BlockInput(1)
    Run("rundll32 user32.dll,LockWorkStation")
EndFunc

Compile this script

Delete existing Account-Locker.ini

Connect removable media you want to use. Make sure it is the first removable media in your explorer.

Start application.

If removable is found, the serialnumber of that device will be used as a key.

From now it is no longer important what drive-letter it has on startup application.

One problem still exists, running as service still not working.

HELP!!!!

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...