myspacee Posted July 17, 2008 Share Posted July 17, 2008 (edited) Watchdog program,sure exist but make my own. muttleyfirst run, make list of your 'safe' program (.exe)second run, monitor running .exe and kill if not in listShift + Alt + d to exit: edited : Use sysinternal pskill to kill process, copy pskill.exe to you c:\ if compile.download it from microsoft expandcollapse popup;//////////////////////////////////////////////////////////////////// ;// Watchdog - kill not allowed programs ;//////////////////////////////////////////////////////////////////// #NoTrayIcon HotKeySet("+!d", "Terminate");Shift-Alt-d ;//////////////////////////////////////////////////////////////////// ;// ONLY ONE SESSION AT TIME ;//////////////////////////////////////////////////////////////////// $list = ProcessList(@ScriptName) for $i = 1 to $list[0][0] if $i > 1 Then msgbox(0, "Alert!", "Only one instance is allowed : " & @ScriptName, 1) ProcessClose($list[$i][1]) EndIf next ;////////////////////////////////////////////////////////////////////// ;// copy Sysinternal pskill in working directory ;////////////////////////////////////////////////////////////////////// If FileExists(@WorkingDir & "\pskill.exe") Then ;do nothing Else FileInstall("c:\pskill.exe", @WorkingDir & "\pskill.exe", 1) EndIf ;////////////////////////////////////////////////////////////////////// ;// MAIN ;////////////////////////////////////////////////////////////////////// if FileExists("allowed.ini") then ;if .ini exists kill other process While 1 XenoKiller() sleep(1000) WEnd else StoreRunning() ;if .ini NOT exists create file/list EndIf ;////////////////////////////////////////////////////////////////////// ;// FUNCTIONS ;////////////////////////////////////////////////////////////////////// ;// FIRST RUN create allowed .exe list ;////////////////////////////////////////////////////////////////////// Func StoreRunning($file = "allowed.ini") ; List all processes in a File local $list = ProcessList() for $i = 1 to $list[0][0] FileWriteLine("allowed.ini", $list[$i][0] & @CRLF) next msgbox(0, "First Run", "OK, i've created allowed.ini that contains allowed .exe." & @CRLF & "Remember ! SHIFT+Alt+d to quit " & @ScriptName) EndFunc ;///////////////////////////////////////////////////////////// ;// KILL process not in list ;///////////////////////////////////////////////////////////// Func XenoKiller() ; List all processes local $list = ProcessList() ;///////////////////////////////////////////////////////////// ;// FOR to find running .exe in my list ;///////////////////////////////////////////////////////////// for $i = 1 to $list[0][0] Local $linenum = 0 ;This is for skip line in filereadline function $file = FileOpen("allowed.ini", 0);open allowed list If $file = -1 Then ; Check if file opened for reading OK MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;///////////////////////////////////////////////////////////// ;// PROCESS = line read ? ;///////////////////////////////////////////////////////////// While 1 $linenum = $linenum + 1 ;add one to skip next line $line = FileReadLine($file, $linenum) ;each cicle read next line if $list[$i][0] = $line Then ExitLoop ;if process name is in my list it's safe, exit to next one If @error = -1 Then ;if EOF , I can't find in my list Run(@ComSpec & " /c " & "pskill -t " & $list[$i][0], "", @SW_HIDE) ;kill him ExitLoop ;and exit to next one EndIf Wend FileClose($file) next EndFunc Func Terminate() ToolTip("ok, quit " & @ScriptName, 0, 0) Sleep(2000) Beep(500,250) Beep(1000,250) Beep(500,250) Exit 0 EndFuncthank you all for your time,m. Edited July 21, 2008 by myspacee Link to comment Share on other sites More sharing options...
Confuzzled Posted July 20, 2008 Share Posted July 20, 2008 Watchdog program,Shit + Alt + d to exitIs that like pressing the flush button? muttley Link to comment Share on other sites More sharing options...
myspacee Posted July 20, 2008 Author Share Posted July 20, 2008 hello Confuzzled, if for 'flush' button you mean toilet button you make me smile muttley change it if you don't like, you have source.... m. Link to comment Share on other sites More sharing options...
HeffeD Posted July 20, 2008 Share Posted July 20, 2008 He was talking about your typo. Look at his quote closely. muttley Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now