Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Net;
  4. using System.Text;
  5.  
  6. namespace TriUtils
  7. {
  8. // Token: 0x02000002 RID: 2
  9. public class Program
  10. {
  11. // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
  12. private string GetLocalIPAddress()
  13. {
  14. return new WebClient().DownloadString("http://icanhazip.com").Trim();
  15. }
  16.  
  17. // Token: 0x06000002 RID: 2 RVA: 0x00002078 File Offset: 0x00000278
  18. public Program.changeIPResult changeIP(string licensekey, string product)
  19. {
  20. string localIPAddress = this.GetLocalIPAddress();
  21. Program.changeIPResult result;
  22. try
  23. {
  24. HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://tridentplugins.me/licensekeys/changeip.php");
  25. httpWebRequest.Method = "POST";
  26. httpWebRequest.ContentType = "application/x-www-form-urlencoded";
  27. using (Stream requestStream = httpWebRequest.GetRequestStream())
  28. {
  29. byte[] bytes = Encoding.UTF8.GetBytes(string.Concat(new string[]
  30. {
  31. "keyt=",
  32. licensekey,
  33. "&productt=",
  34. product,
  35. "&ipt=",
  36. localIPAddress,
  37. "&btn=Submit+Query"
  38. }));
  39. requestStream.Write(bytes, 0, bytes.Length);
  40. }
  41. HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
  42. string text = string.Empty;
  43. using (StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()))
  44. {
  45. text = streamReader.ReadToEnd();
  46. }
  47. switch (text[text.Length - 1])
  48. {
  49. case '0':
  50. result = Program.changeIPResult.succesfull;
  51. break;
  52. case '1':
  53. result = Program.changeIPResult.notfound;
  54. break;
  55. case '2':
  56. result = Program.changeIPResult.already;
  57. break;
  58. default:
  59. result = Program.changeIPResult.notfound;
  60. break;
  61. }
  62. }
  63. catch
  64. {
  65. result = Program.changeIPResult.error;
  66. }
  67. return result;
  68. }
  69.  
  70. // Token: 0x06000003 RID: 3 RVA: 0x000021E8 File Offset: 0x000003E8
  71. public Program.lkeyresult check(string licensekey, string product)
  72. {
  73. string localIPAddress = this.GetLocalIPAddress();
  74. bool flag = localIPAddress == "0";
  75. Program.lkeyresult result;
  76. if (flag)
  77. {
  78. result = Program.lkeyresult.error;
  79. }
  80. else
  81. {
  82. Program.Instance = this;
  83. try
  84. {
  85. HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://tridentplugins.me/licensekeys/check.php");
  86. httpWebRequest.Method = "POST";
  87. httpWebRequest.ContentType = "application/x-www-form-urlencoded";
  88. using (Stream requestStream = httpWebRequest.GetRequestStream())
  89. {
  90. byte[] bytes = Encoding.UTF8.GetBytes(string.Concat(new string[]
  91. {
  92. "keyt=",
  93. licensekey,
  94. "&productt=",
  95. product,
  96. "&ipt=",
  97. localIPAddress,
  98. "&btn=Submit+Query"
  99. }));
  100. requestStream.Write(bytes, 0, bytes.Length);
  101. }
  102. HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
  103. string text = string.Empty;
  104. using (StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()))
  105. {
  106. text = streamReader.ReadToEnd();
  107. }
  108. switch (text[text.Length - 1])
  109. {
  110. case '0':
  111. return Program.lkeyresult.match;
  112. case '1':
  113. return Program.lkeyresult.not_whitelised;
  114. case '2':
  115. return Program.lkeyresult.no_match;
  116. default:
  117. return Program.lkeyresult.no_match;
  118. }
  119. }
  120. catch
  121. {
  122. }
  123. result = Program.lkeyresult.error;
  124. }
  125. return result;
  126. }
  127.  
  128. // Token: 0x04000001 RID: 1
  129. public static Program Instance = new Program();
  130.  
  131. // Token: 0x02000003 RID: 3
  132. public enum lkeyresult
  133. {
  134. // Token: 0x04000003 RID: 3
  135. match,
  136. // Token: 0x04000004 RID: 4
  137. not_whitelised,
  138. // Token: 0x04000005 RID: 5
  139. no_match,
  140. // Token: 0x04000006 RID: 6
  141. error
  142. }
  143.  
  144. // Token: 0x02000004 RID: 4
  145. public enum changeIPResult
  146. {
  147. // Token: 0x04000008 RID: 8
  148. succesfull,
  149. // Token: 0x04000009 RID: 9
  150. notfound,
  151. // Token: 0x0400000A RID: 10
  152. already,
  153. // Token: 0x0400000B RID: 11
  154. error
  155. }
  156. }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement