Created
October 11, 2019 10:57
-
-
Save ISSOtm/e95642d58205ca7933bb0c13e079b0a8 to your computer and use it in GitHub Desktop.
Reassemble a fragmented string for obfuscation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename Ts...> | |
char * reassembleString(Ts... ts) { | |
char * fragments[]{ts...}; | |
size_t size = 0; | |
for(size_t i = 0; i < sizeof...(Ts); i++) { | |
size += strlen(fragments[i]); | |
} | |
char * output = new char[size + 1]; | |
char * ptr = output; | |
for(size_t i = 0; i < sizeof...(Ts); i++) { | |
strcpy(ptr, fragments[i]); | |
ptr += strlen(fragments[i]); | |
} | |
return output; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename Ts...> | |
char * reassembleString(Ts... ts) { | |
return strdup((std::string(ts) + ...).c_str()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment