MCPcopy Create free account
hub / github.com/Adaptix-Framework/AdaptixC2 / encode_file

Method encode_file

AdaptixClient/Source/Client/AxScript/BridgeApp.cpp:749–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749QString BridgeApp::encode_file(const QString &algorithm, const QString &path, const QString &key) const
750{
751 QString filePath = path;
752 if (filePath.startsWith("~/"))
753 filePath = QDir::home().filePath(filePath.mid(2));
754
755 QFile file(filePath);
756 if (!file.open(QIODevice::ReadOnly))
757 return "";
758
759 QByteArray bytes = file.readAll();
760 file.close();
761
762 QString alg = algorithm.toLower();
763
764 if (alg == "hex")
765 return QString::fromLatin1(bytes.toHex());
766 if (alg == "base64")
767 return QString::fromLatin1(bytes.toBase64());
768 if (alg == "base32")
769 return QString::fromLatin1(encodeBase32(bytes));
770 if (alg == "zip")
771 return QString::fromLatin1(qCompress(bytes).toBase64());
772 if (alg == "xor")
773 return QString::fromLatin1(applyXor(bytes, key.toUtf8()).toBase64());
774
775 return QString::fromLatin1(bytes.toBase64());
776}
777
778QString BridgeApp::decode_file(const QString &algorithm, const QString &path, const QString &key) const
779{

Callers

nothing calls this directly

Calls 6

encodeBase32Function · 0.85
applyXorFunction · 0.85
startsWithMethod · 0.80
midMethod · 0.80
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected