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

Function main

Src/ChannelLinter/ChannelLinterMain.cpp:6–42  ·  view source on GitHub ↗

Entry point of the application. @param argc number of program arguments. @param argv vector of program arguments.

Source from the content-addressed store, hash-verified

4/// @param argc number of program arguments.
5/// @param argv vector of program arguments.
6int main(int argc, char* argv[])
7try
8{
9 std::cout << "Custom Command and Control - Channel linter. BUILD: " << C3_BUILD_VERSION << std::endl;
10
11 using namespace FSecure;
12 C3::Linter::ArgumentParser argParser(argc, argv);
13 auto const& config = argParser.GetConfig();
14 if (config.m_ShowHelp)
15 {
16 std::cout << argParser.GetUsage() << std::endl;
17 return 0;
18 }
19
20 if (config.m_ListChannels)
21 {
22 auto const& channels = C3::InterfaceFactory::Instance().GetMap<C3::AbstractChannel>();
23 std::cout << "Registered channels: \n";
24 for (auto [hash, channelData] : channels)
25 std::cout << channelData.m_Name << '\n';
26 std::cout << std::flush;
27 return 0;
28 }
29
30 assert(config.m_ChannelName);
31 std::cout << "Channel: " << *config.m_ChannelName << std::endl;
32 auto channelLinter = C3::Linter::ChannelLinter(config);
33 std::cout << *config.m_ChannelName << "'s Capability json verified OK." << std::endl;
34
35 channelLinter.Process();
36 return 0;
37}
38catch (std::exception& e)
39{
40 std::cerr << e.what() << std::endl;
41 return 1;
42}

Callers

nothing calls this directly

Calls 4

ChannelLinterClass · 0.85
GetUsageMethod · 0.80
ProcessMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected