/// <summary> /// Fetch latest version's main aes key. /// </summary> /// <returns></returns> private async Task SetMainKey() { dynamic key = null; if (DLLImport.IsInternetAvailable()) { try { using (HttpClient web = new HttpClient()) { //Not using BenBot api since Rate Limit key = JsonConvert.DeserializeObject(await web.GetStringAsync("https://fnbot.shop/api/aes.json")); } MAesTextBox.Text = $"0x{key.aes}"; FProp.Default.FPak_MainAES = $"{key.aes}"; } catch (Exception) { new UpdateMyConsole("There was a problem getting the latest aes key for main pak files.", CColors.Blue, true).Append(); } } else { new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", CColors.Blue, true).Append(); } }
public IntPtr HandleMouse(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam) { c.Send(new byte[2] { 1, 0 }, 2, Constants.BROADCAST, Constants.PORT); } if (nCode >= 0 && MouseMessages.WM_LBUTTONUP == (MouseMessages)wParam) { c.Send(new byte[2] { 0, 0 }, 2, Constants.BROADCAST, Constants.PORT); } if (nCode >= 0 && MouseMessages.WM_RBUTTONDOWN == (MouseMessages)wParam) { c.Send(new byte[2] { 0, 1 }, 2, Constants.BROADCAST, Constants.PORT); } if (nCode >= 0 && MouseMessages.WM_RBUTTONUP == (MouseMessages)wParam) { c.Send(new byte[2] { 0, 0 }, 2, Constants.BROADCAST, Constants.PORT); } return(DLLImport.CallNextHookEx(hHook, nCode, wParam, lParam)); }
public static List <BackupInfosEntry> GetBackupsFromDropbox() { if (DLLImport.IsInternetAvailable()) { string EndpointContent = GetEndpoint("https://dl.dropbox.com/s/mi7oyjywdtatxb0/FModel3_Backups.json?dl=0"); if (!string.IsNullOrEmpty(EndpointContent)) { List <BackupInfosEntry> ListToReturn = new List <BackupInfosEntry>(); JArray array = JArray.Parse(EndpointContent); foreach (JProperty prop in array.Children <JObject>().Properties()) { ListToReturn.Add(new BackupInfosEntry(prop.Name, prop.Value.Value <string>())); } return(ListToReturn); } else { new UpdateMyConsole("Error while checking for backup files", CColors.Red, true).Append(); return(null); } } else { new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", CColors.Blue, true).Append(); return(null); } }
public RMServer() { InterceptKeys ic = new InterceptKeys(); ic.HandleKey = (k, d) => { if (k == Keys.F1 && d) { sendMouse ^= true; return; } const int size = 5; byte[] send = new byte[size]; send[0] = d ? (byte)1 : (byte)0; BitConverter.GetBytes((int)k).CopyTo(send, 1); c.Send(send, size, Constants.BROADCAST, Constants.PORT); Console.WriteLine($"{(d ? "Down" : "Up")} {k}"); }; if (hHook == IntPtr.Zero) { Task.Run(() => { MouseHookProcedure = new DLLImport.HookProc(HandleMouse); using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { hHook = DLLImport.SetWindowsHookEx(Constants.WH_MOUSE_LL, MouseHookProcedure, DLLImport.GetModuleHandle(curModule.ModuleName), 0); } Application.Run(); }); } _ = StartServer(); }
public static List <BackupInfosEntry> GetBackupsFromDropbox() { if (DLLImport.IsInternetAvailable()) { string EndpointContent = GetEndpoint(DROPBOX_JSON); if (!string.IsNullOrEmpty(EndpointContent)) { List <BackupInfosEntry> ListToReturn = new List <BackupInfosEntry>(); JToken FData = JToken.Parse(EndpointContent); //GLOBAL MESSAGES JArray FGMessages = FData["Global_Messages"][Assembly.GetExecutingAssembly().GetName().Version.ToString()].Value <JArray>(); if (!string.IsNullOrEmpty(FGMessages[0]["Message"].Value <string>())) { StringBuilder sb = new StringBuilder(); foreach (JToken t in FGMessages) { string text = t["Message"].Value <string>(); bool nl = t["bNewLine"].Value <bool>(); // new UpdateMyConsole(text, t["Color"].Value<string>(), nl).Append(); if (nl) { sb.AppendLine(text); } else { sb.Append(text); } } DebugHelper.WriteLine("Dropbox: MOTD: " + sb.ToString().TrimEnd()); } //BACKUPS foreach (JProperty prop in FData["Backups"].Value <JObject>().Properties()) { DebugHelper.WriteLine("Dropbox: " + prop.Name + " is available to download"); ListToReturn.Add(new BackupInfosEntry(prop.Name, prop.Value.Value <string>())); } return(ListToReturn); } else { DebugHelper.WriteLine("Dropbox: Error while checking for backup files"); // new UpdateMyConsole("Error while checking for backup files", CColors.Red, true).Append(); return(new List <BackupInfosEntry>()); } } else { DebugHelper.WriteLine("Dropbox: Your internet connection is currently unavailable, can't check for backup files at the moment."); // new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", CColors.Blue, true).Append(); return(new List <BackupInfosEntry>()); } }
private IntPtr KeyboardHookDelegate(Int32 Code, IntPtr wParam, IntPtr lParam) { if (Code < 0) { return(DLLImport.CallNextHookEx( keyBoardHandle, Code, wParam, lParam)); } Console.WriteLine($"Code: {Code}, WP: {wParam}, LP: {lParam}"); KeyBoardKeyPressed?.Invoke(this, new KBArgs { Code = Code, WParam = wParam, LParam = lParam }); return(DLLImport.CallNextHookEx(keyBoardHandle, Code, wParam, lParam)); }
public static string GetKeysFromBen(bool reload) { if (DLLImport.IsInternetAvailable()) { string EndpointContent = GetEndpoint(BENBOT_AES); if (!string.IsNullOrEmpty(EndpointContent)) { try { if (string.IsNullOrEmpty(FProp.Default.FPak_MainAES) || reload) { JToken mainKeyToken = JObject.Parse(EndpointContent).SelectToken("mainKey"); if (mainKeyToken != null) { FProp.Default.FPak_MainAES = $"{mainKeyToken.Value<string>().Substring(2).ToUpperInvariant()}"; FProp.Default.Save(); DebugHelper.WriteLine("BenBotAPI: Main AES key set to " + mainKeyToken.Value <string>()); } else { DebugHelper.WriteLine("BenBotAPI: Main AES key not found in endpoint response"); } } JToken dynamicPaks = JObject.Parse(EndpointContent).SelectToken("dynamicKeys"); return(JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']')); } catch (System.Exception) { DebugHelper.WriteLine("BenBotAPI: Down or Rate Limit Exceeded"); new UpdateMyConsole("API Down or Rate Limit Exceeded", CColors.Blue, true).Append(); } } } else { DebugHelper.WriteLine("BenBotAPI: Your internet connection is currently unavailable, can't check for dynamic keys at the moment."); new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", CColors.Blue, true).Append(); } return(string.Empty); }
public static string GetKeysFromBen() { if (DLLImport.IsInternetAvailable()) { string EndpointContent = GetEndpoint("http://benbotfn.tk:8080/api/aes"); if (!string.IsNullOrEmpty(EndpointContent)) { JToken dynamicPaks = JObject.Parse(EndpointContent).SelectToken("additionalKeys"); return(JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']')); } else { new UpdateMyConsole("API Down or Rate Limit Exceeded", CColors.Blue, true).Append(); return(null); } } else { new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", CColors.Blue, true).Append(); return(null); } }
public KeyboardInput() { keyBoardDelegate = KeyboardHookDelegate; keyBoardHandle = DLLImport.SetWindowsHookEx( WH_KEYBOARD_LL, keyBoardDelegate, IntPtr.Zero, 0); }
static void sendMouseClick(Point p) { DLLImport.mouse_event(Constants.MOUSEEVENTF_LEFTDOWN | Constants.MOUSEEVENTF_LEFTUP, (uint)p.X, (uint)p.Y, 0, UIntPtr.Zero); }