From 973351eb274b037b6c3351a9426d0270b696f9ae Mon Sep 17 00:00:00 2001 From: Madpeter Date: Thu, 7 May 2020 13:01:14 +0100 Subject: [PATCH] Removes the under cooked HTTP C&C service (It did nothing and i hate it now) --- CLI/CliDocker.cs | 9 +---- CLI/CliHardware.cs | 9 +---- CLI/HttpCnC.cs | 39 ------------------- CLI/HttpServer/control/Service/LoginBot.cs | 28 ------------- CLI/HttpServer/control/Service/ShutdownCNC.cs | 22 ----------- 5 files changed, 2 insertions(+), 105 deletions(-) delete mode 100644 CLI/HttpCnC.cs delete mode 100644 CLI/HttpServer/control/Service/LoginBot.cs delete mode 100644 CLI/HttpServer/control/Service/ShutdownCNC.cs diff --git a/CLI/CliDocker.cs b/CLI/CliDocker.cs index 2087c24..8560801 100644 --- a/CLI/CliDocker.cs +++ b/CLI/CliDocker.cs @@ -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); } } } diff --git a/CLI/CliHardware.cs b/CLI/CliHardware.cs index 3fb7b44..516533d 100644 --- a/CLI/CliHardware.cs +++ b/CLI/CliHardware.cs @@ -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); } } } diff --git a/CLI/HttpCnC.cs b/CLI/HttpCnC.cs deleted file mode 100644 index 13746cd..0000000 --- a/CLI/HttpCnC.cs +++ /dev/null @@ -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(); - } - } - } -} diff --git a/CLI/HttpServer/control/Service/LoginBot.cs b/CLI/HttpServer/control/Service/LoginBot.cs deleted file mode 100644 index f3f74da..0000000 --- a/CLI/HttpServer/control/Service/LoginBot.cs +++ /dev/null @@ -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]
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"); - } - } -} diff --git a/CLI/HttpServer/control/Service/ShutdownCNC.cs b/CLI/HttpServer/control/Service/ShutdownCNC.cs deleted file mode 100644 index 936c1e5..0000000 --- a/CLI/HttpServer/control/Service/ShutdownCNC.cs +++ /dev/null @@ -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]
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"); - } - } -}