-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInjectorRequests.cs
112 lines (107 loc) · 3.69 KB
/
InjectorRequests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Demon_Panel
{
internal class InjectorRequests
{
internal class Injector
{
public static string Base64Encode(string plainText)
{
return Convert.ToBase64String(Encoding.UTF8.GetBytes(plainText));
}
public static string Base64Decode(string base64EncodedData)
{
return Encoding.UTF8.GetString(Convert.FromBase64String(base64EncodedData));
}
public static string Dump_FullProfile()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create($"https://{Main.Host}.live.bhvrdbd.com/api/v1/players/me/states/FullProfile/binary");
httpWebRequest.Method = "GET";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Accept = "*/*";
httpWebRequest.Headers["Accept-Encoding"] = "deflate, gzip";
httpWebRequest.UserAgent = Main.UserAgent;
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers["x-kraken-client-platform"] = Main.Kraken;
httpWebRequest.Headers["x-kraken-client-provider"] = Main.Kraken;
httpWebRequest.Headers["x-kraken-client-version"] = "4.0.2";
Cookie cookie = new Cookie();
cookie.Name = "bhvrSession";
cookie.Value = Main.BHVRSession;
cookie.Domain = $"{Main.Host}.live.bhvrdbd.com";
httpWebRequest.CookieContainer = new CookieContainer();
httpWebRequest.CookieContainer.Add(cookie);
krakenstate = string.Empty;
string result = null;
try
{
using (WebResponse response = httpWebRequest.GetResponse())
{
using (HttpWebResponse httpWebResponse = (HttpWebResponse)response)
{
krakenstate = httpWebResponse.Headers["Kraken-State-Version"].Split(new char[]
{
';'
})[0];
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader streamReader = new StreamReader(responseStream))
{
result = streamReader.ReadLine();
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return result;
}
public static string krakenstate;
public static bool Inject_FullProfile(string fullProfile)
{
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create($"https://{Main.Host}.live.bhvrdbd.com/api/v1/players/me/states/binary?stateName=FullProfile&version={krakenstate}&schemaVersion=0");
httpWebRequest.Method = "POST";
httpWebRequest.ProtocolVersion = HttpVersion.Version11;
httpWebRequest.Host = $"{Main.Host}.live.bhvrdbd.com";
httpWebRequest.Accept = "*/*";
httpWebRequest.Headers.Add(HttpRequestHeader.AcceptEncoding, "deflate, gzip");
httpWebRequest.Headers.Add("Cookie", "bhvrSession=" + Main.BHVRSession);
byte[] bytes = Encoding.UTF8.GetBytes(fullProfile);
httpWebRequest.ContentType = "application/octet-stream";
httpWebRequest.Headers["x-kraken-client-platform"] = Main.Kraken;
httpWebRequest.Headers["x-kraken-client-provider"] = Main.Kraken;
httpWebRequest.Headers["x-kraken-client-version"] = "4.0.2";
httpWebRequest.UserAgent = Main.UserAgent;
httpWebRequest.ContentLength = (long)bytes.Length;
bool result;
try
{
using (System.IO.Stream requestStream = httpWebRequest.GetRequestStream())
{
requestStream.Write(bytes, 0, bytes.Length);
}
httpWebRequest.GetResponse();
result = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
result = false;
}
return result;
}
}
}
}