Sign in to follow this  
Followers 0
qazwsx

Suspend Computer Privileges V3

7 posts in this topic

#1 ·  Posted (edited)

This script suspends certain computer privilege. So far it can only suspend internet use and the use of AIM. To end the suspension move your cursor to the top right of your screen and then input the password "specht". Any suggestions on what else it could block are welcome.

V2

Added Messenger

Added Hotkey ctrl shif a to end, Must also have mouse at origin.

V3

has better gui and works better. Now has many more options aswell.

CODE
;Privelage remover

#include <date.au3>

#include <GUIConstants.au3>

#include <string.au3>

#include <misc.au3>

If _Singleton(@ScriptName, 1) = 0 Then

MsgBox(0, "Warning", "Already Running")

Exit

EndIf

Opt("wintitlematchmode", 2)

Global $message ;message to display

Global $timeout = 5 ;timeout

Global $starttime ;time script starts

Global $InputBoxAnswer ;password entered

Global $currenttime ; current time

Global $endtime = 0 ; time to end

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;setup

If Not FileExists(@ScriptDir & "\setup.ini") Then

_default()

EndIf

Global $password = IniRead(@ScriptDir & "\setup.ini", "password", "1", "") ;password

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Gui

$Form2 = GUICreate("Setup", 413, 298, 249, 171)

GUISetIcon("D:05.ico")

$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)

$TabSheet1 = GUICtrlCreateTabItem("Main")

$Label1 = GUICtrlCreateLabel("Select Privelages to Suspend", 44, 40, 320, 33)

GUICtrlSetFont(-1, 19, 400, 0, "MS Sans Serif")

$Checkbox1 = GUICtrlCreateCheckbox("Instant Message", 52, 96, 105, 17)

$Checkbox2 = GUICtrlCreateCheckbox("Internet", 52, 128, 65, 17)

$Combo1 = GUICtrlCreateCombo("", 156, 168, 145, 25)

$Label2 = GUICtrlCreateLabel("Lenght of Suspension:", 36, 168, 110, 17)

$TabSheet2 = GUICtrlCreateTabItem("Instant Message")

$Radio2 = GUICtrlCreateRadio("Block by Screen Name", 40, 64, 129, 17)

$Radio3 = GUICtrlCreateRadio("Block All IM Processes", 40, 176, 129, 17)

GUICtrlSetState(-1, $gui_checked)

$Input1 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "screen names", "1", "Error"), 240, 64, 121, 21) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetState(-1, $GUI_DISABLE)

$Input2 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "screen names", "2", "Error"), 240, 96, 121, 21);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetState(-1, $GUI_DISABLE)

$Input3 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "screen names", "3", "Error"), 240, 128, 121, 21);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetState(-1, $GUI_DISABLE)

$Input4 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "screen names", "4", "Error"), 240, 160, 121, 21);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetState(-1, $GUI_DISABLE)

$Input5 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "screen names", "5", "Error"), 240, 192, 121, 21);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetState(-1, $GUI_DISABLE)

$Label3 = GUICtrlCreateLabel("Screen Names to Block", 240, 40, 116, 17)

$TabSheet3 = GUICtrlCreateTabItem("Settings")

$Label4 = GUICtrlCreateLabel("Hotkey to End Suspension:", 24, 64, 133, 17)

$Input6 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "Hotkey", "1", ""), 168, 64, 121, 21) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Keep

$Input7 = GUICtrlCreateInput(IniRead(@ScriptDir & "\setup.ini", "Message", "Message", "Error"), 128, 96, 241, 21)

$Label5 = GUICtrlCreateLabel("Message to Display:", 24, 96, 99, 17)

$TabSheet4 = GUICtrlCreateTabItem("Password")

$Button4 = GUICtrlCreateButton("Change Password", 184, 168, 123, 25, 0)

$Input8 = GUICtrlCreateInput("", 184, 64, 121, 21, $ES_PASSWORD)

$Label6 = GUICtrlCreateLabel("Old Password:", 32, 64, 72, 17)

$Input9 = GUICtrlCreateInput("", 184, 96, 121, 21, $ES_PASSWORD)

$Input10 = GUICtrlCreateInput("", 184, 128, 121, 21, $ES_PASSWORD)

$Label7 = GUICtrlCreateLabel("New Password:", 32, 96, 78, 17)

