-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCheck For Duplicates.cs
66 lines (54 loc) · 2.47 KB
/
Check For Duplicates.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
List<string> yearDirectories = Directory.GetDirectories(@"G:\Sources\Roblox-Executor-Sources", "*").ToList();
yearDirectories.RemoveAt(0);
IEnumerable<string> exploitFolders = yearDirectories.SelectMany(yearDirectory => Directory.GetDirectories(yearDirectory, "*"));
Dictionary<string, string[]> exploitContents = [];
foreach (string exploitFolder in exploitFolders) AddStuff(exploitFolder);
foreach (KeyValuePair<string, string[]> exploit in exploitContents)
{
IEnumerable<KeyValuePair<string, string[]>> dataFound = exploitContents.Where((data) => data.Key != exploit.Key && data.Value.SequenceEqual(exploit.Value));
IEnumerable<KeyValuePair<string, string[]>> keyValuePairs = dataFound as KeyValuePair<string, string[]>[] ?? dataFound.ToArray();
if (keyValuePairs.Any())
{
if (keyValuePairs.First().Key == "AutoPCH") continue;
Console.WriteLine($"Found duplicate data: {exploit.Key} {exploit.Value.Length} and {keyValuePairs.First().Key} {keyValuePairs.First().Value.Length}");
}
}
return;
IEnumerable<string> FilterFiles(string path, string[] exts)
{
return
Directory
.EnumerateFiles(path, "*.*")
.Where(file => !exts.Any(x => file.EndsWith(x, StringComparison.OrdinalIgnoreCase)));
}
void AddStuff(string exploitFolder)
{
bool doBreak = false;
DirectoryInfo dirInfo = new(exploitFolder);
List<string> files = FilterFiles(exploitFolder, ["md", "sln", "vcproj", "vcxproj", "filters", "user", "exe", "rar", "zip"]).ToList();
string[] internalDirectories = Directory.GetDirectories(exploitFolder);
if (exploitFolder.Contains("monaco", StringComparison.OrdinalIgnoreCase))
if (internalDirectories.Length > 0)
foreach (string internalDirectory in internalDirectories)
AddStuff(internalDirectory);
switch (files.Count)
{
case 0 when internalDirectories.Length == 0:
Console.WriteLine($"Empty Folder {exploitFolder}");
doBreak = true;
break;
case 1 when new FileInfo(files[0]).Length == 0:
Console.WriteLine($"Empty Folder (Dead File) {exploitFolder}");
doBreak = true;
break;
}
int counter = 1;
string exploitName = dirInfo.Name;
string originalName = exploitName;
while (exploitContents.ContainsKey(exploitName))
{
exploitName = $"{originalName} ({counter})";
counter++;
}
exploitContents.Add(exploitFolder, Directory.GetFiles(exploitFolder));
}