Jump to content

Disallow programs from opening :)


ReaImDown
 Share

Recommended Posts

this is a run-in-background program, what it does is, you it places itself in the "C:\program files\Common Files\" folder, then places itself to run on start up, it contains a .ini file, where you can choose which programs wont run...EX. "msnmsgr.exe" and which users wont be affect (@username(your own)) + w/e other accounts you choose. "Shift + \" will stop the program if desired, and if your account name = to the safe accounts, the program will automatically turn off until the next log-in.

Feedback is welcomed :)

#NoTrayIcon
#include <Array.au3>
HotKeySet("+\", "Terminate")

Global $sIni = @CommonFilesDir & "\Disallow.ini"
Global $Reg = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Disallow")

If FileExists(@CommonFilesDir & "\Disallow.ini") = False And FileExists(@CommonFilesDir & "\" & @ScriptName) = False Then
    Dim $aData2[4][2] = [ [ "Process0", "msnmsgr.exe" ], [ "Process1", "" ], [ "Process2", "" ], [ "Process3", "" ] ]
    Dim $aSafe[2][2] = [ [ "SafeUser0", @UserName ], [ "SafeUser1", "" ] ]
    FileOpen($sIni, 1)
    FileWrite($sIni, "Disallow made By: Randy Skinner on May 30th 2007," & @CRLF & @CRLF & "Press SHIFT + \ to disable the script once its running...." & @CRLF & "process = the name of the process you wish to close, found when you press CTRL ALT DELETE...MSN Messenger is msnmsgr" & @CRLF & "To disable a specific item from being used, use this format... process0 = firefox.exe" & @CRLF & @CRLF)
    FileClose($sIni)
    IniWriteSection($sIni, "Disallow", $aData2, 0)
    FileOpen($sIni, 1)
    FileWrite($sIni, @CRLF & @CRLF & "Enter all the users you dont want this program to affect below" & @CRLF & @CRLF)
    FileClose($sIni)
    IniWriteSection($sIni, "SafeUsers", $aSafe, 0)
    FileMove(@ScriptFullPath, @CommonFilesDir & "\" & @ScriptName, 0)
    If $Reg <> @CommonFilesDir & "\" & @ScriptName Then
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Disallow", "REG_SZ", @CommonFilesDir & "\" & @ScriptName)
    EndIf
    MsgBox(0, "Sucessful!", "The file has been installed successfully, just edit the .ini file and your done!")
    ShellExecute($sIni)
    Sleep(500)
    While 1
        If WinExists("Disallow.ini - Notepad") = False Then
            MsgBox(0, "Disallow", "Success!, this file will resume on start up!")
            Exit
        EndIf
    WEnd
ElseIf FileExists(@CommonFilesDir & "\Disallow.ini") = False And FileExists(@CommonFilesDir & "\" & @ScriptName) = True Then
    Dim $aData2[4][2] = [ [ "Process0", "msnmsgr.exe" ], [ "Process1", "" ], [ "Process2", "" ], [ "Process3", "" ] ]
    Dim $aSafe[2][2] = [ [ "SafeUser0", @UserName ], [ "SafeUser1", "" ] ]
    FileOpen($sIni, 1)
    FileWrite($sIni, "press SHIFT + \ to disable the script once its running...." & @CRLF & "process = the name of the process you wish to close, found when you press CTRL ALT DELETE...MSN Messenger is msnmsgr" & @CRLF & "To disable a specific item from being used, use this format... process0 = firefox.exe" & @CRLF & @CRLF)
    FileClose($sIni)
    IniWriteSection($sIni, "Disallow", $aData2, 0)
    FileOpen($sIni, 1)
    FileWrite($sIni, @CRLF & "Enter all the users you dont want this program to affect below" & @CRLF & @CRLF)
    FileClose($sIni)
    IniWriteSection($sIni, "SafeUsers", $aSafe, 0)
    MsgBox(0, "Sucessful!", "The .ini file has been re-installed successfully, just edit the .ini file and your done!")
    Sleep(500)
    ShellExecute($sIni)
    Sleep(500)
    While 1
        If WinExists("Disallow.ini - Notepad") = False Then
            MsgBox(0, "Disallow", "Success!, this file will resume on start up!")
            Exit
        EndIf
    WEnd
    Exit
ElseIf FileExists(@CommonFilesDir & "\Disallow.ini") = True And FileExists(@CommonFilesDir & "\" & @ScriptName) = False Then
    FileMove(@ScriptFullPath, @CommonFilesDir & "\" & @ScriptName, 0)
    
    If $Reg <> @CommonFilesDir & "\" & @ScriptName Then
        RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Disallow", "REG_SZ", @CommonFilesDir & "\" & @ScriptName)
    EndIf
    MsgBox(0, "Sucessful!", "The .exe file has been re-installed successfully.")
EndIf


Global $Programs = IniReadSection(@CommonFilesDir & "\Disallow.ini", "Disallow")
Global $Safe = IniReadSection(@CommonFilesDir & "\Disallow.ini", "SafeUsers")

For $a = 1 To $Safe[0][0] Step 1
    If $Safe[$a][1] = @UserName Then
        Exit
    EndIf
Next

Local $list = ProcessList();Grabs all running processes
For $i = 1 To $list[0][0] Step 1;Loops them all
    _KillProcess($list[$a][0]);Sends each to be check and if chosen, closed.
Next

$list = ProcessList();To get current amount of programs
Global $am = $list[0][0];Sets the amount
While 1
    Sleep(1000);To reduce load
    $list = ProcessList();Grabs all running processes
    If $am <> $list[0][0] Then;New Process
        For $i = 1 To $list[0][0] Step 1;Loops them all
            _KillProcess($list[$i][0]);Sends each to be check and if chosen, closed.
        Next
        $am = $list[0][0];Update amount
    EndIf
WEnd

Func _KillProcess($id)
    $shown = 0
    For $i = 0 To UBound($Programs) - 1 Step 1
        For $1 = 1 To $Programs[0][0]
            If $Programs[$1][1] = $id Then;If this program is not allowed to run
                ProcessClose($id);Close program
                If ProcessClose($id) = True And $shown = 0 Then
                    MsgBox(0, "Closed", $id & " is not allowed to be used.");Display message.
                    $shown = 1
                EndIf
            EndIf
        Next
    Next
EndFunc   ;==>_KillProcess

Func Terminate()
    $Exit = MsgBox(0, @UserName, @UserName & ", you deactivaed the program successfully!")
    ProcessClose(@ScriptName)
EndFunc   ;==>Terminate

disallow.au3

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

My secondary school had a security system like this...however it was easy to get around it by killing the process. Maybe you should think about somehow stopping process killing, and also people just changing the file name (look at original file name property & file size).

Link to comment
Share on other sites

Wow. I thought this would use a DllCall. My stupid self didn't even think of using a process closer. Good job.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Cool. Maybe you should add a password function in there. So when a certain program starts, you are asked for a password, and you cannot access the program untill the password is entered.

I will try and add that tomorrow night, but, where would I save the pass to? Registry?

it was easy to get around it by killing the process. Maybe you should think about somehow stopping process killing, and also people just changing the file name (look at original file name property & file size).

I have thought about that, but it hurts my head trying to think of how to stop it from showing on the process list, and, the file name, hmmm, I will try and impliment that tomorrow too lol

Wow. I thought this would use a DllCall. My stupid self didn't even think of using a process closer. Good job.

thanks,

Thanks for the feedback all, I will work on those suggestions tomorrow after I am done school, more input is welcomed, I was trying to make a process id checker that shows the process Id of a window, and the window title, but...I had no success lol...I am probably going to add a GUI to this as well.

Randy S.

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

I had to protect one of my processes from being closed so I found a first (but not perfect solution)

=> Create a watcher process who just keep watching the main process and restarting it if it close... and do the same in the main process where the main process watches the secondary process

A better solution would be to "rootkit" your watcher so it is hidden and "nearly" unkillable...

Link to comment
Share on other sites

I had to protect one of my processes from being closed so I found a first (but not perfect solution)

=> Create a watcher process who just keep watching the main process and restarting it if it close... and do the same in the main process where the main process watches the secondary process

A better solution would be to "rootkit" your watcher so it is hidden and "nearly" unkillable...

Do you work for Sony? This is a unwelcomed 1st post you made. You would be better off not mentioning "RootKits" around here, thankyou.
Link to comment
Share on other sites

@Mhz : as every technology it has its downsides... but without it some programs like "Daemon Tools" couldn't even think working well... They are plenty of other examples of good use of these things so don't react in such a harch way.

@ReaImDown : maybe if u start the process in system account the users could not kill it, it would be a more mhz-friendly way :rolleyes:

Link to comment
Share on other sites

@Mhz : as every technology it has its downsides... but without it some programs like "Daemon Tools" couldn't even think working well... They are plenty of other examples of good use of these things so don't react in such a harch way.

@ReaImDown : maybe if u start the process in system account the users could not kill it, it would be a more mhz-friendly way :rolleyes:

haha, if only I knew how, I will try and figure it out tonight, but, help is always well...helpful :x lol, good idea :rambo:

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

It only takes one registry key to block a process. No rootkit or any other crap needed. You have the hint, now figure it out for yourselves. I have little time for people who act smart by doing stupid things.

Link to comment
Share on other sites

I have little time for people who act smart by doing stupid things.

I also have little time for people who just post some information and expect everyone else to know what they are on about. A little more information would be helpful, as after about ten minutes on searching all I could find was

this.

Link to comment
Share on other sites

  • 3 months later...

I also have little time for people who just post some information and expect everyone else to know what they are on about. A little more information would be helpful, as after about ten minutes on searching all I could find was

this.

^^ Very to know also, I was recently asked to disable the games on a few computers, this will be great for that.

Although, I have to say as an administrator, it would be nice to select the msgbox text and with this little snippet, you can select the exact message you want to pop up when the program does not work for a user.

MsgBox(0, "Program Terminated - " & $PROGNAME, "Your immediate supervisor has requested your access to [ " & $PROGNAME & " ] be disabled" & @CRLF _

& "If you feel you need to run this program it will require a signed MEMO from your Supervisor." & @CRLF & @CRLF _

& "Thank You, OFFICENAME - System Administrator!")

post-20118-1190227222_thumb.jpg

Now that would be insane......

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