Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- namespace TarkovBot
- {
- class Program
- {
- static async Task Main(string[] args)
- {
- var req = new Requester("YOUR SESSION");
- await req.PostJson(Requester.PROD_ENDPOINT + "/client/game/profile/list", "");
- }
- }
- }
- using System;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
- using System.Net.Http.Headers;
- using System.Net.Http;
- using System.Net;
- namespace TarkovBot
- {
- public class Requester
- {
- private static HttpClient client;
- public const string LAUNCHER_ENDPOINT = "https://launcher.escapefromtarkov.com";
- public const string PROD_ENDPOINT = "https://prod.escapefromtarkov.com";
- public const string TRADING_ENDPOINT = "https://trading.escapefromtarkov.com";
- public const string RAGFAIR_ENDPOINT = "https://ragfair.escapefromtarkov.com";
- private const string BSG_LAUNCHER_VERSION = "0.9.2.970";
- private const string EFT_CLIENT_VERSION = "0.12.3.5776";
- private const string UNITY_VERSION = "2018.4.13f1";
- public Requester(string session)
- {
- var cookies = new CookieContainer();
- cookies.Add(new Uri(PROD_ENDPOINT), new Cookie("PHPSESSID", session));
- var handler = new HttpClientHandler
- {
- CookieContainer = cookies,
- UseCookies = true,
- ClientCertificateOptions = ClientCertificateOption.Automatic
- };
- client = new HttpClient(handler);
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- client.DefaultRequestHeaders.Add("User-Agent", $"UnityPlayer/{UNITY_VERSION} (UnityWebRequest/1.0, libcurl/7.52.0-DEV)");
- client.DefaultRequestHeaders.Add("App-Version", $"EFT Client {EFT_CLIENT_VERSION}");
- client.DefaultRequestHeaders.Add("X-Unity-Version", UNITY_VERSION);
- }
- public async Task PostJson(string uri, string body)
- {
- var content = new StringContent(body, Encoding.UTF8, "application/json");
- content.Headers.ContentType.CharSet = "";
- var response = await client.PostAsync("https://prod.escapefromtarkov.com/client/game/profile/list", content);
- byte[] data = await response.Content.ReadAsByteArrayAsync();
- Console.WriteLine("Status code: " + response.StatusCode);
- byte[] decompressedData = new byte[data.Length];
- int decompressedLength = 0;
- using (MemoryStream memory = new MemoryStream(data))
- using (InflaterInputStream inflater = new InflaterInputStream(memory))
- decompressedLength = inflater.Read(decompressedData, 0, decompressedData.Length);
- Console.WriteLine("Content:");
- Console.WriteLine(Encoding.Default.GetString(decompressedData));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment