Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <fstream>
  4. #include <iostream>
  5. using namespace std;
  6. typedef __int32 int32;
  7. typedef unsigned __int32 uint32;
  8. typedef __int64 int64;
  9. typedef unsigned __int64 uint64;
  10. int Q_strlen(char *str);
  11. unsigned int RSHash(const char *str);
  12.  
  13. uint64 GEUTIL_GetUniqueSkinData(int steamhash);
  14. void GEUTIL_WriteUniqueSkinData(uint64 value, int steamhash);
  15.  
  16. int main()
  17. {
  18. cout << "..%%%%....%%%%...%%......%%%%%...%%%%%%..%%..%%..%%%%%%..%%..%%..%%%%%%...................%%%%....%%%%...%%..%%..%%%%%....%%%%...%%%%%%." << endl;
  19. cout << ".%%......%%..%%..%%......%%..%%..%%......%%%.%%..%%.......%%%%...%%........%%............%%......%%..%%..%%..%%..%%..%%..%%..%%..%%....." << endl;
  20. cout << ".%%.%%%..%%..%%..%%......%%..%%..%%%%....%%.%%%..%%%%......%%....%%%%.....................%%%%...%%..%%..%%..%%..%%%%%...%%......%%%%..." << endl;
  21. cout << ".%%..%%..%%..%%..%%......%%..%%..%%......%%..%%..%%........%%....%%........%%................%%..%%..%%..%%..%%..%%..%%..%%..%%..%%....." << endl;
  22. cout << "..%%%%....%%%%...%%%%%%..%%%%%...%%%%%%..%%..%%..%%%%%%....%%....%%%%%%...................%%%%....%%%%....%%%%...%%..%%...%%%%...%%%%%%." << endl;
  23. cout << "........................................................................................................................................" << endl;
  24. printf("\n\n");
  25. printf(" Weapon Skin File Creator - Mangled by: Null");
  26. printf("\n\n\n\n");
  27.  
  28. const char *steamid = "STEAM_0:1:13018482";
  29. printf("Current steamid: [%s]\n", steamid);
  30.  
  31. //int hashed_steamid = ((RSHash(steamid + 8)));
  32. //int hashed_steamid = 4075811109;
  33. int hashed_steamid = 4294967295;
  34. uint64 skincode = 0;
  35. skincode |= 64; // Black DD44
  36. //skincode |= 128; // Ivory DD44
  37. //skincode |= 4096; // Black Magnum
  38. //skincode |= 16777216; // Rusty ZMG
  39. printf("weapon skincode value: [%d]\n\n", skincode);
  40.  
  41. GEUTIL_WriteUniqueSkinData(skincode, hashed_steamid);
  42. uint64 origbits = GEUTIL_GetUniqueSkinData(hashed_steamid); //returns weaponskin code from file.
  43. }
  44.  
  45. //write gesdata.txt file to current directory.
  46. void GEUTIL_WriteUniqueSkinData(uint64 skincode, int steamhash)
  47. {
  48. uint64 bits = 0;
  49. for (int i = 0; i < 32; i++)
  50. {
  51. bits = bits | skincode & (3 << (i * 2));
  52. }
  53.  
  54. ofstream file("gesdata.txt", ios::binary);
  55. if (file)
  56. {
  57. char writevalue[16], hashvalue[8], garbagevalue[8], mixedvalue[32];
  58.  
  59. for (int i = 0; i < 16; i++) {
  60. writevalue[i] = ((bits >> (i * 4)) & 15) + i + 32;
  61. }
  62. for (int i = 0; i < 8; i++) {
  63. hashvalue[i] = ((steamhash >> (i * 4)) & 15) + i + 32;
  64. }
  65. for (int i = 0; i < 8; i++) {
  66. garbagevalue[i] = (((steamhash*steamhash - 398 * 28) >> (i * 4)) & 15) + 32;
  67. }
  68. for (int i = 0; i < 32; i++)
  69. {
  70. if (i % 2 == 0)
  71. mixedvalue[i] = writevalue[(int)(i / 2)];
  72. else if ((i - 1) % 4 == 0)
  73. mixedvalue[i] = hashvalue[(int)((i - 1) / 4)];
  74. else if (i == 31)
  75. mixedvalue[i] = '\0';
  76. else
  77. mixedvalue[i] = garbagevalue[(int)((i + 1) / 4)];
  78. }
  79. file.write(mixedvalue, strlen(mixedvalue));
  80. file.close();
  81. }
  82. }
  83.  
  84. //read gesdata.txt file from current directory
  85. uint64 GEUTIL_GetUniqueSkinData(int hashed_steamid)
  86. {
  87. uint64 value = 0;
  88. FILE *file1;
  89. file1 = fopen("gesdata.txt", "r");
  90.  
  91. if (file1)
  92. {
  93. char mixedvalue[32], writevalue[16], hashvalue[8];
  94. int filehash = 0;
  95. fgets(mixedvalue, sizeof(mixedvalue), (FILE*)file1);
  96. fclose(file1);
  97.  
  98. for (int i = 0; i < 32; i++)
  99. {
  100. if (i % 2 == 0) {
  101. writevalue[(int)(i / 2)] = mixedvalue[i];
  102. }
  103. else if ((i - 1) % 4 == 0) {
  104. hashvalue[(int)((i - 1) / 4)] = mixedvalue[i];
  105. }
  106. }
  107.  
  108. for (int i = 0; i < 8; i++) {
  109. filehash += (hashvalue[i] - i - 32) << (i * 4);
  110. }
  111. if (filehash != hashed_steamid)
  112. {
  113. printf("\nInvalid gesdata.txt!\nhashed_steamid from file != hashed_steamid\n", filehash);
  114. }
  115.  
  116. for (int i = 0; i < 16; i++) {
  117. value += (writevalue[i] - i - 32) << (i * 4);
  118. }
  119. printf("hash_steamid from file: [%u64]\n", filehash);
  120. }
  121. printf("hashed_steamid: [%u64]\n\n\n\n", hashed_steamid);
  122. return value; //weapon skin value
  123. }
  124.  
  125. static inline int Q_strlen(const char *str)
  126. {
  127. if (!str)
  128. return 0;
  129. return strlen(str);
  130. }
  131.  
  132. //Hash steamid
  133. unsigned int RSHash(const char *str)
  134. {
  135. unsigned int b = 378551;
  136. unsigned int a = 63689;
  137. unsigned int hash = 0;
  138.  
  139. for (size_t i = 0; i < (size_t)Q_strlen(str); i++)
  140. {
  141. hash = hash * a + str[i];
  142. a = a * b;
  143. }
  144. return hash;
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement