private void MainWindow_Loaded(object sender, RoutedEventArgs e) { deviceManager = new Frida.DeviceManager(Dispatcher); deviceManager.Changed += new EventHandler(deviceManager_Changed); RefreshDeviceList(); RefreshAllowedActions(); }
private void Hook(string targetProcess, string scriptLocation) { try { Devices = new List <Frida.Device>(); Processes = new List <Frida.Process>(); deviceManager = new Frida.DeviceManager(Dispatcher.CurrentDispatcher); var devices = deviceManager.EnumerateDevices(); //we want the local device var device = devices.Where(x => x.Name == "Local System").FirstOrDefault(); if (device == null) { Console.WriteLine("[*] Failed to select device!"); return; } var processes = device.EnumerateProcesses(); foreach (var process in processes) { Processes.Add(process); } Console.WriteLine(String.Format("[*] Got {0} processes...", Processes.Count)); //find the process var target = Processes.Where(x => x.Name == targetProcess).FirstOrDefault(); if (target == null) { foreach (Frida.Process p in Processes) { Console.WriteLine(p.Name); } Console.WriteLine("[*] Failed to identify target process!"); return; } Console.WriteLine(String.Format("[*] Process {0} found...", targetProcess)); session = device.Attach(target.Pid); Console.WriteLine(String.Format("[*] Hooked process with PID {0}", target.Pid.ToString())); //Inject the script... Console.WriteLine("[*] Injecting script..."); try { Console.WriteLine(String.Format("[*] Loading script from {0}...", scriptLocation)); string scriptText = File.ReadAllText(scriptLocation); script = session.CreateScript(scriptText); Console.WriteLine("[*] Script loaded..."); script.Message += new Frida.ScriptMessageHandler(script_Message); script.Load(); } catch (Exception ex) { Console.WriteLine("[*] Error loading script!"); Console.WriteLine(ex.ToString()); return; } } catch (Exception ex) { Console.WriteLine("[*] Fail!"); } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { if (!Directory.Exists(moddirectory)) { Directory.CreateDirectory(moddirectory); MessageBox.Show("The program has created \"ggmods\" in the directory from where you ran this from. Put all your .ggscript files there before clicking \"Load\"."); } deviceman = new Frida.DeviceManager(Dispatcher); foreach (Frida.Device d in deviceman.EnumerateDevices()) { if (d.Type.Equals(Frida.DeviceType.Local)) { localdevice = d; break; } } if (localdevice == null) { MessageBox.Show("Error finding a local device. Open an issue on github if this pops up. If you're not sure how, contact @MemeMongerBPM on twitter or Labryz#5752 on discord and I'll be happy to help."); Application.Current.Shutdown(); } }