private void detachButton_Click(object sender, RoutedEventArgs e) { session.Detach(); session = null; script = null; RefreshAllowedActions(); }
private void createScriptButton_Click(object sender, RoutedEventArgs e) { if (script != null) { try { script.Unload(); } catch (Exception ex) { debugConsole.Items.Add("Failed to unload previous script: " + ex.Message); } script = null; scriptLoaded = false; RefreshAllowedActions(); } try { script = session.CreateScript(scriptSource.Text); scriptLoaded = false; RefreshAllowedActions(); } catch (Exception ex) { debugConsole.Items.Add("CreateScript failed: " + ex.Message); return; } script.Message += new Frida.ScriptMessageHandler(script_Message); }
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 loadButton_Click(object sender, RoutedEventArgs e) { session = localdevice.Attach(ggproc.Pid); script = session.CreateScript(scriptsource); script.Message += Script_Message; script.Load(); loadButton.IsEnabled = false; }
private void Script_Message(object sender, Frida.ScriptMessageEventArgs e) { Frida.Script senderscript = (Frida.Script)sender; String jsonmessage = e.Message; String message = ""; JsonTextReader jtr = new JsonTextReader(new StringReader(jsonmessage)); while (jtr.Read()) { if (jtr.TokenType == JsonToken.PropertyName && jtr.Value.Equals("error")) { MessageBox.Show(jtr.ReadAsString()); Application.Current.Shutdown(); } if (jtr.TokenType == JsonToken.PropertyName && jtr.Value.Equals("payload")) { message = jtr.ReadAsString(); break; } } jtr.Close(); String fn = message + modfileext; string scriptfilepath = moddirectory + "\\" + fn; if (infoLabel.Content.ToString().Contains("Revelator") || loadcounter == 4) { infoLabel.Content = ""; loadcounter = 0; } if (File.Exists(scriptfilepath)) { byte[] bytes = File.ReadAllBytes(scriptfilepath); String payload = message; senderscript.Post(makeJSONmessageString(bytes)); loadcounter++; if (message.Contains("_ETC")) { infoLabel.Content += fn + " loaded!\r\n"; } else { infoLabel.Content += fn + " loaded!\t"; } } else { senderscript.Post(makeJSONmessageString(null)); loadcounter++; if (message.Contains("_ETC")) { infoLabel.Content += fn + " not loaded.\r\n"; } else { infoLabel.Content += fn + " not loaded.\t"; } } }
private void session_Detached(object sender, EventArgs e) { if (sender == session) { debugConsole.Items.Add("Detached from Session with Pid: " + session.Pid); session = null; script = null; RefreshAllowedActions(); } }
private void session_Detached(object sender, Frida.SessionDetachedEventArgs e) { if (sender == session) { debugConsole.Items.Add($"Detached from Session with PID {session.Pid} ({e.Reason})"); session = null; script = null; RefreshAllowedActions(); } }
private void session_Detached(object sender, EventArgs e) { if (sender == session) { Module.Output.AppendLine("Detached from Session with Pid: " + session.Pid); session = null; script = null; RefreshAllowedActions(); } }
private void unloadScriptButton_Click(object sender, RoutedEventArgs e) { try { script.Unload(); } catch (Exception ex) { debugConsole.Items.Add("Failed to unload script: " + ex.Message); } script = null; scriptLoaded = false; RefreshAllowedActions(); }
private void unloadScriptButton_Click(object sender, RoutedEventArgs e) { try { script.Unload(); } catch (Exception ex) { Module.Output.AppendLine("Failed to unload script: " + ex.Message); } script = null; scriptLoaded = false; RefreshAllowedActions(); }
private void createScriptButton_Click(object sender, RoutedEventArgs e) { if (script != null) { try { script.Unload(); } catch (Exception ex) { debugConsole.Items.Add("Failed to unload previous script: " + ex.Message); } script = null; scriptLoaded = false; RefreshAllowedActions(); } try { script = session.CreateScript(scriptSource.Text); scriptLoaded = false; RefreshAllowedActions(); } catch (Exception ex) { debugConsole.Items.Add("CreateScript failed: " + ex.Message); return; } script.Message += new Frida.ScriptMessageHandler(script_Message); }
private void unloadScriptButton_Click(object sender, RoutedEventArgs e) { try { script.Unload(); } catch (Exception ex) { debugConsole.Items.Add("Failed to unload script: " + ex.Message); } script = null; scriptLoaded = false; RefreshAllowedActions(); }
private void session_Detached(object sender, EventArgs e) { if (sender == session) { debugConsole.Items.Add("Detached from Session with Pid: " + session.Pid); session = null; script = null; RefreshAllowedActions(); } }
private void detachButton_Click(object sender, RoutedEventArgs e) { session.Detach(); session = null; script = null; RefreshAllowedActions(); }