Jump to content

Can someone help me please?


Recommended Posts

Hi im creating a PC Movement lock application so am kind of stuck here lol,

so what it will do is when you open, it will only log you out when someone moves the mouse or presses the keyboard.

i have found this codes in this site but im using it for my own ideas haha.

so i want to put lock in it but i cant, it gives me weak points so i can't figure it out.

here it is what i have done

please read bottom i want to put password if i dont want to get loged out of the windows

Thanks for your time

------------------------------------------------------------------------------

#include <Misc.au3>

Global $LASTMOUSEPOS[2],$LASTINPUTINFO=-1

$hUser32 = DllOpen("user32.dll")

Dim $iMsgBoxAnswer

$iMsgBoxAnswer = MsgBox(5244324,"Infrahacker","PC Movement Lock will be active when you click OK. Don't use mouse or keyboard anymore. press Enter:" & @CRLF & "")

Select

Case $iMsgBoxAnswer = 6 ;Yes

Case $iMsgBoxAnswer = 7 ;No

If $iMsgBoxAnswer = 7 Then

Dim $iMsgBoxAnswer

$iMsgBoxAnswer = MsgBox(5244304,"Infrahacker","!Action Terminated By User!",0)

Select

Case $iMsgBoxAnswer = 0

EndSelect

Exit

EndIf

EndSelect

Sleep(100)

_IsIdle()

While _IsIdle()

Sleep(20)

WEnd

DllClose($hUser32)

ProgressOn("Loading..", "Aunauthorised User!", "0 percent")

For $i = 10 to 100 step 10

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

run("locl/s")

Run("RunDll32.exe user32.dll,LockWorkStation")

Func _IsIdle()

If $LASTINPUTINFO Then

Local $inputinfo = _GetLastInputInfo()

If Not ($inputinfo = $LASTINPUTINFO ) Then

$LASTINPUTINFO = $inputinfo

Return False

EndIf

Else

If _IsAnyKeyPressed() Then

Return False

ElseIf Not ($LASTMOUSEPOS[0] = MouseGetPos(0) And $LASTMOUSEPOS[1] = MouseGetPos(1)) Then

Return False

EndIf

EndIf

Return True

EndFunc

Func _IsAnyKeyPressed()

For $i = 1 to 221

If ( _IsPressed( Hex($i,2), $hUser32) ) Then

Return 1

EndIf

Next

EndFunc

Func _GetLastInputInfo()

Local $IdleStruct=DllStructCreate("uint;dword")

DllStructSetData($IdleStruct,1,DLLStructGetSize($IdleStruct))

DllCall($hUser32,"int","GetLastInputInfo","ptr",DLLStructGetPtr($IdleStruct))

If @error Then Return SetError(1,0,0)

Return DLLStructGetData($IdleStruct,2)

EndFunc

Opt("WinTitleMatchMode",4)

Opt("OnExitFunc")

Opt("TrayAutoPause",0)

$hwnd = WinGetHandle("classname=Progman")

$user32 = DllOpen("user32.dll")

Global Const $lciWM_SYSCommand = 274

Global Const $lciSC_MonitorPower = 61808

Global Const $lciPower_Off = 2

Global Const $lciPower_On = -1

$drive = StringLeft(@ScriptFullPath, 2) & "\"

$code = _DriveInfo($drive)

While 1

While FileExists(@ScriptFullPath)

Sleep(50)

WEnd

While not (_DriveInfo($drive) = $code)

While not FileExists(@ScriptFullPath)

DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off)

BlockInput(1)

Sleep(50)

WEnd

WEnd

DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On)

BlockInput(0)

WEnd

Func _DriveInfo($drv)

Return DriveGetFileSystem($drv) & DriveGetLabel($drv) & DriveGetSerial($drv) & DriveGetType($drv) & DriveSpaceTotal($drv) & DriveStatus($drv)

EndFunc

------------------------------------------------------------------------------

i want to add this but i can't my brain is not working these days

Opt("WinTitleMatchMode",4)

Opt("OnExitFunc")

Opt("TrayAutoPause",0)

$hwnd = WinGetHandle("classname=Progman")

$user32 = DllOpen("user32.dll")

Global Const $lciWM_SYSCommand = 274

Global Const $lciSC_MonitorPower = 61808

Global Const $lciPower_Off = 2

Global Const $lciPower_On = -1

$drive = StringLeft(@ScriptFullPath, 2) & "\"

$code = _DriveInfo($drive)

While 1

While FileExists(@ScriptFullPath)

Sleep(50)

WEnd

While not (_DriveInfo($drive) = $code)

While not FileExists(@ScriptFullPath)

DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off)

BlockInput(1)

Sleep(50)

WEnd

WEnd

DllCall($user32, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On)

BlockInput(0)

WEnd

Func _DriveInfo($drv)

Return DriveGetFileSystem($drv) & DriveGetLabel($drv) & DriveGetSerial($drv) & DriveGetType($drv) & DriveSpaceTotal($drv) & DriveStatus($drv)

EndFunc

Func OnAutoItExit()

Local $password = "password" ;set your password here

$msg = MsgBox(4 + 32,"","Are you sure you want to quit this application?")

If $msg = 6 Then ;= yes

While 1

$pass_input = InputBox("","Please enter your password to quit this application.","","*")

If $pass_input = $password Then

Exit

Else

$msg2 = MsgBox(4 + 32,"","This password is wrong. Are you sure you want to quit this application?")

If $msg2 = 6 Then

Else

;this is a weak point, how to set this so that it will not exit this application?

;for now it will do with:

Run(@ScriptFullPath)

Exit

EndIf

EndIf

WEnd

Else

;this is a weak point, how to set this so that it will not exit this application?

;for now it will do with:

Run(@ScriptFullPath)

Exit

EndIf

EndFunc

Link to comment
Share on other sites

#include <Timers.au3>

Global $iIdleTime, $iIdleTime_Save
Global $passwd_to_check = "test"

$iIdleTime = _Timer_GetIdleTime()
$iIdleTime_Save = $iIdleTime
While 1
    sleep(10)
    $iIdleTime = _Timer_GetIdleTime()
;ConsoleWrite($iIdleTime & @tab & $iIdleTime_Save & @crlf)
    if $iIdleTime < $iIdleTime_Save Then
    ;Asks the user to enter a password.  Don't forget to validate it!
        $passwd = InputBox("Security Check", "Enter correct password within 5 seconds" & @crlf & "or PC will be locked...", "", "*",Default,Default,Default,Default,5)
        if $passwd <> $passwd_to_check Then
            MsgBox(0,"Lock PC","Activity detected, lock PC.")
        ;Run("RunDll32.exe user32.dll,LockWorkStation")
        Else
            sleep(200)
            $iIdleTime_Save = _Timer_GetIdleTime()
        endif
    Else
        $iIdleTime_Save = $iIdleTime
    EndIf
WEnd

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