Hack Forums
[.NET] Application/Process Blocker - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Application/Process Blocker (/showthread.php?tid=3248814)

Pages: Pages 1 2


Application/Process Blocker - Networkmancer - Feb 10, 2013

I think no one posted this simple way of blocking application in windows so Ill share mine.

Top most
Code
Imports Microsoft.Win32

To call
Disable Application
Code
appcontrol(True, yourblockprocessnameSTRING)

Enable Disabled Application
Code
appcontrol(False, yourblockprocessnameSTRING)

Code
Shared Sub appcontrol(accessFlag, exename)
  If accessFlag = True Then
    'adding to registry start
    Try

    Dim CU As Microsoft.Win32.RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", True)

    If CU Is Nothing Then
    CU = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)
    CU.SetValue("DisallowRun", 1, RegistryValueKind.DWord)
    CU.CreateSubKey("DisallowRun")
    CU = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", True)
    CU.SetValue(exename, exename & ".exe", RegistryValueKind.String)
    CU = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)
    MsgBox("Successfully Restricted " & exename & ".", MsgBoxStyle.Information)

    Else
    CU = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)
    CU.SetValue("DisallowRun", 1, RegistryValueKind.DWord)
    CU = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", True)
    CU.SetValue(exename, exename & ".exe", RegistryValueKind.String)
    MsgBox("Successfully Restricted " & exename & ".", MsgBoxStyle.Information)

    End If

    Catch ex As Exception

    MsgBox("Error writing the registry" & vbNewLine & "Please use windows admin account", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical)
    End Try
    'end

  Else : accessFlag = False

    Try
    Dim CU As Microsoft.Win32.RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun", True)
    CU.DeleteValue(exename)
    MsgBox("Successfully Allowed " & exename & ".", MsgBoxStyle.Information)

    Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical)

    End Try

  End If

    End Sub

If you want to use open file dialog box
Code
Private Sub OpenFileDialogBox1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialogBox1.FileOk
  Try
    path = ApplicationExplore.FileName.ToString()
    exename = System.IO.Path.GetFileName(path)
  Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical)
  End Try
    End Sub



* - MƸrĿîɳ - Feb 10, 2013

Very simple tutorial, but thanks for this, sure it will help out the noobs.

I like the usage of the registry, instead of the garbage startup folder.


* - Networkmancer - Feb 10, 2013

Yeah, Just simple quick and easy tutorial for newbies etc.


* - benz_vasu - Feb 11, 2013

thanx great one bro .... thanks you :)bro itz nice and easy to learn


* - Networkmancer - Feb 11, 2013

Glad to help you out there. No problem.


* - AX5 - Feb 11, 2013

great work man, any ideas on how to block site or grab the sites from a webb browser ?


* - C3ol - Feb 11, 2013

^^ to block site use host file editing


* - Networkmancer - Feb 11, 2013

(Feb 11, 2013 09:58 AM)AX5 Wrote:  great work man, any ideas on how to block site or grab the sites from a webb browser ?

https://hackforums.net/showthread.php?tid=153044

Get Firefox URL. Because of you I posted this thread :)

https://hackforums.net/showthread.php?tid=3250728


* - AnonymousSeeker - Feb 11, 2013

Nice small tut dude. Good work keep it up.


* - AX5 - Feb 12, 2013

(Feb 11, 2013 10:55 AM)Networkmancer Wrote:  https://hackforums.net/showthread.php?tid=153044

Get Firefox URL. Because of you I posted this thread :)

https://hackforums.net/showthread.php?tid=3250728

nice one mate good job, is there a way for ie and chrome to ?


* - Networkmancer - Feb 26, 2013

IE is simple. I found chrome but was outdated because of chromes update.


* - Anon?M ID - Feb 26, 2013

nice tutorial man c:

thanks for the share. it's really useful. i will use this on my project in future



* - Dereshi - Feb 26, 2013

Thanks a lot man.
Hope you will make more tutorials, that's realy usefull.


* - Networkmancer - Mar 23, 2015

Post revived :D for reference and to help other folks out there.


* - psychadelic - Mar 24, 2015

Nice job man, looks pretty sweet 🤝