Simple crypter in c/cpp that encodes shellcode with 3 layers of obfuscation: xor, base64 and hexadecimal.
Once you insert the shellcode:
- First, given a custom base64 character set, the code takes 3 bytes at a time from the shellcode and turns it into 4 separate base64 characters, if the data isn't a multiple of 3, the last part won't fill up the full 3-byte array, if fewer than 3 bytes remain, the function ends it with
=characters to make it a multiple of 4. More precisely: the first 6 bits of the first byte are used for the first base64 character, the least significant 2 bits of the first byte and the 4 most significant bits of the second byte are used for the second base64 character, the least significant 4 bits of the second byte and the 2 most significant bits of the third byte are used for the third base64 character, and the least significant 6 bits of the third byte are used for the fourth base64 character. - Then we xor encrypt the shellcode with a given key;
- Finally the data converts each byte into its hexadecimal equivalent formatting every byte as a 2 character string.