Removes the under cooked HTTP C&C service (It did nothing and i hate it now)
This commit is contained in:
parent
450fe8d317
commit
973351eb27
5 changed files with 2 additions and 105 deletions
|
|
@ -17,14 +17,7 @@ namespace BetterSecondBot
|
|||
ConsoleLog.Status("-> Getting config from Docker");
|
||||
JsonConfig Config = MakeJsonConfig.FromENV();
|
||||
Config = MakeJsonConfig.http_config_check(Config);
|
||||
if (Config.HttpAsCnC == true)
|
||||
{
|
||||
new HttpCnC(Config);
|
||||
}
|
||||
else
|
||||
{
|
||||
new CliExitOnLogout(Config);
|
||||
}
|
||||
new CliExitOnLogout(Config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,14 +77,7 @@ namespace BetterSecondBot
|
|||
if(ok_to_try_start == true)
|
||||
{
|
||||
Config = MakeJsonConfig.http_config_check(Config);
|
||||
if (Config.HttpAsCnC == true)
|
||||
{
|
||||
new HttpCnC(Config);
|
||||
}
|
||||
else
|
||||
{
|
||||
new CliExitOnLogout(Config);
|
||||
}
|
||||
new CliExitOnLogout(Config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
using BetterSecondBot.HttpServer;
|
||||
using BetterSecondBotShared.Json;
|
||||
using BetterSecondBotShared.logs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace BetterSecondBot
|
||||
{
|
||||
class HttpCnC
|
||||
{
|
||||
protected SecondBotHttpServer my_http_server;
|
||||
public HttpCnC(JsonConfig BotConfig)
|
||||
{
|
||||
ConsoleLog.Status("Mode: HTTP C&C");
|
||||
my_http_server = new SecondBotHttpServer();
|
||||
my_http_server.HTTPCnCmode = true;
|
||||
my_http_server.ShutdownHTTP = false;
|
||||
my_http_server.StartHttpServer(BotConfig);
|
||||
string last_cnc_status = "";
|
||||
while (my_http_server.ShutdownHTTP == false)
|
||||
{
|
||||
string NewStatusMessage = my_http_server.GetStatus();
|
||||
if (NewStatusMessage != last_cnc_status)
|
||||
{
|
||||
last_cnc_status = NewStatusMessage;
|
||||
ConsoleLog.Status(last_cnc_status);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
ConsoleLog.Status("Shutting down now");
|
||||
if (my_http_server.GetBot != null)
|
||||
{
|
||||
my_http_server.GetBot.GetClient.Network.Logout();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using BSB.bottypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using static BetterSecondBot.Program;
|
||||
|
||||
namespace BetterSecondBot.HttpServer.Control.CNC
|
||||
{
|
||||
public class CNCStartBot : HTTP_commands_post
|
||||
{
|
||||
public override string Helpfile { get { return "[C&C Mode only]<br/>Starts bot"; } }
|
||||
public override string[] CallFunction(string[] args)
|
||||
{
|
||||
if (httpserver.HTTPCnCmode == true)
|
||||
{
|
||||
if (bot == null)
|
||||
{
|
||||
httpserver.NewBot();
|
||||
httpserver.GetBot.Setup(httpserver.GetConfig, AssemblyInfo.GetGitHash());
|
||||
httpserver.GetBot.Start();
|
||||
return new [] { "OK","Starting bot now" };
|
||||
}
|
||||
return Failed("Unable to Login the bot (it might already be running)");
|
||||
}
|
||||
return Failed("Not running as CNC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using BSB.bottypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using static BetterSecondBot.Program;
|
||||
|
||||
namespace BetterSecondBot.HttpServer.Control.CNC
|
||||
{
|
||||
public class ShutdownCNC : HTTP_commands_post
|
||||
{
|
||||
public override string Helpfile { get { return "[C&C Mode only]<br/>Shutsdown the C&C process"; } }
|
||||
public override string[] CallFunction(string[] args)
|
||||
{
|
||||
if (httpserver.HTTPCnCmode == true)
|
||||
{
|
||||
httpserver.ShutdownHTTP = true;
|
||||
return new [] { "OK", "Shutting down" };
|
||||
}
|
||||
return Failed("Not running as CNC");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue