Skip to content

Commit 6f56ff2

Browse files
Merge pull request #60 from GitHubProUser67/Nightly
Nightly update (16/06/2024).
2 parents 90af2df + b907131 commit 6f56ff2

File tree

196 files changed

+9526
-321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+9526
-321
lines changed

BackendServices/AuxiliaryServices/HomeTools/HomeTools.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<Nullable>enable</Nullable>
6+
<IsTrimmable>true</IsTrimmable>
67
<IsPublishable>false</IsPublishable>
78
</PropertyGroup>
89

BackendServices/AuxiliaryServices/HomeTools/UnBAR/LegacyMapper.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public Task MapperStart(string foldertomap, string? helperfolder, string prefix,
2525

2626
if (string.IsNullOrEmpty(prefix))
2727
{
28-
#if NETSTANDARD2_1_OR_GREATER
29-
Match match = new Regex(@"[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}").Match(foldertomap);
30-
#elif NET7_0_OR_GREATER
28+
#if NET7_0_OR_GREATER
3129
Match match = UUIDRegex().Match(foldertomap);
30+
#else
31+
Match match = new Regex(@"[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}-[0-9a-fA-F]{8}").Match(foldertomap);
3232
#endif
3333
if (match.Success)
3434
prefix = $"objects/{match.Groups[0].Value}/";
@@ -85,7 +85,7 @@ public Task MapperStart(string foldertomap, string? helperfolder, string prefix,
8585
{
8686
if (File.Exists(Path.Combine(foldertomap, file.Name)))
8787
{
88-
new FileInfo(Path.Combine(foldertomap, text).ToUpper()).Directory.Create();
88+
new FileInfo(Path.Combine(foldertomap, text).ToUpper()).Directory?.Create();
8989
if (!File.Exists(Path.Combine(foldertomap, text.ToUpper())))
9090
{
9191
File.Move(Path.Combine(foldertomap, file.Name), Path.Combine(foldertomap, text.ToUpper()));
@@ -104,7 +104,7 @@ public Task MapperStart(string foldertomap, string? helperfolder, string prefix,
104104
{
105105
if (File.Exists(Path.Combine(foldertomap, file.Name)))
106106
{
107-
new FileInfo(Path.Combine(foldertomap, cdatafromatmos).ToUpper()).Directory.Create();
107+
new FileInfo(Path.Combine(foldertomap, cdatafromatmos).ToUpper()).Directory?.Create();
108108
if (!File.Exists(Path.Combine(foldertomap, cdatafromatmos.ToUpper())))
109109
{
110110
File.Move(Path.Combine(foldertomap, file.Name), Path.Combine(foldertomap, cdatafromatmos.ToUpper()));
@@ -270,23 +270,25 @@ private void CopyFiles(string sourceDir, string targetDir)
270270
Directory.CreateDirectory(targetDir);
271271

272272
// Get all files in the source directory and its subdirectories
273-
string[] files = Directory.GetFiles(sourceDir, "*.*", SearchOption.AllDirectories);
274-
275-
foreach (string file in files)
273+
foreach (string file in Directory.GetFiles(sourceDir, "*.*", SearchOption.AllDirectories))
276274
{
277275
filePathList.Add(file);
278276

279277
try
280278
{
281279
string targetPath = Path.Combine(targetDir, Path.GetRelativePath(sourceDir, file));
280+
string? directorytargetPath = Path.GetDirectoryName(targetPath);
282281

283-
// Create the directory structure in the target directory if it doesn't exist
284-
Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
282+
if (!string.IsNullOrEmpty(directorytargetPath))
283+
{
284+
// Create the directory structure in the target directory if it doesn't exist
285+
Directory.CreateDirectory(directorytargetPath);
285286

286-
// Copy the file to the target directory
287-
File.Copy(file, targetPath, true); // Use true to overwrite existing files
287+
// Copy the file to the target directory
288+
File.Copy(file, targetPath, true); // Use true to overwrite existing files
289+
}
288290
}
289-
catch (Exception)
291+
catch
290292
{
291293
// Not Important.
292294
}

BackendServices/AuxiliaryServices/WebAPIService/CDS/CTRExploitProcess.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public class CTRExploitProcess
132132
{
133133
byte[]? TestFileBytes = LIBSECURE.InitiateBlowfishBuffer(EncryptedFileBytes, ToolsImpl.DefaultKey, GuessedIV, "CTR");
134134

135-
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindbyteSequence(TestFileBytes, new byte[] { 0xAD, 0xEF, 0x17, 0xE1, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }))
135+
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindBytePattern(TestFileBytes, new byte[] { 0xAD, 0xEF, 0x17, 0xE1, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }) != -1)
136136
{
137137
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Valid File was bruteforced! - {0}", DateTime.Now.ToString());
138138
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Found IV - {0}", DataTypesUtils.ByteArrayToHexString(GuessedIV));
@@ -145,7 +145,7 @@ public class CTRExploitProcess
145145
{
146146
TestFileBytes = LIBSECURE.InitiateBlowfishBuffer(EncryptedFileBytes, ToolsImpl.DefaultKey, GuessedIV, "CTR");
147147

148-
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindbyteSequence(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }))
148+
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindBytePattern(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }) != -1)
149149
{
150150
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Valid File was bruteforced! - {0}", DateTime.Now.ToString());
151151
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Found IV - {0}", DataTypesUtils.ByteArrayToHexString(GuessedIV));
@@ -158,7 +158,7 @@ public class CTRExploitProcess
158158
{
159159
TestFileBytes = LIBSECURE.InitiateBlowfishBuffer(EncryptedFileBytes, ToolsImpl.DefaultKey, GuessedIV, "CTR");
160160

161-
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindbyteSequence(TestFileBytes, new byte[] { 0xAD, 0xEF, 0x17, 0xE1, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }))
161+
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindBytePattern(TestFileBytes, new byte[] { 0xAD, 0xEF, 0x17, 0xE1, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }) != 1)
162162
{
163163
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Valid File was bruteforced! - {0}", DateTime.Now.ToString());
164164
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Found IV - {0}", DataTypesUtils.ByteArrayToHexString(GuessedIV));
@@ -171,7 +171,7 @@ public class CTRExploitProcess
171171
{
172172
TestFileBytes = LIBSECURE.InitiateBlowfishBuffer(EncryptedFileBytes, ToolsImpl.DefaultKey, GuessedIV, "CTR");
173173

174-
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindbyteSequence(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }))
174+
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindBytePattern(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }) != -1)
175175
{
176176
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Valid File was bruteforced! - {0}", DateTime.Now.ToString());
177177
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Found IV - {0}", DataTypesUtils.ByteArrayToHexString(GuessedIV));
@@ -184,7 +184,7 @@ public class CTRExploitProcess
184184
{
185185
TestFileBytes = LIBSECURE.InitiateBlowfishBuffer(EncryptedFileBytes, ToolsImpl.DefaultKey, GuessedIV, "CTR");
186186

187-
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindbyteSequence(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }))
187+
if (TestFileBytes != null && TestFileBytes.Length > 12 && DataTypesUtils.FindBytePattern(TestFileBytes, new byte[] { 0xE1, 0x17, 0xEF, 0xAD, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }) != -1)
188188
{
189189
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Valid File was bruteforced! - {0}", DateTime.Now.ToString());
190190
CustomLogger.LoggerAccessor.LogInfo("[CDS] - CTRExploitProcess - Found IV - {0}", DataTypesUtils.ByteArrayToHexString(GuessedIV));

BackendServices/AuxiliaryServices/WebAPIService/HELLFIRE/Helpers/NPTicket.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class NPTicket
6060
extractedData[i] = 0x20;
6161
}
6262

63-
if (DataTypesUtils.FindbyteSequence(ticketData, new byte[] { 0x52, 0x50, 0x43, 0x4E }))
63+
if (DataTypesUtils.FindBytePattern(ticketData, new byte[] { 0x52, 0x50, 0x43, 0x4E }) != -1)
6464
{
6565
LoggerAccessor.LogInfo($"[HFGames] : User {Encoding.ASCII.GetString(extractedData).Replace("H", string.Empty)} logged in and is on RPCN");
6666

BackendServices/AuxiliaryServices/WebAPIService/OHS/Batch.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ public class Batch
129129
case "usercounter/incrementmany/":
130130
resultfromcommand = UserCounter.Increment_Many(PostData, ContentType, directorypath, data, game);
131131
break;
132+
case "usercounter/increment_setentry/":
133+
resultfromcommand = UserCounter.IncrementSetEntry(PostData, ContentType, directorypath, data, game);
134+
break;
132135
case "userinventory/addglobalitems/":
133136
resultfromcommand = UserInventory.AddGlobalItems(PostData, ContentType, directorypath + $"/{project}/", data, game);
134137
break;

BackendServices/AuxiliaryServices/WebAPIService/OHS/JaminProcessor.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class JaminProcessor
1111
{
1212
public static bool VerifyHash(string str, string referencehash)
1313
{
14-
if (EncryptDecrypt.Hash32Str(str) == referencehash.ToUpper())
14+
if (EncryptDecrypt.Hash32Str(str).Equals(referencehash, StringComparison.InvariantCultureIgnoreCase))
1515
return true;
1616

1717
return false;
@@ -309,8 +309,8 @@ public static object[] ExecuteLuaScript(string luaScript)
309309
private static string ToLiteral(string input)
310310
{
311311
StringBuilder literal = new StringBuilder(input.Length + 2);
312-
literal.Append("\"");
313-
foreach (var c in input)
312+
literal.Append('"');
313+
foreach (char c in input)
314314
{
315315
switch (c)
316316
{
@@ -327,10 +327,8 @@ private static string ToLiteral(string input)
327327
default:
328328
// ASCII printable character
329329
if (c >= 0x20 && c <= 0x7e)
330-
{
331330
literal.Append(c);
332331
// As UTF16 escaped character
333-
}
334332
else
335333
{
336334
literal.Append(@"\u");
@@ -339,7 +337,7 @@ private static string ToLiteral(string input)
339337
break;
340338
}
341339
}
342-
literal.Append("\"");
340+
literal.Append('"');
343341
return literal.ToString();
344342
}
345343
}

BackendServices/AuxiliaryServices/WebAPIService/OHS/Leaderboard.cs

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Text;
99
using System.Text.RegularExpressions;
1010
using System;
11+
using System.Linq;
1112

1213
namespace WebAPIService.OHS
1314
{
@@ -374,13 +375,16 @@ public static string UpdateScoreboard(string json, string nameToUpdate, int newS
374375
{
375376
foreach (var entry in entries)
376377
{
377-
var rankData = new Dictionary<string, object>
378-
{
379-
{ "[\"user\"]", $"\"{entry.Name}\"" }, // Enclose string in double quotes and put it inside the brackets
380-
{ "[\"score\"]", $"\"{entry.Score}\"" } // For numbers, no need to enclose in quotes and put it inside the brackets
381-
};
378+
if (!string.IsNullOrEmpty(entry.Name))
379+
{
380+
var rankData = new Dictionary<string, object>
381+
{
382+
{ "[\"user\"]", $"\"{entry.Name}\"" }, // Enclose string in double quotes and put it inside the brackets
383+
{ "[\"score\"]", $"\"{entry.Score}\"" } // For numbers, no need to enclose in quotes and put it inside the brackets
384+
};
382385

383-
luaTable.Add(entry.Rank, rankData);
386+
luaTable.Add(entry.Rank, rankData);
387+
}
384388
}
385389

386390
// Step 3: Format the Lua table as a string using regex
@@ -421,7 +425,7 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
421425
{
422426
StringBuilder? resultBuilder = new StringBuilder();
423427

424-
foreach (string user in data.Users)
428+
foreach (string user in data.Users.Where(user => !string.IsNullOrEmpty(user)))
425429
{
426430
string? scoreboarddata = File.ReadAllText(scoreboardfile);
427431

@@ -441,7 +445,7 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
441445
{
442446
foreach (var entry in entries)
443447
{
444-
if (entry.Name == user)
448+
if (!string.IsNullOrEmpty(entry.Name) && entry.Name.Equals(user))
445449
{
446450
if (entry.Score != 0)
447451
{
@@ -492,7 +496,7 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
492496

493497
foreach (var entry in scoreentries)
494498
{
495-
if (i >= 1)
499+
if (i >= 1 && !string.IsNullOrEmpty(entry.Name))
496500
{
497501
var rankData = new Dictionary<string, object>
498502
{
@@ -564,11 +568,7 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
564568
string scoreboardfile = scoreboardpath + $"/scoreboard_{key}.json";
565569

566570
if (!File.Exists(scoreboardfile))
567-
{
568-
Scoreboard? scoreboard = GenerateSampleScoreboard(numEntries);
569-
File.WriteAllText(scoreboardfile, JsonConvert.SerializeObject(scoreboard, Formatting.Indented));
570-
scoreboard = null;
571-
}
571+
File.WriteAllText(scoreboardfile, JsonConvert.SerializeObject(GenerateSampleScoreboard(numEntries), Formatting.Indented));
572572

573573
scoreboardfile = File.ReadAllText(scoreboardfile);
574574

@@ -596,7 +596,7 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
596596

597597
foreach (var entry in entries)
598598
{
599-
if (i >= start)
599+
if (i >= start && !string.IsNullOrEmpty(entry.Name))
600600
{
601601
var rankData = new Dictionary<string, object>
602602
{
@@ -632,15 +632,12 @@ public static string RequestByUsers(string? jsontable, string scoreboardpath)
632632
public static Scoreboard GenerateSampleScoreboard(int numEntries)
633633
{
634634
Scoreboard scoreboard = new Scoreboard();
635-
Random? random = new Random();
636635

637-
scoreboard.Entries = new List<ScoreboardEntry>();
636+
scoreboard.Entries = new List<ScoreboardEntry>(numEntries);
638637

639638
for (int i = 1; i <= numEntries; i++)
640639
{
641-
string playerName = ScoreboardNameGenerator.GenerateRandomName();
642-
int score = random.Next(100, 1000); // Generate a random score between 100 and 999
643-
scoreboard.Entries.Add(new ScoreboardEntry { Name = playerName, Score = score });
640+
scoreboard.Entries.Add(new ScoreboardEntry { Name = string.Empty, Score = 0 });
644641
}
645642

646643
// Sort the entries by score in descending order
@@ -652,8 +649,6 @@ public static Scoreboard GenerateSampleScoreboard(int numEntries)
652649
scoreboard.Entries[i].Rank = i + 1;
653650
}
654651

655-
random = null;
656-
657652
return scoreboard;
658653
}
659654

@@ -763,19 +758,6 @@ public override void WriteJson(JsonWriter writer, ScoreBoardUpdate? value, JsonS
763758
}
764759
}
765760

766-
public class ScoreboardNameGenerator
767-
{
768-
private static Random random = new Random();
769-
770-
// List of silly French-sounding words to be used in the names
771-
private static string[] sillyFrenchWords = { "Croissant", "Baguette", "Fougasse", "TarteAuFromage", "Tabernack", "UnePetiteContine", "ChuckNorris", "Pamplemousse", "JimCarrey", "Fromage" };
772-
773-
public static string GenerateRandomName()
774-
{
775-
return sillyFrenchWords[random.Next(0, sillyFrenchWords.Length)];
776-
}
777-
}
778-
779761
public class ScoreboardEntry
780762
{
781763
public string? Name { get; set; }

0 commit comments

Comments
 (0)