Advertisement
Guest User

Untitled

a guest
Oct 29th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.82 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: trick.io.AuthForm
  3. // Assembly: trick.io, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 48CC9BF8-A584-43E0-9E36-44F1F19A4F50
  5. // Assembly location: C:\Users\skillize\Desktop\trick.io-cleaned.exe
  6.  
  7. using Bunifu.Framework.UI;
  8. using Newtonsoft.Json;
  9. using Newtonsoft.Json.Linq;
  10. using System;
  11. using System.ComponentModel;
  12. using System.Drawing;
  13. using System.IO;
  14. using System.Net;
  15. using System.Net.NetworkInformation;
  16. using System.Net.Security;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. using System.Windows.Forms;
  20.  
  21. namespace trick.io
  22. {
  23. public class AuthForm : Form
  24. {
  25. private IContainer components = (IContainer) null;
  26. private BunifuElipse AuthFormElipse;
  27. private PictureBox gifPictureBox;
  28. private Panel settings_AuthenticationPanel;
  29. private BunifuThinButton2 settings_AuthenticateButton;
  30. private BunifuMaterialTextbox settings_PasswordCombo;
  31. private BunifuMaterialTextbox settings_UsernameCombo;
  32. private Label settings_PasswordLabel;
  33. private Label settings_UsernameLabel;
  34. private BunifuElipse settings_AuthenticationPanelElipse;
  35.  
  36. public AuthForm()
  37. {
  38. this.InitializeComponent();
  39. }
  40.  
  41. public string GetMACAddress()
  42. {
  43. NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
  44. string empty = string.Empty;
  45. foreach (NetworkInterface networkInterface in networkInterfaces)
  46. {
  47. if (empty == string.Empty)
  48. {
  49. networkInterface.GetIPProperties();
  50. empty = networkInterface.GetPhysicalAddress().ToString();
  51. }
  52. }
  53. return empty;
  54. }
  55.  
  56. public static void ShowAuth(PictureBox ctrl)
  57. {
  58. if (ctrl.InvokeRequired)
  59. {
  60. AuthForm.ShowAuthDelegate showAuthDelegate = new AuthForm.ShowAuthDelegate(AuthForm.ShowAuth);
  61. ctrl.Invoke((Delegate) showAuthDelegate, (object) ctrl);
  62. }
  63. else
  64. {
  65. ctrl.Enabled = false;
  66. ctrl.Visible = false;
  67. }
  68. }
  69.  
  70. public static void Hide(Form ctrl, string acc)
  71. {
  72. if (ctrl.InvokeRequired)
  73. {
  74. AuthForm.HideDelegate hideDelegate = new AuthForm.HideDelegate(AuthForm.Hide);
  75. ctrl.Invoke((Delegate) hideDelegate, (object) ctrl, (object) acc);
  76. }
  77. else
  78. {
  79. ctrl.Hide();
  80. new MainForm(acc).Show();
  81. }
  82. }
  83.  
  84. public static void SetUsername(BunifuMaterialTextbox ctrl, string acc)
  85. {
  86. if (((Control) ctrl).InvokeRequired)
  87. {
  88. AuthForm.SetUsernameDelegate usernameDelegate = new AuthForm.SetUsernameDelegate(AuthForm.SetUsername);
  89. ((Control) ctrl).Invoke((Delegate) usernameDelegate, (object) ctrl, (object) acc);
  90. }
  91. else
  92. ((Control) ctrl).Text = acc;
  93. }
  94.  
  95. public static void SetPassword(BunifuMaterialTextbox ctrl, string acc)
  96. {
  97. if (((Control) ctrl).InvokeRequired)
  98. {
  99. AuthForm.SetPasswordDelegate passwordDelegate = new AuthForm.SetPasswordDelegate(AuthForm.SetPassword);
  100. ((Control) ctrl).Invoke((Delegate) passwordDelegate, (object) ctrl, (object) acc);
  101. }
  102. else
  103. ((Control) ctrl).Text = acc;
  104. }
  105.  
  106. private JObject authenticate(string username, string password, int ms)
  107. {
  108. Thread.Sleep(ms);
  109. ServicePointManager.ServerCertificateValidationCallback += (RemoteCertificateValidationCallback) ((_param1, _param2, _param3, _param4) => true);
  110. ServicePointManager.Expect100Continue = true;
  111. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  112. string str = this.GetMACAddress().ToString();
  113. JObject jobject = new JObject();
  114. jobject.Add("status", JToken.op_Implicit(""));
  115. jobject.Add("acc_type", JToken.op_Implicit(""));
  116. try
  117. {
  118. HttpWebRequest httpWebRequest1 = (HttpWebRequest) WebRequest.Create(new Uri("https://trickioshop.xyz/temporary/auth/auth.php?usr=" + username + "&pwd=" + password + "&mc=" + str));
  119. httpWebRequest1.Method = "GET";
  120. NetworkCredential networkCredential = new NetworkCredential("trickiov3", "l6kn7YbKG1Tu");
  121. httpWebRequest1.Credentials = (ICredentials) networkCredential;
  122. jobject = JObject.Parse(new StreamReader(httpWebRequest1.GetResponse().GetResponseStream()).ReadToEnd());
  123. if (!(((object) jobject.Property("status").get_Value()).ToString() == "mac") || !(((object) jobject.Property("mac").get_Value()).ToString() == ""))
  124. return jobject;
  125. ServicePointManager.ServerCertificateValidationCallback += (RemoteCertificateValidationCallback) ((_param1, _param2, _param3, _param4) => true);
  126. ServicePointManager.Expect100Continue = true;
  127. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  128. HttpWebRequest httpWebRequest2 = (HttpWebRequest) WebRequest.Create(new Uri("https://trickioshop.xyz/temporary/auth/update.php?usr=" + username + "&pwd=" + password + "&mc=" + str));
  129. httpWebRequest1.Method = "GET";
  130. httpWebRequest2.Credentials = (ICredentials) networkCredential;
  131. new StreamReader(httpWebRequest2.GetResponse().GetResponseStream()).ReadToEnd();
  132. jobject.Property("status").set_Value(JToken.op_Implicit("newmac"));
  133. return jobject;
  134. }
  135. catch (Exception ex)
  136. {
  137. System.IO.File.WriteAllText("errors.txt", ex.Message.ToString());
  138. jobject.Property("status").set_Value(JToken.op_Implicit("except"));
  139. return jobject;
  140. }
  141. }
  142.  
  143. private async void AuthForm_Load(object sender, EventArgs e)
  144. {
  145. this.gifPictureBox.BringToFront();
  146. string authText = System.IO.File.ReadAllText("auth.json");
  147. JObject authJson = JObject.Parse(authText);
  148. string username = ((object) authJson.Property("username").get_Value()).ToString();
  149. string password = ((object) authJson.Property("password").get_Value()).ToString();
  150. Task<JObject> auth = new Task<JObject>((Func<JObject>) (() => this.authenticate(username, password, 2500)));
  151. auth.Start();
  152. JObject jobject = await auth;
  153. JObject auth_res = jobject;
  154. jobject = (JObject) null;
  155. string str = ((object) auth_res.Property("status").get_Value()).ToString();
  156. if (!(str == "success"))
  157. {
  158. if (!(str == "user/pw"))
  159. {
  160. if (!(str == "mac"))
  161. {
  162. if (!(str == "newmac"))
  163. {
  164. if (!(str == "except"))
  165. {
  166. AuthForm.ShowAuth(this.gifPictureBox);
  167. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  168. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  169. int num = (int) MessageBox.Show("Authentication problem! Please contact discord for help!", "Authentication");
  170. }
  171. else
  172. {
  173. AuthForm.ShowAuth(this.gifPictureBox);
  174. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  175. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  176. int num = (int) MessageBox.Show("Authentication problem! Please contact discord for help!", "Authentication");
  177. }
  178. }
  179. else
  180. {
  181. int num = (int) MessageBox.Show("Registered new device!", "Authentication");
  182. AuthForm.ShowAuth(this.gifPictureBox);
  183. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  184. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  185. AuthForm.Hide((Form) this, ((object) auth_res.Property("acc_type").get_Value()).ToString());
  186. }
  187. }
  188. else
  189. {
  190. AuthForm.ShowAuth(this.gifPictureBox);
  191. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  192. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  193. int num = (int) MessageBox.Show("Multiple devices not allowed! Use discord bot to reset!", "Authentication");
  194. }
  195. }
  196. else
  197. {
  198. AuthForm.ShowAuth(this.gifPictureBox);
  199. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  200. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  201. int num = (int) MessageBox.Show("Wrong username/password!", "Authentication");
  202. }
  203. }
  204. else
  205. {
  206. AuthForm.ShowAuth(this.gifPictureBox);
  207. AuthForm.SetUsername(this.settings_UsernameCombo, username);
  208. AuthForm.SetPassword(this.settings_PasswordCombo, password);
  209. AuthForm.Hide((Form) this, ((object) auth_res.Property("acc_type").get_Value()).ToString());
  210. }
  211. }
  212.  
  213. private void pictureBox1_Click(object sender, EventArgs e)
  214. {
  215. }
  216.  
  217. private void settings_AuthenticateButton_Click(object sender, EventArgs e)
  218. {
  219. JObject jobject1 = this.authenticate(((Control) this.settings_UsernameCombo).Text, ((Control) this.settings_PasswordCombo).Text, 0);
  220. string str = ((object) jobject1.Property("status").get_Value()).ToString();
  221. if (!(str == "success"))
  222. {
  223. if (!(str == "user/pw"))
  224. {
  225. if (!(str == "mac"))
  226. {
  227. if (!(str == "newmac"))
  228. {
  229. if (!(str == "except"))
  230. {
  231. int num1 = (int) MessageBox.Show("Authentication problem! Please contact discord for help!", "Authentication");
  232. }
  233. else
  234. {
  235. int num2 = (int) MessageBox.Show("Authentication problem! Please contact discord for help!", "Authentication");
  236. }
  237. }
  238. else
  239. {
  240. JObject jobject2 = new JObject();
  241. jobject2.Add("username", JToken.op_Implicit(((Control) this.settings_UsernameCombo).Text));
  242. jobject2.Add("password", JToken.op_Implicit(((Control) this.settings_PasswordCombo).Text));
  243. System.IO.File.WriteAllText("auth.json", JsonConvert.SerializeObject((object) jobject2, (Formatting) 1));
  244. int num3 = (int) MessageBox.Show("Registered new device!", "Authentication");
  245. this.Hide();
  246. new MainForm(((object) jobject1.Property("acc_type").get_Value()).ToString()).Show();
  247. }
  248. }
  249. else
  250. {
  251. int num4 = (int) MessageBox.Show("Multiple devices not allowed! Use discord bot to reset!", "Authentication");
  252. }
  253. }
  254. else
  255. {
  256. int num5 = (int) MessageBox.Show("Wrong username/password!", "Authentication");
  257. }
  258. }
  259. else
  260. {
  261. JObject jobject2 = new JObject();
  262. jobject2.Add("username", JToken.op_Implicit(((Control) this.settings_UsernameCombo).Text));
  263. jobject2.Add("password", JToken.op_Implicit(((Control) this.settings_PasswordCombo).Text));
  264. System.IO.File.WriteAllText("auth.json", JsonConvert.SerializeObject((object) jobject2, (Formatting) 1));
  265. this.Hide();
  266. new MainForm(((object) jobject1.Property("acc_type").get_Value()).ToString()).Show();
  267. }
  268. }
  269.  
  270. protected override void Dispose(bool disposing)
  271. {
  272. if ((!disposing ? 0 : (this.components != null ? 1 : 0)) != 0)
  273. this.components.Dispose();
  274. base.Dispose(disposing);
  275. }
  276.  
  277. private void InitializeComponent()
  278. {
  279. this.components = (IContainer) new Container();
  280. ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (AuthForm));
  281. this.AuthFormElipse = new BunifuElipse(this.components);
  282. this.gifPictureBox = new PictureBox();
  283. this.settings_AuthenticationPanel = new Panel();
  284. this.settings_AuthenticateButton = new BunifuThinButton2();
  285. this.settings_PasswordCombo = new BunifuMaterialTextbox();
  286. this.settings_UsernameCombo = new BunifuMaterialTextbox();
  287. this.settings_PasswordLabel = new Label();
  288. this.settings_UsernameLabel = new Label();
  289. this.settings_AuthenticationPanelElipse = new BunifuElipse(this.components);
  290. ((ISupportInitialize) this.gifPictureBox).BeginInit();
  291. this.settings_AuthenticationPanel.SuspendLayout();
  292. this.SuspendLayout();
  293. this.AuthFormElipse.set_ElipseRadius(10);
  294. this.AuthFormElipse.set_TargetControl((Control) this);
  295. this.gifPictureBox.Image = (Image) componentResourceManager.GetObject("gifPictureBox.Image");
  296. this.gifPictureBox.Location = new Point(0, 0);
  297. this.gifPictureBox.Name = "gifPictureBox";
  298. this.gifPictureBox.Size = new Size(321, 240);
  299. this.gifPictureBox.TabIndex = 0;
  300. this.gifPictureBox.TabStop = false;
  301. this.gifPictureBox.Click += new EventHandler(this.pictureBox1_Click);
  302. this.settings_AuthenticationPanel.BackColor = Color.FromArgb(37, 35, 43);
  303. this.settings_AuthenticationPanel.Controls.Add((Control) this.settings_AuthenticateButton);
  304. this.settings_AuthenticationPanel.Controls.Add((Control) this.settings_PasswordCombo);
  305. this.settings_AuthenticationPanel.Controls.Add((Control) this.settings_UsernameCombo);
  306. this.settings_AuthenticationPanel.Controls.Add((Control) this.settings_PasswordLabel);
  307. this.settings_AuthenticationPanel.Controls.Add((Control) this.settings_UsernameLabel);
  308. this.settings_AuthenticationPanel.Location = new Point(10, 26);
  309. this.settings_AuthenticationPanel.Name = "settings_AuthenticationPanel";
  310. this.settings_AuthenticationPanel.Size = new Size(298, 186);
  311. this.settings_AuthenticationPanel.TabIndex = 18;
  312. this.settings_AuthenticateButton.set_ActiveBorderThickness(1);
  313. this.settings_AuthenticateButton.set_ActiveCornerRadius(20);
  314. this.settings_AuthenticateButton.set_ActiveFillColor(Color.LightSeaGreen);
  315. this.settings_AuthenticateButton.set_ActiveForecolor(Color.White);
  316. this.settings_AuthenticateButton.set_ActiveLineColor(Color.LightSeaGreen);
  317. ((Control) this.settings_AuthenticateButton).BackColor = Color.FromArgb(37, 35, 43);
  318. ((Control) this.settings_AuthenticateButton).BackgroundImage = (Image) componentResourceManager.GetObject("settings_AuthenticateButton.BackgroundImage");
  319. this.settings_AuthenticateButton.set_ButtonText("AUTHENTICATE");
  320. ((Control) this.settings_AuthenticateButton).Cursor = Cursors.Hand;
  321. ((Control) this.settings_AuthenticateButton).Font = new Font("Nirmala UI", 9.75f, FontStyle.Bold);
  322. ((Control) this.settings_AuthenticateButton).ForeColor = Color.LightSeaGreen;
  323. this.settings_AuthenticateButton.set_IdleBorderThickness(1);
  324. this.settings_AuthenticateButton.set_IdleCornerRadius(20);
  325. this.settings_AuthenticateButton.set_IdleFillColor(Color.Transparent);
  326. this.settings_AuthenticateButton.set_IdleForecolor(Color.Transparent);
  327. this.settings_AuthenticateButton.set_IdleLineColor(Color.LightSeaGreen);
  328. ((Control) this.settings_AuthenticateButton).Location = new Point(101, 124);
  329. ((Control) this.settings_AuthenticateButton).Margin = new Padding(4, 4, 4, 4);
  330. ((Control) this.settings_AuthenticateButton).Name = "settings_AuthenticateButton";
  331. ((Control) this.settings_AuthenticateButton).Size = new Size(166, 39);
  332. ((Control) this.settings_AuthenticateButton).TabIndex = 20;
  333. this.settings_AuthenticateButton.set_TextAlign(ContentAlignment.MiddleCenter);
  334. this.settings_AuthenticateButton.add_Click(new EventHandler(this.settings_AuthenticateButton_Click));
  335. ((Control) this.settings_PasswordCombo).Cursor = Cursors.IBeam;
  336. ((Control) this.settings_PasswordCombo).Font = new Font("Microsoft YaHei UI", 9.75f, FontStyle.Bold);
  337. ((Control) this.settings_PasswordCombo).ForeColor = Color.White;
  338. this.settings_PasswordCombo.set_HintForeColor(Color.Gray);
  339. this.settings_PasswordCombo.set_HintText("");
  340. this.settings_PasswordCombo.set_isPassword(false);
  341. this.settings_PasswordCombo.set_LineFocusedColor(Color.LightSeaGreen);
  342. this.settings_PasswordCombo.set_LineIdleColor(Color.Gray);
  343. this.settings_PasswordCombo.set_LineMouseHoverColor(Color.LightSeaGreen);
  344. this.settings_PasswordCombo.set_LineThickness(4);
  345. ((Control) this.settings_PasswordCombo).Location = new Point(101, 70);
  346. ((Control) this.settings_PasswordCombo).Margin = new Padding(4);
  347. ((Control) this.settings_PasswordCombo).Name = "settings_PasswordCombo";
  348. ((Control) this.settings_PasswordCombo).Size = new Size(164, 33);
  349. ((Control) this.settings_PasswordCombo).TabIndex = 18;
  350. this.settings_PasswordCombo.set_TextAlign(HorizontalAlignment.Left);
  351. ((Control) this.settings_UsernameCombo).Cursor = Cursors.IBeam;
  352. ((Control) this.settings_UsernameCombo).Font = new Font("Microsoft YaHei UI", 9.75f, FontStyle.Bold);
  353. ((Control) this.settings_UsernameCombo).ForeColor = Color.White;
  354. this.settings_UsernameCombo.set_HintForeColor(Color.Gray);
  355. this.settings_UsernameCombo.set_HintText("");
  356. this.settings_UsernameCombo.set_isPassword(false);
  357. this.settings_UsernameCombo.set_LineFocusedColor(Color.LightSeaGreen);
  358. this.settings_UsernameCombo.set_LineIdleColor(Color.Gray);
  359. this.settings_UsernameCombo.set_LineMouseHoverColor(Color.LightSeaGreen);
  360. this.settings_UsernameCombo.set_LineThickness(4);
  361. ((Control) this.settings_UsernameCombo).Location = new Point(101, 28);
  362. ((Control) this.settings_UsernameCombo).Margin = new Padding(4);
  363. ((Control) this.settings_UsernameCombo).Name = "settings_UsernameCombo";
  364. ((Control) this.settings_UsernameCombo).Size = new Size(164, 33);
  365. ((Control) this.settings_UsernameCombo).TabIndex = 17;
  366. this.settings_UsernameCombo.set_TextAlign(HorizontalAlignment.Left);
  367. this.settings_PasswordLabel.AutoSize = true;
  368. this.settings_PasswordLabel.ForeColor = Color.White;
  369. this.settings_PasswordLabel.Location = new Point(23, 77);
  370. this.settings_PasswordLabel.Name = "settings_PasswordLabel";
  371. this.settings_PasswordLabel.Size = new Size(70, 17);
  372. this.settings_PasswordLabel.TabIndex = 16;
  373. this.settings_PasswordLabel.Text = "password:";
  374. this.settings_UsernameLabel.AutoSize = true;
  375. this.settings_UsernameLabel.ForeColor = Color.White;
  376. this.settings_UsernameLabel.Location = new Point(21, 36);
  377. this.settings_UsernameLabel.Name = "settings_UsernameLabel";
  378. this.settings_UsernameLabel.Size = new Size(72, 17);
  379. this.settings_UsernameLabel.TabIndex = 15;
  380. this.settings_UsernameLabel.Text = "username:";
  381. this.settings_AuthenticationPanelElipse.set_ElipseRadius(15);
  382. this.settings_AuthenticationPanelElipse.set_TargetControl((Control) this.settings_AuthenticationPanel);
  383. this.AutoScaleMode = AutoScaleMode.None;
  384. this.BackColor = Color.FromArgb(30, 28, 34);
  385. this.ClientSize = new Size(320, 240);
  386. this.Controls.Add((Control) this.settings_AuthenticationPanel);
  387. this.Controls.Add((Control) this.gifPictureBox);
  388. this.Font = new Font("Nirmala UI", 9.75f, FontStyle.Bold);
  389. this.ForeColor = Color.White;
  390. this.FormBorderStyle = FormBorderStyle.None;
  391. this.Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
  392. this.Name = nameof (AuthForm);
  393. this.StartPosition = FormStartPosition.CenterScreen;
  394. this.Text = nameof (AuthForm);
  395. this.Load += new EventHandler(this.AuthForm_Load);
  396. ((ISupportInitialize) this.gifPictureBox).EndInit();
  397. this.settings_AuthenticationPanel.ResumeLayout(false);
  398. this.settings_AuthenticationPanel.PerformLayout();
  399. this.ResumeLayout(false);
  400. }
  401.  
  402. private delegate void ShowAuthDelegate(PictureBox ctrl);
  403.  
  404. private delegate void HideDelegate(Form ctrl, string acc);
  405.  
  406. private delegate void SetUsernameDelegate(BunifuMaterialTextbox ctrl, string acc);
  407.  
  408. private delegate void SetPasswordDelegate(BunifuMaterialTextbox ctrl, string acc);
  409. }
  410. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement