davidtan Posted November 5, 2009 Share Posted November 5, 2009 I have a code I want to stop all kinds of extra setup to run on my PC mean when someone else try to run any software on my PC my script check the current running process & if see it as an extra process coming in my pc it immediately stop that setup which is trying to make roots in my PC #NoTrayIcon #include <Array.au3> HotKeySet("{ESC}", "_Close") ; For testing purpose ; Program initialization Global $aAllowedProcs = ProcessList() While 1 Local $aCurrProcs = ProcessList() For $i = 1 To $aCurrProcs[0][0] If _ArraySearch($aAllowedProcs, $aCurrProcs[$i][1], 0, 0, 0, 0, 0, 1) = -1 Then ProcessClose($aCurrProc[$i][1]) Next Sleep(100) WEnd Func _Close() ConsoleWrite("Closing..." & @CRLF) Exit EndFunc Link to comment Share on other sites More sharing options...
bo8ster Posted November 5, 2009 Share Posted November 5, 2009 So do u need help with anything then or is this more an example script? Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
davidtan Posted November 5, 2009 Author Share Posted November 5, 2009 I nee d help mate. As there is one problem in this script that for example if I try to open clc.exe which is used for calculator it even do not allowed it to open either while I just want when any external software or application try to run on my PC then it check all the current running process & if see something extra then immediately kick out the process out of my pc & does not allowed unwanted process to add in my PC Link to comment Share on other sites More sharing options...
jvanegmond Posted November 5, 2009 Share Posted November 5, 2009 Hi,I get this error:>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Jos\Desktop\Dump 4 Nov\lolwuthacks.au3" C:\Users\Jos\Desktop\Dump 4 Nov\lolwuthacks.au3 (12) : ==> Variable used without being declared.:If _ArraySearch($aAllowedProcs, $aCurrProcs[$i][1], 0, 0, 0, 0, 0, 1) = -1 Then ProcessClose($aCurrProc[$i][1])If _ArraySearch($aAllowedProcs, $aCurrProcs[$i][1], 0, 0, 0, 0, 0, 1) = -1 Then ProcessClose(^ ERROR>Exit code: 1 Time: 4.334$aCurrProc is undefined. You wanted to use $aCurrProcs. github.com/jvanegmond Link to comment Share on other sites More sharing options...
KaFu Posted November 5, 2009 Share Posted November 5, 2009 #NoTrayIcon HotKeySet("{ESC}", "_Exit") ; For testing purpose ; Program initialization Global $aAllowedProcs = ProcessList() While 1 Local $aCurrProcs = ProcessList() For $i = 1 To $aCurrProcs[0][0] $bAllowedProcess = False For $y = 1 to $aAllowedProcs[0][0] if $aCurrProcs[$i][0] = $aAllowedProcs[$y][0] then ; compare Name of process or PIDs? [0] might allow to run processes with faked name, [1] might kill legitimate new instances of processes allowed... $bAllowedProcess = True ExitLoop EndIf Next if $bAllowedProcess = False then _Close($aCurrProcs[$i][0]) Next Sleep(100) WEnd Func _Close($sProcess) ConsoleWrite("Closing " & $sProcess & "..." & @CRLF) Return EndFunc Func _Exit() Exit EndFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
davidtan Posted November 5, 2009 Author Share Posted November 5, 2009 Kafu code does not work mate it do not stop new process to enter for example after running ur code I install "Choper XP" a DVD Cutter but it allowed it to install in system & enable its process to run Link to comment Share on other sites More sharing options...
jvanegmond Posted November 5, 2009 Share Posted November 5, 2009 Kafu code does not work mate it do not stop new process to enter for example after running ur code I install "Choper XP" a DVD Cutter but it allowed it to install in system & enable its process to runModify the _Close function to actually call ProcessClose.Or use your own script: And do as I told you. github.com/jvanegmond 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