Skip to content

Commit

Permalink
Merge pull request ION28#83 from ION28/develop
Browse files Browse the repository at this point in the history
Merge bugfix from Develop to Master for Alpha Release ION28#3
  • Loading branch information
ION28 authored Aug 9, 2019
2 parents eac21c0 + d731ca0 commit d1bfd22
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 337 deletions.
9 changes: 6 additions & 3 deletions BLUESPAWN/BLUESPAWN/BLUESPAWN.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\banners.cpp" />
<ClCompile Include="src\banners.cpp">
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<ClCompile Include="src\BLUESPAWN.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -176,7 +179,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
Expand All @@ -197,7 +200,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
Expand Down
36 changes: 8 additions & 28 deletions BLUESPAWN/BLUESPAWN/src/BLUESPAWN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,13 @@ int main(int argc, char* argv[])

print_banner();

HuntRegister record{};
Hunts::HuntT1004 t1004(record);
Hunts::HuntT1037 t1037(record);
Hunts::HuntT1060 t1060(record);
Hunts::HuntT1100 t1100(record);
Hunts::HuntT1101 t1101(record);
Hunts::HuntT1103 t1103(record);
Hunts::HuntT1131 t1131(record);
Hunts::HuntT1138 t1138(record);
Hunts::HuntT1182 t1182(record);

DWORD tactics = UINT_MAX;
DWORD dataSources = UINT_MAX;
DWORD affectedThings = UINT_MAX;
Scope scope{};
Reaction* reaction = new Reactions::LogReaction();
record.RunHunts(tactics, dataSources, affectedThings, scope, Aggressiveness::Cursory, reaction);


cxxopts::Options options("BLUESPAWN.exe", "BLUESPAWN: A Windows based Active Defense Tool to empower Blue Teams");

options.add_options()
("h,hunt", "Perform a Hunt Operation", cxxopts::value<bool>())
("help", "Help Information. You can also specify a category for help on a specific module such as hunt"
, cxxopts::value<std::string>()->implicit_value("general"))
("example", "Perform the example hunt")
("example", "Perform the example hunt")
;

options.add_options("hunt")
Expand All @@ -53,25 +34,24 @@ int main(int argc, char* argv[])
dispatch_hunt(result, options);
}
else {
std::cout << "Nothing to do. Use the -h or --hunt flags to launch a hunt" << std::endl;
LOG_ERROR("Nothing to do. Use the -h or --hunt flags to launch a hunt");
}
}

void print_help(cxxopts::ParseResult result, cxxopts::Options options) {
std::string help_category = result["help"].as < std::string >();
std::cout << result["help"].as < std::string >() << std::endl;

std::transform(help_category.begin(), help_category.end(),
help_category.begin(), [](unsigned char c) { return std::tolower(c); });

if (help_category.compare("hunt") == 0) {
std::cout << options.help({ "hunt" }) << std::endl;
LOG_INFO(options.help({ "hunt" }));
}
else if (help_category.compare("general") == 0) {
std::cout << options.help() << std::endl;
LOG_INFO(options.help());
}
else {
std::cerr << "Unknown help category" << std::endl;
LOG_ERROR("Unknown help category");
}
}

Expand All @@ -82,8 +62,8 @@ void dispatch_hunt(cxxopts::ParseResult result, cxxopts::Options options) {
try {
sHuntLevelFlag = result["level"].as < std::string >();
}
catch(int e){
std::cerr << "Error " << e << " - Unknown hunt level. Please specify either Cursory, Moderate, Careful, or Aggressive" << std::endl;
catch (int e) {
LOG_ERROR("Error " << e << " - Unknown hunt level. Please specify either Cursory, Moderate, Careful, or Aggressive");
}
}
if (sHuntLevelFlag == "Cursory") {
Expand Down Expand Up @@ -114,7 +94,7 @@ void dispatch_hunt(cxxopts::ParseResult result, cxxopts::Options options) {
DWORD dataSources = UINT_MAX;
DWORD affectedThings = UINT_MAX;
Scope scope{};
Reaction* reaction = nullptr;
Reaction* reaction = new Reactions::LogReaction();
record.RunHunts(tactics, dataSources, affectedThings, scope, aHuntLevel, reaction);
}

Expand Down
8 changes: 3 additions & 5 deletions BLUESPAWN/BLUESPAWN/src/banners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <algorithm>
#include <time.h>

#include "logging/Log.h"

void print_banner() {
// Put these in a file, then include that file in the resources for the exe

Expand All @@ -16,9 +18,5 @@ void print_banner() {

srand(static_cast<unsigned int>(time(nullptr)));

/*
SetConsoleColor("cyan");
std::cout << banners.at(std::rand() % banners.size()) << std::endl;
SetConsoleColor("white");
*/
LOG_INFO(banners.at(std::rand() % banners.size()));
}
Loading

0 comments on commit d1bfd22

Please sign in to comment.