Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.61 KB | None | 0 0
  1. using System;
  2. using System.CodeDom.Compiler;
  3. using System.ComponentModel;
  4. using System.Diagnostics;
  5. using System.Management;
  6. using System.Net;
  7. using System.Runtime.CompilerServices;
  8. using System.Security.Cryptography;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Controls.Primitives;
  14. using System.Windows.Input;
  15. using System.Windows.Markup;
  16. using HelperMethods;
  17. using Newtonsoft.Json;
  18. using Seafko.Properties;
  19.  
  20. namespace Seafko
  21. {
  22.     // Token: 0x0200000D RID: 13
  23.     public partial class ActivateProduct : Window, IComponentConnector
  24.     {
  25.         // Token: 0x06000064 RID: 100 RVA: 0x0000B218 File Offset: 0x00009418
  26.         private void ActivateBtn_OnClick(object sender, RoutedEventArgs e)
  27.         {
  28.             if (!string.IsNullOrEmpty(this.ActivationKey.Text))
  29.             {
  30.                 this.ActivateBtn.IsEnabled = false;
  31.                 this.LoadingGif.Visibility = Visibility.Visible;
  32.                 if (!statics.CheckForInternetConnection())
  33.                 {
  34.                     MessageBox.Show("No internet connection available.", "Key Manager", MessageBoxButton.OK, MessageBoxImage.Hand);
  35.                     return;
  36.                 }
  37.                 string ActivationKeyText = this.ActivationKey.Text;
  38.                 new Thread(delegate()
  39.                 {
  40.                     string getPKey = new LocalData().GetPKey;
  41.                     using (WebClient webClient = new WebClient())
  42.                     {
  43.                         string machineId = this.GetMachineId() + "|" + Guid.NewGuid().ToString();
  44.                         ActivateProduct.SignKey signKey = new ActivateProduct.SignKey();
  45.                         signKey.Key = ActivationKeyText;
  46.                         signKey.MachineId = machineId;
  47.                         signKey.IsComunityEdtioinInformations = 4;
  48.                         string str = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(signKey)));
  49.                         string text = webClient.DownloadString("http://18.130.174.29/ActivtionServers/ActivationServer.php?KeyData=" + str);
  50.                         if (!string.IsNullOrEmpty(text) && text != "false")
  51.                         {
  52.                             try
  53.                             {
  54.                                 string @string = Encoding.UTF8.GetString(Convert.FromBase64String(text));
  55.                                 SignedKey signedKey = JsonConvert.DeserializeObject<SignedKey>(@string);
  56.                                 if (!(signedKey.MachineId == signKey.MachineId))
  57.                                 {
  58.                                     MessageBox.Show("Invlaid key id", "Key Manager", MessageBoxButton.OK, MessageBoxImage.Hand);
  59.                                 }
  60.                                 else if (this.VerifyData(signKey.MachineId, signedKey.Signature, getPKey))
  61.                                 {
  62.                                     this.Dispatcher.Invoke(delegate()
  63.                                     {
  64.                                         MessageBox.Show("Thank you , now you are well armed , Happy Hunting.", "Saefko Attack Systems", MessageBoxButton.OK, MessageBoxImage.Asterisk);
  65.                                         this.Hide();
  66.                                         Settings.Default.LoveIsAllOver = true;
  67.                                         Settings.Default.ActivationKeyText = signKey.Key;
  68.                                         Settings.Default.Save();
  69.                                         MainWindow mainWindow = new MainWindow();
  70.                                         mainWindow.Show();
  71.                                         if (this.CommunityEdition != null)
  72.                                         {
  73.                                             this.CommunityEdition.Close();
  74.                                         }
  75.                                         this.Close();
  76.                                     });
  77.                                 }
  78.                                 else
  79.                                 {
  80.                                     MessageBox.Show("Invlaid key", "Key Manager", MessageBoxButton.OK, MessageBoxImage.Hand);
  81.                                 }
  82.                                 goto IL_1A5;
  83.                             }
  84.                             catch (Exception)
  85.                             {
  86.                                 MessageBox.Show("Problem while validating key.", "Key Manager", MessageBoxButton.OK, MessageBoxImage.Hand);
  87.                                 goto IL_1A5;
  88.                             }
  89.                         }
  90.                         MessageBox.Show("Invlaid key server rejected  it.", "Key Manager", MessageBoxButton.OK, MessageBoxImage.Hand);
  91.                         IL_1A5:
  92.                         this.Dispatcher.Invoke(delegate()
  93.                         {
  94.                             this.LoadingGif.Visibility = Visibility.Collapsed;
  95.                             this.ActivateBtn.IsEnabled = true;
  96.                         });
  97.                     }
  98.                 }).Start();
  99.             }
  100.         }
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement