Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Phoenix
- {
- using Microsoft.Win32;
- using MySql.Data.MySqlClient;
- using Phoenix.Communication;
- using Phoenix.Core;
- using Phoenix.HabboHotel;
- using Phoenix.Messages;
- using Phoenix.Net;
- using Phoenix.Storage;
- using Phoenix.Util;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Net;
- using System.Security.Cryptography;
- using System.Text;
- internal class Class4
- {
- public static bool bool_0 = false;
- private static bool bool_1 = false;
- private static Class110 class110_0;
- private static Class14 class14_0;
- private static Class16 class16_0;
- private static Class2 class2_0;
- private static Class310 class310_0;
- private static Class5 class5_0;
- internal static DateTime dateTime_0;
- private static Encoding encoding_0;
- public const int int_0 = 0x3722;
- public static int int_1 = 0;
- public const string string_0 = "otaku-studios.com";
- public const string string_1 = "http://otaku-studios.com/phx/";
- public string string_2 = smethod_1(0x3722.ToString());
- public string string_3 = ("http://otaku-studios.com/phx/licence" + Convert.ToChar(0x2e).ToString() + "php" + Convert.ToChar(0x3f).ToString());
- public static string string_4 = ("http://otaku-studios.com/phx/override" + Convert.ToChar(0x2e).ToString() + Convert.ToChar(0x74).ToString() + Convert.ToChar(120).ToString() + Convert.ToChar(0x74).ToString());
- public static string string_5 = smethod_20(string_4);
- public static string string_6;
- private static string string_7;
- public void method_0()
- {
- string environmentVariable = Environment.GetEnvironmentVariable("windir");
- string str2 = System.IO.File.ReadAllText(environmentVariable + @"\system32\drivers\etc\hosts");
- if (!((str2 != null) ? !str2.Contains("otaku") : false))
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Unable to contact licence server! Try again later", false);
- }
- else
- {
- dateTime_0 = DateTime.Now;
- Console.Title = "Loading Phoenix emulator";
- encoding_0 = Encoding.Default;
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine();
- Console.WriteLine(" ______ _ _ _______ ");
- Console.WriteLine(@" (_____ \| | (_) (_______) ");
- Console.WriteLine(" _____) ) | _ ___ ____ ____ _ _ _ _____ ____ _ _ ");
- Console.WriteLine(@" | ____/| || \ / _ \ / _ ) _ \| ( \ / ) | ___) | \| | | |");
- Console.WriteLine(" | | | | | | |_| ( (/ /| | | | |) X ( | |_____| | | | |_| |");
- Console.WriteLine(@" |_| |_| |_|\___/ \____)_| |_|_(_/ \_) |_______)_|_|_|\____|");
- Console.WriteLine();
- Console.WriteLine(" " + String_0);
- if (int_1 > 0x3722)
- {
- Console.ForegroundColor = ConsoleColor.DarkGreen;
- Console.WriteLine(" Build: " + int_1 + " available for download");
- }
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine();
- Console.WriteLine(" Dedicated and VPS Hosting available at Otaku-Hosting.com");
- Console.WriteLine(" VPS Hosting from just \x00a34.99 for the first month with coupon OTAKU50!");
- Console.WriteLine();
- try
- {
- Console.ForegroundColor = ConsoleColor.Gray;
- class14_0 = new Class14("config.conf");
- DateTime now = DateTime.Now;
- string_6 = smethod_11().dictionary_0["Otaku-Studios.username"];
- string_7 = smethod_11().dictionary_0["Otaku-Studios.password"];
- int num = string_6.Length * string_7.Length;
- if (((string_6 != "") && (string_7 != "")) && !Class19.Boolean_7)
- {
- Class19.String_6 = string_6;
- Class19.String_3 = string_7;
- string str3 = "";
- try
- {
- RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
- key.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", 0);
- key.Flush();
- key.Close();
- int num3 = (int) Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true).GetValue("ProxyEnable");
- if (num3 != 0)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Proxy detected - Phoenix is unable to connect to Otaku to verify your account details.", false);
- return;
- }
- if (str3 == "")
- {
- if (System.IO.File.ReadAllText(environmentVariable + @"\system32\drivers\etc\hosts").Contains("otaku"))
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Unable to contact licence server! Try again later", false);
- return;
- }
- if (this.string_3.Contains(Convert.ToChar(0x2e).ToString() + "php" + Convert.ToChar(0x3f).ToString()))
- {
- str3 = smethod_20(this.string_3);
- }
- }
- }
- catch
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Proxy detected - Phoenix is unable to connect to Otaku to verify your account details.", false);
- return;
- }
- if (bool_0)
- {
- string str5 = smethod_1(smethod_0(smethod_0(str3.Substring(0x20, 0x20) + string_6) + "4g") + string_7);
- string str6 = smethod_0(num.ToString());
- if (str3.Substring(0, 0x20) == str6)
- {
- GClass2 class2 = new GClass2(smethod_11().dictionary_0["db.hostname"], uint.Parse(smethod_11().dictionary_0["db.port"]), smethod_11().dictionary_0["db.username"], smethod_11().dictionary_0["db.password"]);
- str3 = str3.Substring(0x40, 0x60);
- GClass1 class3 = new GClass1(smethod_11().dictionary_0["db.name"], uint.Parse(smethod_11().dictionary_0["db.pool.minsize"]), uint.Parse(smethod_11().dictionary_0["db.pool.maxsize"]));
- class2_0 = new Class2(class2, class3);
- Class19.String_1 = str3;
- class5_0 = new Class5(int.Parse(smethod_11().dictionary_0["game.tcp.conlimit"]));
- string str4 = "";
- int num2 = Class19.String_6.Length * 0x3722;
- num2 = Class19.String_3.Length % 0x3722;
- str4 = Class19.String_5 + smethod_0(num2.ToString()) + smethod_0(num2.ToString());
- if (!(str3 == str4))
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Invalid Licence details found #0003", false);
- }
- else
- {
- if (str3.Length == 0x60)
- {
- class110_0 = new Class110();
- class110_0.method_1();
- class110_0.method_2();
- class110_0.method_3();
- class110_0.method_4();
- class110_0.method_5();
- class110_0.method_6();
- class110_0.method_7();
- class110_0.method_8();
- class110_0.method_9();
- class110_0.method_10();
- class110_0.method_11();
- class110_0.method_12();
- class110_0.method_13();
- class110_0.method_14();
- class110_0.method_15();
- class110_0.method_21();
- class110_0.method_20();
- class110_0.method_18();
- class110_0.method_17();
- class110_0.method_16();
- class110_0.method_19();
- class110_0.method_22();
- class110_0.method_24();
- class110_0.method_23();
- class110_0.method_25();
- class110_0.method_26();
- class110_0.method_27();
- }
- class310_0 = new Class310(smethod_11().dictionary_0["mus.tcp.bindip"], int.Parse(smethod_11().dictionary_0["mus.tcp.port"]), smethod_11().dictionary_0["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20);
- Class19.Boolean_7 = str3 == str4;
- class16_0 = new Class16(smethod_11().dictionary_0["game.tcp.bindip"], int.Parse(smethod_11().dictionary_0["game.tcp.port"]), int.Parse(smethod_11().dictionary_0["game.tcp.conlimit"]));
- class16_0.method_3().method_0();
- TimeSpan span = (TimeSpan) (DateTime.Now - now);
- GClass3.smethod_0(string.Concat(new object[] { "Server -> READY! (", span.Seconds, " s, ", span.Milliseconds, " ms)" }));
- Console.Beep();
- }
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Invalid Licence details found #0001", false);
- }
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- if (int_1 != 0)
- {
- Console.WriteLine("An update is required to continue use of Phoenix Emulator");
- Console.WriteLine("Please visit Otaku-Studios.com for more information");
- Console.WriteLine("Your build: " + 0x3722);
- Console.WriteLine("Current build: " + int_1);
- }
- else
- {
- Console.WriteLine("Your firewall is preventing Phoenix from starting");
- }
- }
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Invalid Licence details found #0001", false);
- }
- }
- catch (KeyNotFoundException)
- {
- GClass3.smethod_0("Please check your configuration file - some values appear to be missing.");
- GClass3.smethod_0("Press any key to shut down ...");
- Console.ReadKey(true);
- smethod_16();
- }
- catch (InvalidOperationException exception)
- {
- GClass3.smethod_0("Failed to initialize PhoenixEmulator: " + exception.Message);
- GClass3.smethod_0("Press any key to shut down ...");
- Console.ReadKey(true);
- smethod_16();
- }
- }
- }
- public static string smethod_0(string text1)
- {
- MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
- byte[] bytes = Encoding.UTF8.GetBytes(text1);
- bytes = provider.ComputeHash(bytes);
- StringBuilder builder = new StringBuilder();
- foreach (byte num2 in bytes)
- {
- builder.Append(num2.ToString("x2").ToLower());
- }
- return builder.ToString().ToUpper();
- }
- public static string smethod_1(string text1)
- {
- byte[] bytes = Encoding.ASCII.GetBytes(text1);
- byte[] buffer2 = new SHA1Managed().ComputeHash(bytes);
- string str = string.Empty;
- foreach (byte num2 in buffer2)
- {
- str = str + num2.ToString("X2");
- }
- return str;
- }
- public static Class110 smethod_10()
- {
- return class110_0;
- }
- public static Class14 smethod_11()
- {
- return class14_0;
- }
- public static Class2 smethod_12()
- {
- return class2_0;
- }
- public static Encoding smethod_13()
- {
- return encoding_0;
- }
- public static Class16 smethod_14()
- {
- return class16_0;
- }
- internal static Class5 smethod_15()
- {
- return class5_0;
- }
- public static void smethod_16()
- {
- GClass3.smethod_0("Destroying PhoenixEmu environment...");
- if (smethod_15() != null)
- {
- smethod_15().method_1();
- class5_0 = null;
- }
- if (smethod_14() != null)
- {
- GClass3.smethod_0("Destroying connection manager.");
- smethod_14().method_3().method_2();
- smethod_14().method_0();
- class16_0 = null;
- }
- if (smethod_12() != null)
- {
- try
- {
- GClass3.smethod_0("Destroying database manager.");
- MySqlConnection.ClearAllPools();
- class2_0 = null;
- }
- catch
- {
- }
- }
- GClass3.smethod_0("Uninitialized successfully. Closing.");
- }
- internal static void smethod_17(string text1)
- {
- try
- {
- GClass4 class2 = new GClass4(0x8b);
- class2.method_7(text1);
- smethod_15().method_2().method_12(class2);
- }
- catch
- {
- }
- }
- internal static void smethod_18()
- {
- smethod_19("", true);
- }
- internal static void smethod_19(string text1, bool flag1)
- {
- if (text1 != "")
- {
- if (bool_1)
- {
- return;
- }
- GClass3.smethod_6();
- smethod_17("ATTENTION:\r\nThe server is shutting down. All furniture placed in rooms/traded/bought after this message is on your own responsibillity.");
- bool_1 = true;
- Console.WriteLine("Server shutting down...");
- try
- {
- class5_0.method_9().method_4();
- }
- catch
- {
- }
- try
- {
- smethod_14().method_3().method_1();
- smethod_15().method_2().method_20();
- }
- catch
- {
- }
- try
- {
- using (Class1 class2 = smethod_12().method_0())
- {
- class2.method_1("UPDATE users SET online = '0'");
- class2.method_1("UPDATE rooms SET users_now = '0'");
- }
- class16_0.method_7();
- class5_0.method_1();
- }
- catch
- {
- }
- try
- {
- Console.WriteLine("Destroying database manager.");
- MySqlConnection.ClearAllPools();
- class2_0 = null;
- }
- catch
- {
- }
- Console.WriteLine("System disposed, goodbye!");
- }
- else
- {
- GClass3.smethod_6();
- bool_1 = true;
- try
- {
- class5_0.method_9().method_4();
- }
- catch
- {
- }
- try
- {
- smethod_14().method_3().method_1();
- smethod_15().method_2().method_20();
- }
- catch
- {
- }
- class16_0.method_7();
- class5_0.method_1();
- Console.WriteLine(text1);
- }
- if (flag1)
- {
- Environment.Exit(1);
- }
- }
- public static int smethod_2(string text1)
- {
- return Convert.ToInt32(text1);
- }
- public static string smethod_20(string text1)
- {
- WebProxy proxy;
- Class4 class2 = new Class4();
- Uri address = new Uri(text1);
- string host = address.Host;
- if ((host == null) || ((host != "otaku-studios.com") && (host != "api.adf.ly")))
- {
- Console.ForegroundColor = ConsoleColor.Red;
- smethod_19("Invalid Licence details found #0004", false);
- smethod_18();
- }
- proxy = new WebProxy(address, true) {
- Address = WebRequest.DefaultWebProxy.GetProxy(address),
- BypassProxyOnLocal = WebRequest.DefaultWebProxy.IsBypassed(proxy.Address),
- Credentials = CredentialCache.DefaultCredentials
- };
- WebRequest request = WebRequest.Create(address);
- request.Proxy = null;
- request.Headers.Add("AuthName", string_6);
- request.Headers.Add("AuthPass", string_7);
- int num = 0x3722;
- request.Headers.Add("AuthBuild", num.ToString());
- request.Headers.Add("AuthMachine", Environment.MachineName);
- request.Headers.Add("AuthServer", "Phoenix");
- WebResponse response = request.GetResponse();
- Dictionary<string, string> dictionary = new Dictionary<string, string>();
- foreach (string str4 in response.Headers)
- {
- dictionary.Add(str4, response.Headers[str4]);
- }
- if (text1 == class2.string_3)
- {
- if (dictionary["AuthU"] != string_6.Length.ToString())
- {
- return null;
- }
- if (dictionary.ContainsKey("MinBuild"))
- {
- int_1 = Convert.ToInt16(dictionary["MinBuild"]);
- if (int_1 <= 0x3722)
- {
- bool_0 = true;
- }
- else if (int_1 > 0x3722)
- {
- bool_0 = false;
- }
- }
- if (dictionary.ContainsKey("AuthGen"))
- {
- return dictionary["AuthGen"];
- }
- }
- StreamReader reader = new StreamReader(response.GetResponseStream());
- return reader.ReadToEnd();
- }
- public static bool smethod_21(int num1, int num2)
- {
- return ((num1 % num2) == 0);
- }
- public static bool smethod_3(string text1)
- {
- return (text1 == "1");
- }
- public static string smethod_4(bool flag1)
- {
- if (!flag1)
- {
- return "0";
- }
- return "1";
- }
- public static int smethod_5(int num1, int num3)
- {
- RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
- byte[] data = new byte[4];
- provider.GetBytes(data);
- return new Random(BitConverter.ToInt32(data, 0)).Next(num1, num3 + 1);
- }
- public static double smethod_6()
- {
- TimeSpan span = (TimeSpan) (DateTime.UtcNow - new DateTime(0x7b2, 1, 1, 0, 0, 0));
- return span.TotalSeconds;
- }
- public static string smethod_7(string text1)
- {
- return smethod_8(text1, false, false);
- }
- public static string smethod_8(string text1, bool flag1, bool flag2)
- {
- text1 = text1.Replace(Convert.ToChar(1), ' ');
- text1 = text1.Replace(Convert.ToChar(2), ' ');
- text1 = text1.Replace(Convert.ToChar(9), ' ');
- if (!flag1)
- {
- text1 = text1.Replace(Convert.ToChar(13), ' ');
- }
- if (flag2)
- {
- text1 = text1.Replace('\'', ' ');
- }
- return text1;
- }
- public static bool smethod_9(string text1)
- {
- if (string.IsNullOrEmpty(text1))
- {
- return false;
- }
- for (int i = 0; i < text1.Length; i++)
- {
- if (!(char.IsLetter(text1[i]) || char.IsNumber(text1[i])))
- {
- return false;
- }
- }
- return true;
- }
- internal static Class5 Class5_0
- {
- get
- {
- return class5_0;
- }
- set
- {
- class5_0 = value;
- }
- }
- public static string String_0
- {
- get
- {
- return ("Phoenix v3.8.0 (Build " + 0x3722 + ")");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment