MCPcopy Create free account
hub / github.com/ReversecLabs/C3 / WriteMessageToFile

Method WriteMessageToFile

Src/Common/FSecure/Dropbox/DropboxApi.cpp:42–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void FSecure::Dropbox::WriteMessageToFile(std::string const& direction, ByteView data, std::string const& providedFilename)
43{
44 std::string url = OBF_STR("https://content.dropboxapi.com/2/files/upload");
45
46 std::string filename;
47
48 if (providedFilename.empty())
49 {
50 ///Create a filename thats prefixed with message direction and suffixed
51 // with more granular timestamp for querying later
52 std::string ts = std::to_string(FSecure::Utils::TimeSinceEpoch());
53 filename = direction + OBF("-") + FSecure::Utils::GenerateRandomString(10) + OBF("-") + ts;
54 }
55 else
56 filename = providedFilename;
57
58 json j;
59 j[OBF("path")] = OBF("/") + this->m_Channel + OBF("/") + filename;
60 j[OBF("mode")] = OBF("add");
61 j[OBF("autorename")] = false;
62 j[OBF("mute")] = true;
63 j[OBF("strict_conflict")] = true;
64
65 SendHttpRequest(url, j.dump(), ContentType::ApplicationOctetstream, data);
66}
67
68void FSecure::Dropbox::UploadFile(std::string const& path)
69{

Callers 3

OnSendToChannelMethod · 0.45
OnSendToChannelMethod · 0.45
OnSendToChannelMethod · 0.45

Calls 5

TimeSinceEpochFunction · 0.85
GenerateRandomStringFunction · 0.85
dumpMethod · 0.80
to_stringFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected