static async Task Main(string[] args) { if (args.Length < 1) { displayHelp(); Environment.Exit(0); } HttpClientHandler clientHandler = new HttpClientHandler { ServerCertificateCustomValidationCallback = (sender, cert, chain, errors) => { return(true); } }; TokenCredentials creds = null; string accessToken = ""; string covenantURL = args[0]; switch (args.Length) { case 0: displayHelp(); break; case 1: covenantURL = args[0]; Common.TestConnection(covenantURL); Console.WriteLine("[!] No Access Token Provided. Getting Token."); Console.Write("[!] Enter your Username: "******"", Password = "" }, clientHandler); CovenantUserLoginResult result = covenantConnection.Login(new CovenantUserLogin { UserName = username, Password = Common.ConvertToUnsecureString(password) }); if (result.Success ?? default) { Console.WriteLine("[+] Access Token Received!"); accessToken = result.CovenantToken; creds = new TokenCredentials(accessToken); //CovenantAPI _client = new CovenantAPI( covenantConnection = new CovenantAPI( new Uri(covenantURL), creds, clientHandler ); curUser = covenantConnection.GetCurrentUser(); } else { Console.WriteLine("[!] Failed to Connect to Covenant"); } break; case 2: covenantURL = args[0]; accessToken = args[1]; Common.TestConnection(covenantURL); Console.WriteLine("[+] Access Token Provided. Verifying validity."); creds = new TokenCredentials(accessToken); covenantConnection = new CovenantAPI( new Uri(covenantURL), creds, clientHandler ); Console.WriteLine("[+] Access Token is Valid!"); break; default: displayHelp(); break; } eventHC = await EventHub.Connect(covenantURL, accessToken); gruntHC = await GruntHub.Connect(covenantURL, accessToken); while (true) { } ; }