OldSchoolHack

Register / Login English

C++ - XorStr - Strings verstecken

By (15. May 2015)
Beschreibung
Diese Klasse ermöglicht es, Zeichenketten zu verstecken, damit diese nicht im fertigen Kompilat auftauchen. Hierdurch wird die statische Analyse erschwert und auch für manche AntiCheat Programme wird hierdurch das Auffinden eines Hacks erschwert.

Verwendet werden kann die Klasse z.B. so:
CPP Code:
  1. std::string var = /*OldSchoolHack*/XorStr(13, 0x27, 0x68CB43F4, 0x44CF48C8, 0x4BEF46C4, 0x4C000000);

Der Code kann automatisch generiert werden. Entweder auf dieser Only registered and activated users can see links. oder mit dem Visual Studio Plugin Only registered and activated users can see links..
  1. #include <windows.h>
  2. #include <string>
  3.  
  4. //create a dummy XorStr function for IntelliSense
  5. class XorStr;
  6. XorStr _xor_(const char *x);
  7.  
  8. class XorStr
  9. {
  10. public:
  11. XorStr(int length, int key, ...)
  12. {
  13. data.reserve(length);
  14.  
  15. int xor = key;
  16. int index = 0;
  17. int loops = length % 4 == 0 ? length / 4 : length / 4 + 1;
  18.  
  19. va_list vl;
  20. va_start(vl, key);
  21. for (int i = 0; i < loops; ++i)
  22. {
  23. int hash = va_arg(vl, int);
  24.  
  25. for (int j = 0; j < 4; j++)
  26. {
  27. WORD word = HIWORD(hash);
  28.  
  29. if (j >= 2)
  30. {
  31. word = LOWORD(hash);
  32. }
  33.  
  34. switch (j)
  35. {
  36. case 0:
  37. case 2:
  38. data += HIBYTE(word) ^ xor;
  39. break;
  40. case 1:
  41. case 3:
  42. data += LOBYTE(word) ^ xor;
  43. break;
  44. }
  45. xor += 127;
  46. xor %= 256;
  47.  
  48. ++index;
  49.  
  50. if (index >= length)
  51. {
  52. break;
  53. }
  54. }
  55. }
  56. va_end(vl);
  57. }
  58.  
  59. operator const std::string&() const
  60. {
  61. return data;
  62. }
  63.  
  64. friend bool operator==(const XorStr &lhs, const std::string &rhs);
  65. friend bool operator==(const std::string &lhs, const XorStr &rhs);
  66.  
  67. const char* c_str() const
  68. {
  69. return data.c_str();
  70. }
  71.  
  72. private:
  73. std::string data;
  74. };
  75.  
  76. inline bool operator==(const XorStr &lhs, const std::string &rhs)
  77. {
  78. return lhs.data == rhs;
  79. }
  80.  
  81. inline bool operator==(const std::string &lhs, const XorStr &rhs)
  82. {
  83. return lhs == rhs.data;
  84. }
Tags Tagged with: c++, string, xor, anticheat
post Wed 29. Aug 2007, 22:02
element
Avatar
endlich kann man auf deiner Page auch mal Spamen ^^
Rate post positiveRate post negative Quote
post Wed 29. Aug 2007, 22:08
higH...xD
Avatar
Quote
Original von element
endlich kann man auf deiner Page auch mal Spamen ^^
^_^
Rate post positiveRate post negative Quote
post Wed 29. Aug 2007, 22:13
KN4CK3R
Avatar
:schaden:
Rate post positiveRate post negative Quote
post Sun 13. Sep 2009, 18:53
Stefco
Avatar
Hej An alle netten Kollegen

Möchte mich somit einmal vorstellen, bin ein neue User wie man ja erkennen kann

freue mich auf die zusammen arbeit-und gutes gelingen

mfg Stefco
Rate post positiveRate post negative Quote
post Sun 13. Sep 2009, 23:40
xst
Avatar
Öhhm... neu hier und fäng an threads von 2007 zu bumpen ^^ :schaden:  :schaden:  :schaden:  :schaden:  :schaden:

naja herzlich willkommen
Rate post positiveRate post negative Quote
post Mon 11. Jan 2010, 12:17
--Black--
Avatar
Hi bin neu hier soll mich ma vorstelln 8) und wollt wissen wie ihr so ins neue gerutsch seid (!)
Rate post positiveRate post negative Quote
Write Comment