$Label8 = GUICtrlCreateLabel("Retype New Password:", 32, 128, 115, 17)

$Label9 = GUICtrlCreateLabel("Your Password has been Changed", 120, 208, 250, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

GUICtrlSetState(-1, $GUI_HIDE)

GUICtrlCreateTabItem("")

$Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25, 0)

$Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25, 0)

$Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25, 0)

GUISetState(@SW_SHOW)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

GUICtrlSetData($Combo1, "1|2|3|5|12|24|Indefinatley", IniRead(@ScriptDir & "\setup.ini", "duration", "1", ""))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button2 ;cancel

Exit

Case $Button3 ;help

MsgBox(64, "Help", "Privilege Suspender is a simple privilege monitoring program. It" & @CRLF & "allows the user to quickly and easily block certain applications " & @CRLF & "from being used, such as instant messaging or surfing the internet.")

Case $Radio2 ;block by screen name

GUICtrlSetState($Input1, $gui_enable)

GUICtrlSetState($Input2, $gui_enable)

GUICtrlSetState($Input3, $gui_enable)

GUICtrlSetState($Input4, $gui_enable)

GUICtrlSetState($Input5, $gui_enable)

Case $Radio3 ;block all im process

GUICtrlSetState($Input1, $GUI_DISABLE)

GUICtrlSetState($Input2, $GUI_DISABLE)

GUICtrlSetState($Input3, $GUI_DISABLE)

GUICtrlSetState($Input4, $GUI_DISABLE)

GUICtrlSetState($Input5, $GUI_DISABLE)

Case $Button1 ;ok

$im = GUICtrlRead($Checkbox1) ; IM

$internet = GUICtrlRead($Checkbox2) ; Internet

$suspensiontime = GUICtrlRead($Combo1) ; time

$imscreen = GUICtrlRead($Radio2) ; screen name

$message = GUICtrlRead ($Input7) ;message

IniWrite(@ScriptDir & "\setup.ini", "Message", "Message", $message)

If $imscreen = 1 Then ;record screennames

$screenname1 = GUICtrlRead($Input1)

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "1", $screenname1)

$screenname2 = GUICtrlRead($Input2)

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "2", $screenname2)

$screenname3 = GUICtrlRead($Input3)

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "3", $screenname3)

$screenname4 = GUICtrlRead($Input4)

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "4", $screenname4)

$screenname5 = GUICtrlRead($Input5)

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "5", $screenname5)

EndIf

$hotkey = GUICtrlRead($Input6) ; Hotkey to end

$message = GUICtrlRead($Input7)

GUIDelete()

ExitLoop

Case $Button4

_changepassword()

EndSwitch

WEnd

;;;;;;;;;;;;;;;;;;;;Main program

HotKeySet($hotkey, "_hotkeyexit")

If $suspensiontime <> "Indefinatley" Then

_currenttime()

EndIf

Iniwrite(@ScriptDir & "\setup.ini", "Status", "1", _StringEncrypt(1, "not okay", "specht")) ;state not okay

While 1

If _NowTime(4) = $endtime Then

MsgBox(64, "Time Up", "Your Suspension is Finished", 30)

Iniwrite(@ScriptDir & "\setup.ini", "Status", "1", _StringEncrypt(1, "okay", "specht"))

Exit

EndIf

If $im = 1 And $imscreen = 1 Then _aimscreennames()

If $im = 1 and $imscreen <> 1 Then _aimProcess ()

If $internet = 1 Then _internet ()

WEnd

;;;;;;;;;;;;;;;;;;Funcs

Func _hotkeyexit()

If Not IsDeclared("sInputBoxAnswer") Then Local $InputBoxAnswer

$InputBoxAnswer = InputBox("Password", "Enter Password", "", "*", "-1", "50", "-1", "-1", "15")

Select

Case @error = 0 ;OK - The string returned is valid

If $InputBoxAnswer = _StringEncrypt(0, $password, "specht") Then

MsgBox(0, "Ended", "Suspension Ended")

Iniwrite(@ScriptDir & "\setup.ini", "Status", "1", _StringEncrypt(1, "okay", "specht"))

Exit

EndIf

Case @error = 1 ;The Cancel button was pushed

Case @error = 2 ;The Timeout time was reached

Case @error = 3 ;The InputBox failed to open

EndSelect

EndFunc ;==>_hotkeyexit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Block funcs

Func _aimProcess()

If ProcessExists("aim6.exe") Then

