Wordlists created for recheck purposes are now only stored in memory and not on disk anymore.

This commit is contained in:
ruri
2019-09-30 14:39:30 +02:00
parent 9c21a83c8a
commit 7307231f85
3 changed files with 11 additions and 24 deletions
+4 -22
View File
@@ -320,34 +320,16 @@ namespace OpenBullet
{
if (hitsListView.SelectedItems.Count == 0) { Globals.LogError(Components.HitsDB, "No hits selected!", true); return; }
var first = (Hit)hitsListView.SelectedItem;
var partialName = "Recheck-" + BlockBase.MakeValidFileName(first.ConfigName);
// Choose list name
var fileName = BlockBase.GetFirstAvailableFileName("Wordlists\\", partialName, "txt");
// Write to disk
var path = $@"{Directory.GetCurrentDirectory()}\Wordlists\{fileName}";
using (var sw = new StreamWriter(path))
{
foreach (Hit selected in hitsListView.SelectedItems)
sw.WriteLine(selected.Data);
}
// Import it
var listName = fileName.Substring(0, fileName.Length - 4);
var wordlist = new Wordlist(listName, path, Globals.environment.RecognizeWordlistType(first.Data), "");
Globals.mainWindow.WordlistManagerPage.AddWordlist(wordlist);
var partialName = "Recheck-" + first.ConfigName;
var wordlist = new Wordlist(partialName, "NULL", Globals.environment.RecognizeWordlistType(first.Data), "", true, true);
var manager = Globals.mainWindow.RunnerManagerPage.vm;
manager.CreateRunner();
var runner = manager.Runners.Last().Page;
Globals.mainWindow.ShowRunner(runner);
try
{
runner.vm.SetWordlist(Globals.mainWindow.WordlistManagerPage.GetList(listName));
}
catch { }
runner.vm.SetWordlist(wordlist);
runner.vm.DataPool = new DataPool (hitsListView.SelectedItems.Cast<Hit>().Select(h => h.Data));
// Try to select the config referring to the first selected hit
try
+6 -1
View File
@@ -27,6 +27,9 @@ namespace RuriLib.Models
/// <summary>The total number of data lines of the file.</summary>
public int Total { get; set; }
/// <summary>If true, the Wordlist does not reside on the disk.</summary>
public bool Temporary { get; set; }
/// <summary>Needed for NoSQL deserialization.</summary>
public Wordlist() { }
@@ -38,13 +41,15 @@ namespace RuriLib.Models
/// <param name="type">The WordlistType as a string</param>
/// <param name="purpose">The purpose of the Wordlist</param>
/// <param name="countLines">Whether to enumerate the total number of data lines in the Wordlist</param>
public Wordlist(string name, string path, string type, string purpose, bool countLines = true)
/// <param name="temporary">If true, the Wordlist does not reside on the disk</param>
public Wordlist(string name, string path, string type, string purpose, bool countLines = true, bool temporary = false)
{
Name = name;
Path = path;
Type = type;
Purpose = purpose;
Total = 0;
Temporary = temporary;
if (countLines)
{
try
+1 -1
View File
@@ -382,7 +382,7 @@ namespace RuriLib.Runner
if (Config == null) throw new Exception("No Config loaded!");
if (Wordlist == null) throw new Exception("No Wordlist loaded!");
DataPool = new DataPool(File.ReadLines(Wordlist.Path));
if (!Wordlist.Temporary) DataPool = new DataPool(File.ReadLines(Wordlist.Path));
RaiseMessageArrived(LogLevel.Info, $"Loaded {DataPool.Size} lines", false);
RaiseMessageArrived(LogLevel.Info, $"Using Proxies: {UseProxies}", false);