CODE
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
* *
* File: Exekiller.c *
* *
* Purpose: a program to prevent other processes from running *
* *
* Usage: compile to Exekiller.exe and run it as: "Exekiller.exe <processname>" *
* *
* Copyright(C) 2004 White Scorpion,all rights reserved *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>
#include <windowsx.h>//used for the sleep function
int main(int argc,char *argv[])
{
if(argc!=2)
{
printf("/n/nExekiller - written by White Scorpion, 2004/n/n");
printf("This is a tool designed to prevent a process from starting./n");
printf("In reality it does start, but gets killed again within the second./n");
printf("This can be useful if you want to prevent your kids to start internet/n");
printf("or a game or something like that./n");
printf("The program runs in the backgound without any visible window, and/n");
printf("is easy to use. I hope this program will prove useful to someone;-)/n");
printf("/nUsage: Exekiller <PROCESSNAME>");
printf("/nExample: /"Exekiller iexplore.exe/", Internet Explorer won't start.");
printf("/nYou can kill Exekiller itself by pressing <CTRL>+<SHIFT>+<BACKSPACE>./n/n");
return EXIT_FAILURE;
}
int info,pid,exitcode,term;
long code;
HANDLE Snap,Process;
PROCESSENTRY32 proc32;
BOOL ServiceName;
HWND stealth;
stealth=FindWindowA("ConsoleWindowClass",NULL);//create stealth, window is not visible.
ShowWindow(stealth,0);
while(1)
{
sleep(200);
Snap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);/*take a snap of all processes*/
if(Snap==INVALID_HANDLE_VALUE)
{
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
if((GetAsyncKeyState(VK_BACK)==-32767)&&(GetAsyncKeyState(VK_SHIFT)==-32767)&&(GetAsyncKeyState(VK_CONTROL)==-32767))
{//if <ctrl>+<shift>+<backspace>
ShowWindow(stealth,1);
return EXIT_SUCCESS;//exit normally
}
proc32.dwSize=sizeof(PROCESSENTRY32); /*set size of structure*/
while((Process32Next(Snap,&proc32))==TRUE)/*while we haven't reached the final process*/
{
if(strcmp(proc32.szExeFile,argv[1])==0)
{
pid=proc32.th32ProcessID;
Process=OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,pid);/*obtain a handle to the process*/
if(Process==NULL)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
exitcode=GetExitCodeProcess(Process,&code);/*get the exitcode from the process*/
if(exitcode==0)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
Process=OpenProcess(PROCESS_TERMINATE,FALSE,pid);/*see if we have terminate rights*/
if(Process==NULL)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
term=TerminateProcess(Process,code);/*terminate the process*/
if (term==0)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
/*all went fine, process is killed*/
//CloseHandle(Process);
}
}
}
}
* *
* File: Exekiller.c *
* *
* Purpose: a program to prevent other processes from running *
* *
* Usage: compile to Exekiller.exe and run it as: "Exekiller.exe <processname>" *
* *
* Copyright(C) 2004 White Scorpion,all rights reserved *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>
#include <windowsx.h>//used for the sleep function
int main(int argc,char *argv[])
{
if(argc!=2)
{
printf("/n/nExekiller - written by White Scorpion, 2004/n/n");
printf("This is a tool designed to prevent a process from starting./n");
printf("In reality it does start, but gets killed again within the second./n");
printf("This can be useful if you want to prevent your kids to start internet/n");
printf("or a game or something like that./n");
printf("The program runs in the backgound without any visible window, and/n");
printf("is easy to use. I hope this program will prove useful to someone;-)/n");
printf("/nUsage: Exekiller <PROCESSNAME>");
printf("/nExample: /"Exekiller iexplore.exe/", Internet Explorer won't start.");
printf("/nYou can kill Exekiller itself by pressing <CTRL>+<SHIFT>+<BACKSPACE>./n/n");
return EXIT_FAILURE;
}
int info,pid,exitcode,term;
long code;
HANDLE Snap,Process;
PROCESSENTRY32 proc32;
BOOL ServiceName;
HWND stealth;
stealth=FindWindowA("ConsoleWindowClass",NULL);//create stealth, window is not visible.
ShowWindow(stealth,0);
while(1)
{
sleep(200);
Snap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);/*take a snap of all processes*/
if(Snap==INVALID_HANDLE_VALUE)
{
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
if((GetAsyncKeyState(VK_BACK)==-32767)&&(GetAsyncKeyState(VK_SHIFT)==-32767)&&(GetAsyncKeyState(VK_CONTROL)==-32767))
{//if <ctrl>+<shift>+<backspace>
ShowWindow(stealth,1);
return EXIT_SUCCESS;//exit normally
}
proc32.dwSize=sizeof(PROCESSENTRY32); /*set size of structure*/
while((Process32Next(Snap,&proc32))==TRUE)/*while we haven't reached the final process*/
{
if(strcmp(proc32.szExeFile,argv[1])==0)
{
pid=proc32.th32ProcessID;
Process=OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,pid);/*obtain a handle to the process*/
if(Process==NULL)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
exitcode=GetExitCodeProcess(Process,&code);/*get the exitcode from the process*/
if(exitcode==0)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
Process=OpenProcess(PROCESS_TERMINATE,FALSE,pid);/*see if we have terminate rights*/
if(Process==NULL)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
term=TerminateProcess(Process,code);/*terminate the process*/
if (term==0)
{
CloseHandle(Process);
ShowWindow(stealth,1);
return EXIT_FAILURE;
}
/*all went fine, process is killed*/
//CloseHandle(Process);
}
}
}
}