ProcessClose("aim6.exe")

MsgBox(0, "", $message, $timeout)

EndIf

If ProcessExists("aim.exe") Then

ProcessClose("aim.exe")

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists("Buddy List") Then

WinKill("Buddy List")

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists("Aim") Then

WinKill("Aim")

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists("Messenger") Then

WinKill("Messenger")

MsgBox(0, "", $message, $timeout)

EndIf

EndFunc ;==>_aimProcess

Func _aimscreennames()

If WinExists($screenname1) Then

WinKill($screenname1)

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists($screenname2) Then

WinKill($screenname2)

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists($screenname3) Then

WinKill($screenname3)

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists($screenname4) Then

WinKill($screenname4)

MsgBox(0, "", $message, $timeout)

EndIf

If WinExists($screenname5) Then

WinKill($screenname5)

MsgBox(0, "", $message, $timeout)

EndIf

EndFunc ;==>_aimscreennames

Func _internet()

If WinExists("Mozilla") Then

WinKill("Mozilla")

MsgBox(0, "", $message, $timeout)

Opt("wintitlematchmode", 2)

EndIf

If WinExists("Internet") Then

WinKill("Internet")

MsgBox(0, "", $message, $timeout)

Opt("wintitlematchmode", 2)

EndIf

If WinExists("opera") Then

WinKill("opera")

MsgBox(0, "", $message, $timeout)

Opt("wintitlematchmode", 2)

EndIf

If WinExists("safari") Then

WinKill("safari")

MsgBox(0, "", $message, $timeout)

Opt("wintitlematchmode", 2)

EndIf

EndFunc ;==>_internet

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Misc Funcs

Func _currenttime()

Global $currenttime = _NowTime(4)

Global $hour = StringTrimRight($currenttime, 3)

Global $minute = StringTrimLeft($currenttime, 3)

If $hour = 24 Then $hour = 0

Global $endtime = $hour + $suspensiontime & ":" & $minute

EndFunc ;==>_currenttime

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Setup Funcs

Func _default()

If FileExists("setup.ini") Then FileDelete(@ScriptDir & "\setup.ini")

IniWrite(@ScriptDir & "\setup.ini", "Hotkey", "1", "^+{f12}")

IniWrite(@ScriptDir & "\setup.ini", "Password", "1", _StringEncrypt(1, "password", "specht"))

IniWrite(@ScriptDir & "\setup.ini", "Duration", "1", "1")

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "1", "Screen Name...")

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "2", "Screen Name...")

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "3", "Screen Name...")

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "4", "Screen Name...")

IniWrite(@ScriptDir & "\setup.ini", "Screen Names", "5", "Screen Name...")

IniWrite(@ScriptDir & "\setup.ini", "Message", "Message", "You Have Lost the Privilege to Use This")

Iniwrite(@ScriptDir & "\setup.ini", "Status", "1", _StringEncrypt(1, "not okay", "specht"))

EndFunc ;==>_default

Func _changepassword()

$oldpass = GUICtrlRead($Input8)

If $oldpass <> _StringEncrypt(0, $password, "specht") Then

MsgBox(48, "Incorrect Password", "The password you have " & @CRLF & "entered is incorrect.")

Else

$newpass = GUICtrlRead($Input9)

$newpassretype = GUICtrlRead($Input10)

If $newpass <> $newpassretype Then MsgBox(48, "Passwords do not match...", "The password you have " & @CRLF & "entered do not match.")

IniWrite(@ScriptDir & "\setup.ini", "Password", "1", _StringEncrypt(1, $newpass, "specht"))

Global $password = IniRead(@ScriptDir & "\setup.ini", "password", "1", "")

GUICtrlSetState($Label9, $GUI_show)

EndIf

EndFunc ;==>_changepassword

Edited by sccrstvn93

Share this post


Link to post
Share on other sites



Maybe Ctrl+Shift+F12

But this program is kinda cool.


[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]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thx for the feedback. i think i added messenger but i dont have it so im not sure if it works. Is there "messenger" in the title of the messenger window? I was thinking about using a hotkey. Wat keys should i use?

Edited by sccrstvn93

Share this post


Link to post
Share on other sites

alright i added the hotkey. Thx for the ideas.

Share this post


Link to post
Share on other sites

updated to v3

Share this post


Link to post
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
Sign in to follow this  
Followers 0