Пример #1
0
        public void Load()
        {
            IntPtr error;

            _frida_script_load_sync(handle.Pointer, out error);
            GError.Throw(error);
        }
Пример #2
0
 public Script CreateScript(string name, string source)
 {
     return(new Script(() =>
     {
         IntPtr error;
         var script = _frida_session_create_script_sync(handle.Pointer, name, source, out error);
         GError.Throw(error);
         return script;
     }));
 }
Пример #3
0
 public FridaSession Attach(uint pid)
 {
     return(new FridaSession(() =>
     {
         IntPtr error;
         var session = _frida_device_attach_sync(handle.Pointer, pid, out error);
         GError.Throw(error);
         return session;
     }));
 }
Пример #4
0
        public List <Device> EnumerateDevices()
        {
            IntPtr error;

            using (var devices = new Ref(_frida_device_manager_enumerate_devices_sync(handle.Pointer, out error)))
            {
                GError.Throw(error);
                var len = _frida_device_list_size(devices.Pointer);
                var ret = new List <Device>();
                for (int i = 0; i < len; i++)
                {
                    ret.Add(new Device(() => _frida_device_list_get(devices.Pointer, i)));
                }
                return(ret);
            }
        }
Пример #5
0
        public List <FridaProcess> EnumerateProcesses()
        {
            IntPtr error;

            using (var devices = new Ref(_frida_device_enumerate_processes_sync(handle.Pointer, out error)))
            {
                GError.Throw(error);
                var len = _frida_process_list_size(devices.Pointer);
                var ret = new List <FridaProcess>();
                for (int i = 0; i < len; i++)
                {
                    ret.Add(new FridaProcess(() => _frida_process_list_get(devices.Pointer, i)));
                }
                return(ret);
            }
        }
Пример #6
0
        public void Post(object payload, byte[] data = null)
        {
            IntPtr dataPtr = IntPtr.Zero;

            try
            {
                var message = JsonConvert.SerializeObject(payload);
                if (data != null)
                {
                    dataPtr = Marshal.AllocHGlobal(data.Length);
                    Marshal.Copy(data, 0, dataPtr, data.Length);
                }
                IntPtr error;
                _frida_script_post_sync(handle.Pointer, message, dataPtr, (uint)(data?.Length ?? 0), out error);
                GError.Throw(error);
            }
            finally
            {
                if (dataPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(dataPtr);
                }
            }
        }