MCPcopy Create free account
hub / github.com/S3N4T0R-0X0/PixelCode-Attack / decode

Method decode

payload.cpp:734–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732 }
733
734 static std::string decode(const std::string& encoded_string) {
735 int in_len = encoded_string.size();
736 int i = 0;
737 int j = 0;
738 int in_ = 0;
739 unsigned char char_array_4[4], char_array_3[3];
740 std::string ret;
741
742 while (in_len-- && (encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
743 char_array_4[i++] = encoded_string[in_]; in_++;
744 if (i == 4) {
745 for (i = 0; i < 4; i++)
746 char_array_4[i] = BASE64_CHARS.find(char_array_4[i]);
747
748 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
749 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
750 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
751
752 for (i = 0; (i < 3); i++)
753 ret += char_array_3[i];
754 i = 0;
755 }
756 }
757
758 if (i) {
759 for (j = i; j < 4; j++)
760 char_array_4[j] = 0;
761
762 for (j = 0; j < 4; j++)
763 char_array_4[j] = BASE64_CHARS.find(char_array_4[j]);
764
765 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
766 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
767 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
768
769 for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
770 }
771
772 return ret;
773 }
774};
775
776const std::string Base64::BASE64_CHARS =

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected