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

Method decode_file

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

Source from the content-addressed store, hash-verified

776}
777
778QString BridgeApp::decode_file(const QString &algorithm, const QString &path, const QString &key) const
779{
780 QString filePath = path;
781 if (filePath.startsWith("~/"))
782 filePath = QDir::home().filePath(filePath.mid(2));
783
784 QFile file(filePath);
785 if (!file.open(QIODevice::ReadOnly))
786 return "";
787
788 QByteArray encodedBytes = file.readAll();
789 file.close();
790
791 QString alg = algorithm.toLower();
792
793 if (alg == "hex")
794 return QString::fromLatin1(QByteArray::fromHex(encodedBytes).toBase64());
795 if (alg == "base64")
796 return QString::fromLatin1(QByteArray::fromBase64(encodedBytes).toBase64());
797 if (alg == "base32")
798 return QString::fromLatin1(decodeBase32(encodedBytes).toBase64());
799 if (alg == "zip")
800 return QString::fromLatin1(qUncompress(QByteArray::fromBase64(encodedBytes)).toBase64());
801 if (alg == "xor")
802 return QString::fromLatin1(applyXor(QByteArray::fromBase64(encodedBytes), key.toUtf8()).toBase64());
803
804 return QString::fromLatin1(encodedBytes.toBase64());
805}
806
807// Code conversion
808

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected