Jump to content



Photo

Disallow programs from opening :)


  • Please log in to reply
12 replies to this topic

#1 ReaImDown

ReaImDown

    Slacker

  • Active Members
  • PipPipPipPipPipPip
  • 552 posts

Posted 11 June 2007 - 11:08 PM

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 :)

AutoIt         
#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

Attached Files


Edited by ReaImDown, 12 June 2007 - 12:31 AM.

~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs





#2 ReaImDown

ReaImDown

    Slacker

  • Active Members
  • PipPipPipPipPipPip
  • 552 posts

Posted 12 June 2007 - 12:45 PM

no comments? replies? put-downs...nothing? -.-'

Edited by ReaImDown, 12 June 2007 - 12:45 PM.

~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs

#3 James

James

    jbrooksuk

  • MVPs
  • 9,468 posts

Posted 12 June 2007 - 01:03 PM

Nice and Simple.

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.

#4 Obi-w00t

Obi-w00t

    Wayfarer

  • Active Members
  • Pip
  • 64 posts

Posted 12 June 2007 - 07:30 PM

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

#5 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,340 posts

Posted 12 June 2007 - 10:05 PM

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

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#6 ReaImDown

ReaImDown

    Slacker

  • Active Members
  • PipPipPipPipPipPip
  • 552 posts

Posted 13 June 2007 - 03:15 AM

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, 13 June 2007 - 03:18 AM.

~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs

#7 JavaCupiX

JavaCupiX

    Seeker

  • Active Members
  • 34 posts

Posted 13 June 2007 - 03:20 PM

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

#8 MHz

MHz

    Just simple

  • MVPs
  • 5,400 posts

Posted 13 June 2007 - 03:38 PM

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.

#9 JavaCupiX

JavaCupiX

    Seeker

  • Active Members
  • 34 posts

Posted 13 June 2007 - 03:47 PM

@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:

#10 ReaImDown

ReaImDown

    Slacker

  • Active Members
  • PipPipPipPipPipPip
  • 552 posts

Posted 13 June 2007 - 06:13 PM

@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:
~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs

#11 MHz

MHz

    Just simple

  • MVPs
  • 5,400 posts

Posted 13 June 2007 - 06:23 PM

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.

#12 Obi-w00t

Obi-w00t

    Wayfarer

  • Active Members
  • Pip
  • 64 posts

Posted 13 June 2007 - 06:57 PM

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.

#13 inov8iv

inov8iv

    Seeker

  • Active Members
  • 20 posts

Posted 19 September 2007 - 06:41 PM

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!")

ProgTerm.jpg

Now that would be insane......




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users