public async Task SaveRecord(MultiRunJob job) { if (job.DataPool is WordlistDataPool pool) { var record = recordRepo.GetAll() .FirstOrDefault(r => r.ConfigId == job.Config.Id && r.WordlistId == pool.Wordlist.Id); var checkpoint = job.Status == JobStatus.Idle ? job.Skip : job.Skip + job.DataTested; if (record == null) { await recordRepo.Add(new RecordEntity { ConfigId = job.Config.Id, WordlistId = pool.Wordlist.Id, Checkpoint = checkpoint }); } else { record.Checkpoint = checkpoint; await recordRepo.Update(record); } } }
public override Task Execute(MultiRunJob job) { if (Amount > 0 && Amount <= 200) { job.Bots = Amount; } return(Task.CompletedTask); }
private JobType GetJobType(Job job) { return(job switch { MultiRunJob _ => JobType.MultiRun, ProxyCheckJob _ => JobType.ProxyCheck, RipJob _ => JobType.Ripper, SpiderJob _ => JobType.Spider, PuppeteerUnitTestJob _ => JobType.PuppeteerUnitTest, _ => throw new NotImplementedException() });
public override bool CheckStatus(MultiRunJob job) => Functions.Conditions.Conditions.Check(job.DataRetried, Comparison, Amount);
public override bool CheckStatus(MultiRunJob job) => Functions.Conditions.Conditions.Check(job.Remaining, Comparison, new TimeSpan(Days, Hours, Minutes, Seconds));
public override bool CheckStatus(MultiRunJob job) => Functions.Conditions.Conditions.Check(job.Progress * 100, Comparison, Amount);
public override bool CheckStatus(MultiRunJob job) => Functions.Conditions.Conditions.Check(Convert.ToSingle(job.CaptchaCredit), Comparison, Amount);
public override bool CheckStatus(MultiRunJob job) => job.Status == JobStatus.Idle && job.Progress == 1f;
public override bool CheckStatus(MultiRunJob job) => Functions.Conditions.Conditions.Check(job.ProxiesBanned, Comparison, Amount);
public virtual bool CheckStatus(MultiRunJob job) => throw new NotImplementedException();
private static void Run(Options opts) { options = opts; var rlSettings = new RuriLibSettingsService("UserData"); var pluginRepo = new PluginRepository("UserData/Plugins"); // Unpack the config using var fs = new FileStream(opts.ConfigFile, FileMode.Open); var config = ConfigPacker.Unpack(fs).Result; // Setup the job job = new MultiRunJob(rlSettings, pluginRepo) { Providers = new RuriLib.Models.Bots.Providers(rlSettings), Bots = opts.BotsNumber, Config = config, DataPool = new FileDataPool(opts.WordlistFile, opts.WordlistType), HitOutputs = new List <IHitOutput> { new FileSystemHitOutput("UserData/Hits") }, ProxyMode = opts.ProxyMode, ProxySources = new List <ProxySource> { new FileProxySource(opts.ProxyFile) { DefaultType = opts.ProxyType } } }; // Ask custom inputs (if any) foreach (var input in config.Settings.InputSettings.CustomInputs) { System.Console.WriteLine($"{input.Description} ({input.DefaultAnswer}): "); var answer = System.Console.ReadLine(); job.CustomInputsAnswers[input.VariableName] = string.IsNullOrWhiteSpace(answer) ? input.DefaultAnswer : answer; } // Hook event handlers job.OnCompleted += (sender, args) => completed = true; job.OnResult += PrintResult; job.OnTaskError += PrintTaskError; job.OnError += (sender, ex) => System.Console.WriteLine($"Error: {ex.Message}", Color.Tomato); // Start the job job.Start().Wait(); // Wait until it finished while (!completed) { Thread.Sleep(100); UpdateTitle(); } // Print colored finish message System.Console.Write($"Finished. Found: "); System.Console.Write($"{job.DataHits} hits, ", Color.GreenYellow); System.Console.Write($"{job.DataCustom} custom, ", Color.DarkOrange); System.Console.WriteLine($"{job.DataToCheck} to check.", Color.Aquamarine); // Prevent console from closing until the user presses return, then close System.Console.ReadLine(); Environment.Exit(0); }
public override async Task Execute(MultiRunJob job) { await job.FetchProxiesFromSources(); }
public virtual Task Execute(MultiRunJob job) => throw new NotImplementedException();