How to create an invisible or protected process?

Just starting out? Need help? Post your questions and find answers here.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

And what do you expect them to do if they actually need to terminate it (because it's hanging or something)?
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

Trond wrote:And what do you expect them to do if they actually need to terminate it (because it's hanging or something)?
It will exists a "shutdown" procedure from inside the main application.
Regards.

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
ThorstenD
New User
New User
Posts: 8
Joined: Fri Mar 27, 2009 8:48 am

Post by ThorstenD »

Try to convert it to pb 8)

Code: Select all

#define _WIN32_WINNT 0x0500

#include <windows.h>
#include <sddl.h>
#include <accctrl.h>
#include <stdio.h>
#include <conio.h>
#include <aclapi.h>

BOOL ProtectProcess(HANDLE hProcess);

void main(void)
{
	HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());

	ProtectProcess(hProc);

	printf("SetProcessDacl - Keep a process from being closed by other applications.\nDeveloped by ANUBIS");

	while(TRUE)
	{
		Sleep(100);
	}

}

BOOL ProtectProcess(HANDLE hProcess)
{
	SECURITY_ATTRIBUTES sa;

	sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	sa.bInheritHandle = FALSE;

	if (!ConvertStringSecurityDescriptorToSecurityDescriptor("D:P", SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL))
		return FALSE;

	if (!SetKernelObjectSecurity(hProcess, DACL_SECURITY_INFORMATION, sa.lpSecurityDescriptor))
		return FALSE;

	return TRUE;

}
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

ThorstenD wrote:Try to convert it to pb 8)
Thank you, but unfortunately my C knowledge is limited :(
Regards

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

thanos wrote:
Trond wrote:And what do you expect them to do if they actually need to terminate it (because it's hanging or something)?
It will exists a "shutdown" procedure from inside the main application.
Regards.

Thanos
Yes, but if something goes wrong and the program "stops responding"?
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

Trond wrote:
thanos wrote:
Trond wrote:And what do you expect them to do if they actually need to terminate it (because it's hanging or something)?
It will exists a "shutdown" procedure from inside the main application.
Regards.

Thanos
Yes, but if something goes wrong and the program "stops responding"?
A very good question!
But, i will take this risk.
Regards.

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> i will take this risk.

make sure to properly inform your customers, to enable them to decide if they want to take this risk...
oh... and have a nice day.
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

Kaeru Gaman wrote:> i will take this risk.

make sure to properly inform your customers, to enable them to decide if they want to take this risk...
Indeed!
If someone knows the way to run a protected process please post.
Regards

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

i did something so far (convert the c code below)
but it did not work here (XP) .
Don't know what goes wrong here,
perhaps someone can help..

Code: Select all

Lib=OpenLibrary(#PB_Any,"advapi32.dll")
If Lib
 Prototype.l ProtoConvertStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor.s,StringSDRevision.l,SecurityDescriptor.l,SecurityDescriptorSize.l)
 
 ConvertStringSecurityDescriptorToSecurityDescriptor.ProtoConvertStringSecurityDescriptorToSecurityDescriptor

  ;If Ansi
 ConvertStringSecurityDescriptorToSecurityDescriptor=GetFunction(lib,"ConvertStringSecurityDescriptorToSecurityDescriptorA")

   ;If UniCode
 ;ConvertStringSecurityDescriptorToSecurityDescriptor=GetFunction(lib,"ConvertStringSecurityDescriptorToSecurityDescriptorW")
   
 
 #SDDL_REVISION_1=1
 #DACL_SECURITY_INFORMATION = 4
 
 If ConvertStringSecurityDescriptorToSecurityDescriptor
  hProc = OpenProcess_(#PROCESS_ALL_ACCESS, #False, GetCurrentProcessId_())
  Debug hproc
  If hproc 
   sa.SECURITY_ATTRIBUTES 
   sa\nLength = SizeOf(SECURITY_ATTRIBUTES)
   sa\bInheritHandle = #False 
   sec.s
   sec="D:P"
   
   Result=ConvertStringSecurityDescriptorToSecurityDescriptor(sec, #SDDL_REVISION_1, @sa\lpSecurityDescriptor, 0)
   ;Debug L1
   Debug Result
   If Result
    Debug @sa\lpSecurityDescriptor
    Debug sa\lpSecurityDescriptor
    Result=SetKernelObjectSecurity_(hProc, #DACL_SECURITY_INFORMATION, sa\lpSecurityDescriptor)
    Debug Result
    If Result
     MessageRequester("info","open Taskmanager And kill me",0)
    
    EndIf
   
   EndIf
   Debug "ending normally..:"
   CloseHandle_(hproc)
  EndIf
 EndIf
 CloseLibrary(Lib)
EndIf
 
SPAMINATOR NR.1
ThorstenD
New User
New User
Posts: 8
Joined: Fri Mar 27, 2009 8:48 am

Post by ThorstenD »

Rings wrote:i did something so far (convert the c code below)
but it did not work here (XP) .
Don't know what goes wrong here,
perhaps someone can help..
I has the same problem. Compieled with Pelles C it's works on my XP. The full source can be dl from here.
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

ThorstenD wrote:
Rings wrote:i did something so far (convert the c code below)
but it did not work here (XP) .
Don't know what goes wrong here,
perhaps someone can help..
I has the same problem. Compieled with Pelles C it's works on my XP. The full source can be dl from here.
I faced the same problem with Rings on Xp.
I downloaded and compiled the C code with PellesC but the process was not protected. I killed it with Process Explorer easily on my XP sp3.
Regards.

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Comments1
New User
New User
Posts: 1
Joined: Sun Nov 20, 2011 4:42 pm

Re: How to create an invisible or protected process?

Post by Comments1 »

I'm playing around with this code right now and found out it doesnt work on my 64bit system
What may cause this and is it possible to work on bot 32/64 bit systems?
Post Reply