public static void LoadData() { var devices = LoadDevices(); DataHolder.DeviceData = DeviceUtil.GetDeviceDataFromSerializedData(devices); CacheData(); DeviceUtil.UpdateDeviceRelatedGUI(); }
public static void ExecuteOnDevice(Pair <string, string> deviceArg, Pair <string, string> username, Pair <string, string> hintArg) { var deviceTarget = deviceArg.Value; var device = DeviceUtil.FindDeviceByIpOrName(deviceTarget); if (device == null) { var msg = string.Format("No device found with IP or Name equal to '{0}'", deviceTarget); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } else { var hasSSH = DeviceUtil.HasProgram(device, ProgramType.SSH); if (hasSSH) { var user = DeviceUtil.FindUserByName(device, username.Value); if (user == null) { var msg = string.Format("The device '{0}' has no user with name '{1}'.", deviceTarget, username.Value); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } else { var password = user.Password; LoopUtil.RunCoroutine(ExecuteOnPassword(password, hintArg.Value, success => { if (success) { var msg = "Password found! The password for '{0}' is '{1}'."; msg = string.Format(msg, user.Username, user.Password); msg = TextUtil.Success(msg); TerminalUtil.ShowText(msg); } else { var msg = string.Format( "Unable to find the password of user '{0}' with the given arguments.\nPlease try another set of hints.", user.Username); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } })); } } else { var msg = "The device '{0}' is not running a SSH instance. We have no way to validate password attempts."; msg = string.Format(msg, deviceTarget); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } } }