diff --git a/RTTIObfuscator.vcxproj b/RTTIObfuscator.vcxproj index 839098e..96f0e85 100644 --- a/RTTIObfuscator.vcxproj +++ b/RTTIObfuscator.vcxproj @@ -79,9 +79,10 @@ - + + diff --git a/RTTIObfuscator.vcxproj.filters b/RTTIObfuscator.vcxproj.filters index 32a8145..1d7b714 100644 --- a/RTTIObfuscator.vcxproj.filters +++ b/RTTIObfuscator.vcxproj.filters @@ -15,11 +15,12 @@ - - Source Files - + + - + + Source Files + \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 4283a93..d0dcfde 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,13 +6,14 @@ #include #include #include +#include #include #include using namespace std; -std::vector usedTypeNames; +std::unordered_set usedTypeNames; std::string getRandomString(const int len) { static const char alpha[] = @@ -80,9 +81,18 @@ int main(int argc, char* argv[]) auto prefix = m[1].str(); auto typeName = m[2].str(); - reverse(typeName.begin(), typeName.end()); + // generate the new type name for the current rtti entry + auto newTypeName = getRandomString(typeName.size()); - return "." + prefix + getRandomString(typeName.size()) + "@@"; + // get a new random name untill we have one we never used before + while (usedTypeNames.find(newTypeName) != usedTypeNames.end()) + { + newTypeName = getRandomString(typeName.size()); + } + + usedTypeNames.emplace(newTypeName); + + return "." + prefix + newTypeName + "@@"; }); // generate output path