Jump to content

How to stop extra .exes to run


 Share

Recommended Posts

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

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

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

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.

Link to comment
Share on other sites

#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

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