Hack Forums
[.NET] Unclosable Program Snippets - 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] Unclosable Program Snippets (/showthread.php?tid=5567146)

Pages: Pages 1 2 3


Unclosable Program Snippets - Xogg - Mar 5, 2017

So this thread will show you a few snippets of code to make your applacation un-closable. So the first thing you will need to do is remove the "X" button on the app.
Code
Me.ControlBox = False


You also will need to remove it from the TaskBar, use the following code to do so.
Code
Me.ShowInTaskbar = False

From here we want to disable the task manager and CMD so the user can not close it like that. Use this code in a timer to do so 
Code
Try
           Dim p As Process
           For Each p In Process.GetProcesses
               If p.ProcessName = "taskmgr" Then
                   p.Kill()
               End If
                 If p.ProcessName = "cmd" Then
                    p.Kill()
                End If
           Next
       Catch ex As Exception

       End Try
   End Sub


Then we need to disable right click in our app use the following code to do so.
Code
Try

           Dim Registry As Object

           Registry = CreateObject("WScript.Shell")

           Registry.RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" & "\NoViewContextMenu", 0, "REG_DWORD")
       Catch
       End Try

Also no need to worry that will only disable in that app!  :)

Now there is one more thing we will do the be 100% sure that this is unclosable this will handle all other close methods. 
Code
   Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
       Dim i As Integer = 0
       If i = 0 Then
           If (e.CloseReason = CloseReason.UserClosing) Then
               e.Cancel = True
           End If
       End If
   End Sub



* - Zilog80 - Mar 5, 2017

Code
taskkill /f /im something.exe

Profit


* - Xogg - Mar 5, 2017

(Mar 5, 2017 11:04 AM)Zilog80 Wrote:  
Code
taskkill /f /im something.exe

Profit

Working on a fix

Fix has been found posting it now!


* - VmX5 - Mar 5, 2017

Process Hacker?

How about forcefully crashing the program?


* - Xogg - Mar 5, 2017

(Mar 5, 2017 11:19 AM)VmX5 Wrote:  Process Hacker?

How about forcefully crashing the program?

What do you mean forcefully crashing it?
Will look into Process hacker.


* - VmX5 - Mar 5, 2017

(Mar 5, 2017 11:20 AM)Dexuh Wrote:  What do you mean forcefully crashing it?
Will look into Process hacker.

Inject faulty code like 0 / 0


* - Zilog80 - Mar 5, 2017

(Mar 5, 2017 11:09 AM)Dexuh Wrote:  Working on a fix

Fix has been found posting it now!

The 'fix' is closing cmd? 😧

ComputerA: something.exe
ComputerB:

Code
taskkill /s {remote pc} /u {domain | username} /p {password} /PID {process id}

Profit

Read: https://blogs.technet.microsoft.com/chrad/2011/02/16/tasklist-taskkill-remote-machine-spinning-process-and-killing-that-runaway-process-2-steps/


* - VmX5 - Mar 5, 2017

Oh and on your cmd fix you can rename cmd and run it.


* - Barret - Mar 5, 2017

oh u silly kids ^^ this is so easy to omit, but keep trying :)


* - Zilog80 - Mar 5, 2017

For educational purposes only:

Spoiler (Click to View)

Try to 'terminate' an app with the above [ sp ] code...

Spoiler (Click to View)


* - zonne - Mar 5, 2017

This is easilly exploitable.


* - Xogg - Mar 5, 2017

(Mar 5, 2017 03:04 PM)Zilog80 Wrote:  For educational purposes only:

Spoiler (Click to View)

Try to 'terminate' an app with the above [ sp ] code...

Spoiler (Click to View)



Wanta do a conversion to VB for me? Lmfao


* - Ninja - Mar 5, 2017

Code
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
       Dim i As Integer = 1
       If i = 0 Then
           If (e.CloseReason = CloseReason.UserClosing) Then
               e.Cancel = True
           End If
       End If
   End Sub

How will i ever be 0?


* - Nick (Name) - Mar 6, 2017

Or how about making it a protected system process? Sounds like a much better way to make your process harder to kill, but not "unkillable" because there are ways of killing a process no matter what you do.


* - Ninja - Mar 6, 2017

(Mar 5, 2017 05:06 PM)Dexuh Wrote:  Wanta do a conversion to VB for me? Lmfao

oh boy...

[Image: 49837582.jpg]

In all seriousness, you should be able to read/understand C# code if you know VB.net. Even if you don't, you can just make a DLL and reference that.