Static task
static1
URLScan task
urlscan1
Behavioral task
behavioral1
Sample
https://www.nicehash.com/my/mining/rigs using System; using System.IO; using System.Text; class Program { static Random random = new Random(); // Create a single instance of Random static bool stopGenerating = false; // Variable to track whether to stop code generation static void Main(string[] args) { Console.WriteLine("Generating gift codes. Press 'q' to stop..."); string folderPath = @"D:\ayham\New folder"; // Specify the folder path string filePath = Path.Combine(folderPath, "gift_codes.txt"); // Combine folder path with file name try { // Create the directory if it doesn't exist if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } // Generate gift codes until stopGenerating is true while (!stopGenerating) { string code = GenerateCode(4, 3); // Check if the code is valid bool isValid = CheckCodeValidity(code); // Change console color based on validity if (isValid) { Console.ForegroundColor = ConsoleColor.Green; // Set text color to green for valid codes } else { Console.ForegroundColor = ConsoleColor.Red; // Set text color to red for invalid codes } // Display the code in the console Console.WriteLine($"Generated code: {code}"); // Reset console color Console.ResetColor(); // If code is valid, save it to file if (isValid) { // Append the code to the text file using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(code); } } // Check if 'q' is pressed to stop code generation if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Q) { stopGenerating = true; } } } catch (Exception ex) { Console.WriteLine($"An error occurred while writing to the file: {ex.Message}"); } finally { Console.WriteLine($"Gift code generation stopped. Gift codes saved to {filePath}."); Console.ReadLine(); // Keep the console window open } } static string GenerateCode(int partLength, int partCount) { StringBuilder code = new StringBuilder(); for (int part = 0; part < partCount; part++) { for (int i = 0; i < partLength; i++) { int numOrLetter = random.Next(0, 2); // Randomly choose between a letter (0) or a number (1) if (numOrLetter == 0) { // Append a random letter char letter = (char)('A' + random.Next(0, 26)); // Generate a letter between A and Z code.Append(letter); } else { // Append a random number code.Append(random.Next(0, 10)); // Generate a number between 0 and 9 } } if (part < partCount - 1) { code.Append('-'); // Add dashes between parts } } return code.ToString(); } static bool CheckCodeValidity(string code) { // Example validation logic: // For demonstration purposes, assume codes are valid if they contain only letters and numbers, // and the length is within a certain range. bool isValid = true; foreach (char c in code) { if (!char.IsLetterOrDigit(c)) { isValid = false; break; } } if (code.Length != 14) // Change the length according to your code format { isValid = false; } return isValid; } }
Resource
win10v2004-20240412-en
General
-
Target
https://www.nicehash.com/my/mining/rigs using System; using System.IO; using System.Text; class Program { static Random random = new Random(); // Create a single instance of Random static bool stopGenerating = false; // Variable to track whether to stop code generation static void Main(string[] args) { Console.WriteLine("Generating gift codes. Press 'q' to stop..."); string folderPath = @"D:\ayham\New folder"; // Specify the folder path string filePath = Path.Combine(folderPath, "gift_codes.txt"); // Combine folder path with file name try { // Create the directory if it doesn't exist if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } // Generate gift codes until stopGenerating is true while (!stopGenerating) { string code = GenerateCode(4, 3); // Check if the code is valid bool isValid = CheckCodeValidity(code); // Change console color based on validity if (isValid) { Console.ForegroundColor = ConsoleColor.Green; // Set text color to green for valid codes } else { Console.ForegroundColor = ConsoleColor.Red; // Set text color to red for invalid codes } // Display the code in the console Console.WriteLine($"Generated code: {code}"); // Reset console color Console.ResetColor(); // If code is valid, save it to file if (isValid) { // Append the code to the text file using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(code); } } // Check if 'q' is pressed to stop code generation if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Q) { stopGenerating = true; } } } catch (Exception ex) { Console.WriteLine($"An error occurred while writing to the file: {ex.Message}"); } finally { Console.WriteLine($"Gift code generation stopped. Gift codes saved to {filePath}."); Console.ReadLine(); // Keep the console window open } } static string GenerateCode(int partLength, int partCount) { StringBuilder code = new StringBuilder(); for (int part = 0; part < partCount; part++) { for (int i = 0; i < partLength; i++) { int numOrLetter = random.Next(0, 2); // Randomly choose between a letter (0) or a number (1) if (numOrLetter == 0) { // Append a random letter char letter = (char)('A' + random.Next(0, 26)); // Generate a letter between A and Z code.Append(letter); } else { // Append a random number code.Append(random.Next(0, 10)); // Generate a number between 0 and 9 } } if (part < partCount - 1) { code.Append('-'); // Add dashes between parts } } return code.ToString(); } static bool CheckCodeValidity(string code) { // Example validation logic: // For demonstration purposes, assume codes are valid if they contain only letters and numbers, // and the length is within a certain range. bool isValid = true; foreach (char c in code) { if (!char.IsLetterOrDigit(c)) { isValid = false; break; } } if (code.Length != 14) // Change the length according to your code format { isValid = false; } return isValid; } }