frida 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +84 -84
  3. data/Gemfile +12 -12
  4. data/Gemfile.lock +25 -25
  5. data/LICENSE.txt +21 -21
  6. data/README.md +64 -64
  7. data/Rakefile +20 -20
  8. data/exe/frida +3 -3
  9. data/ext/c_frida/Application.c +79 -79
  10. data/ext/c_frida/Bus.c +91 -91
  11. data/ext/c_frida/Child.c +134 -134
  12. data/ext/c_frida/Compiler.c +0 -0
  13. data/ext/c_frida/Crash.c +0 -0
  14. data/ext/c_frida/Device.c +955 -955
  15. data/ext/c_frida/DeviceManager.c +260 -260
  16. data/ext/c_frida/EndpointParameters.c +0 -0
  17. data/ext/c_frida/FileMonitor.c +0 -0
  18. data/ext/c_frida/GObject.c +0 -0
  19. data/ext/c_frida/IOStream.c +228 -228
  20. data/ext/c_frida/PortalMembership.c +0 -0
  21. data/ext/c_frida/PortalService.c +0 -0
  22. data/ext/c_frida/Process.c +67 -67
  23. data/ext/c_frida/Relay.c +0 -0
  24. data/ext/c_frida/Script.c +221 -221
  25. data/ext/c_frida/Session.c +626 -626
  26. data/ext/c_frida/Spawn.c +53 -53
  27. data/ext/c_frida/c_frida.c +68 -68
  28. data/ext/c_frida/extconf.rb +25 -25
  29. data/ext/c_frida/gutils.c +498 -498
  30. data/ext/c_frida/gvl_bridge.c +131 -131
  31. data/ext/c_frida/inc/Application.h +9 -9
  32. data/ext/c_frida/inc/Bus.h +15 -15
  33. data/ext/c_frida/inc/Child.h +9 -9
  34. data/ext/c_frida/inc/Compiler.h +0 -0
  35. data/ext/c_frida/inc/Crash.h +0 -0
  36. data/ext/c_frida/inc/Device.h +71 -71
  37. data/ext/c_frida/inc/DeviceManager.h +20 -20
  38. data/ext/c_frida/inc/EndpointParameters.h +0 -0
  39. data/ext/c_frida/inc/FileMonitor.h +0 -0
  40. data/ext/c_frida/inc/GObject.h +0 -0
  41. data/ext/c_frida/inc/IOStream.h +29 -29
  42. data/ext/c_frida/inc/PortalMembership.h +0 -0
  43. data/ext/c_frida/inc/PortalService.h +0 -0
  44. data/ext/c_frida/inc/Process.h +9 -9
  45. data/ext/c_frida/inc/Relay.h +0 -0
  46. data/ext/c_frida/inc/Script.h +21 -21
  47. data/ext/c_frida/inc/Session.h +40 -40
  48. data/ext/c_frida/inc/Spawn.h +9 -9
  49. data/ext/c_frida/inc/c_frida.h +129 -129
  50. data/ext/c_frida/inc/gutils.h +21 -21
  51. data/ext/c_frida/inc/gvl_bridge.h +42 -42
  52. data/lib/frida/version.rb +5 -5
  53. data/lib/frida.rb +8 -8
  54. metadata +3 -6
  55. data/frida.gemspec +0 -39
data/ext/c_frida/Script.c CHANGED
@@ -1,221 +1,221 @@
1
- #include "Script.h"
2
-
3
- VALUE Script_from_FridaScript(FridaScript *handle)
4
- {
5
- VALUE self;
6
-
7
- if (!handle)
8
- return (Qnil);
9
- self = rb_class_new_instance(0, NULL, cScript);
10
- GET_GOBJECT_DATA();
11
- d->handle = handle;
12
- d->destroy = frida_unref;
13
- return (self);
14
- }
15
-
16
- /*
17
- call-seq:
18
- #is_destroyed() -> [TrueClass, FalseClass]
19
- */
20
- static VALUE Script_is_destroyed(VALUE self)
21
- {
22
- GET_GOBJECT_DATA();
23
- REQUIRE_GOBJECT_HANDLE();
24
- void *is_destroyed;
25
-
26
- is_destroyed = rb_thread_call_without_gvl((void_fp)frida_script_is_destroyed, d->handle, NULL, NULL);
27
- return (is_destroyed ? Qtrue : Qfalse);
28
- }
29
-
30
- GVL_FREE_PROXY_FUNC(load_sync, void *handle)
31
- {
32
- GError *gerr = NULL;
33
-
34
- frida_script_load_sync(handle, NULL, &gerr);
35
- RETURN_GVL_FREE_RESULT(NULL);
36
- }
37
-
38
- /*
39
- call-seq:
40
- #load() -> nil
41
- */
42
- static VALUE Script_load(VALUE self)
43
- {
44
- GET_GOBJECT_DATA();
45
- REQUIRE_GOBJECT_HANDLE();
46
-
47
- CALL_GVL_FREE_WITH_RET(void *dummy, load_sync, d->handle);
48
- return (Qnil);
49
-
50
- GERROR_BLOCK
51
- }
52
-
53
- GVL_FREE_PROXY_FUNC(eternalize_sync, void *handle)
54
- {
55
- GError *gerr = NULL;
56
-
57
- frida_script_eternalize_sync(handle, NULL, &gerr);
58
- RETURN_GVL_FREE_RESULT(NULL);
59
- }
60
-
61
- /*
62
- call-seq:
63
- #eternalize() -> nil
64
- */
65
- static VALUE Script_eternalize(VALUE self)
66
- {
67
- GET_GOBJECT_DATA();
68
- REQUIRE_GOBJECT_HANDLE();
69
-
70
- CALL_GVL_FREE_WITH_RET(void *dummy, eternalize_sync, d->handle);
71
- return (Qnil);
72
-
73
- GERROR_BLOCK
74
- }
75
-
76
- GVL_FREE_PROXY_FUNC(unload_sync, void *handle)
77
- {
78
- GError *gerr = NULL;
79
-
80
- frida_script_unload_sync(handle, NULL, &gerr);
81
- RETURN_GVL_FREE_RESULT(NULL);
82
- }
83
-
84
- /*
85
- call-seq:
86
- #unload() -> nil
87
- */
88
- static VALUE Script_unload(VALUE self)
89
- {
90
- GET_GOBJECT_DATA();
91
- REQUIRE_GOBJECT_HANDLE();
92
-
93
- CALL_GVL_FREE_WITH_RET(void *dummy, unload_sync, d->handle);
94
- return (Qnil);
95
-
96
- GERROR_BLOCK
97
- }
98
-
99
- GVL_FREE_PROXY_FUNC(disable_debugger_sync, void *handle)
100
- {
101
- GError *gerr = NULL;
102
-
103
- frida_script_disable_debugger_sync(handle, NULL, &gerr);
104
- RETURN_GVL_FREE_RESULT(NULL);
105
- }
106
-
107
- /*
108
- call-seq:
109
- #disable_debugger() -> nil
110
- */
111
- static VALUE Script_disable_debugger(VALUE self)
112
- {
113
- GET_GOBJECT_DATA();
114
- REQUIRE_GOBJECT_HANDLE();
115
-
116
- CALL_GVL_FREE_WITH_RET(void *dummy, disable_debugger_sync, d->handle);
117
- return (Qnil);
118
-
119
- GERROR_BLOCK
120
- }
121
-
122
- GVL_FREE_PROXY_FUNC(enable_debugger_sync, enable_debugger_proxy_args *args)
123
- {
124
- GError *gerr = NULL;
125
-
126
- frida_script_enable_debugger_sync(args->handle, args->port, NULL, &gerr);
127
- RETURN_GVL_FREE_RESULT(NULL);
128
- }
129
-
130
- /*
131
- call-seq:
132
- #enable_debugger(port:) -> nil
133
- */
134
- static VALUE Script_enable_debugger(int argc, VALUE *argv, VALUE self)
135
- {
136
- GET_GOBJECT_DATA();
137
- REQUIRE_GOBJECT_HANDLE();
138
- VALUE kws, rport;
139
- uint port = 0;
140
-
141
- rb_scan_args(argc, argv, ":", &kws);
142
- if (!NIL_P(kws)) {
143
- rport = rb_hash_aref(kws, ID2SYM(rb_intern("port")));
144
- if (!NIL_P(rport)) {
145
- if (!RB_TYPE_P(rport, T_FIXNUM)) {
146
- raise_argerror("port must be a number.");
147
- return (Qnil);
148
- }
149
- port = NUM2UINT(rport);
150
- }
151
- }
152
- enable_debugger_proxy_args args = {
153
- .handle = d->handle,
154
- .port = port
155
- };
156
- CALL_GVL_FREE_WITH_RET(void *dummy, enable_debugger_sync, &args);
157
- goto done;
158
-
159
- gerror:
160
- raise_rerror(NULL, _gerr);
161
- done:
162
- return (Qnil);
163
- }
164
-
165
- GVL_FREE_PROXY_FUNC(post, post_proxy_args *args)
166
- {
167
- GError *gerr = NULL;
168
-
169
- frida_script_post(args->handle, args->message, args->data);
170
- RETURN_GVL_FREE_RESULT(NULL);
171
- }
172
-
173
- /*
174
- call-seq:
175
- #post(message, data:) -> nil
176
- */
177
- static VALUE Script_post(int argc, VALUE *argv, VALUE self)
178
- {
179
- GET_GOBJECT_DATA();
180
- REQUIRE_GOBJECT_HANDLE();
181
- VALUE kws, msg, data;
182
- gpointer cdata = NULL;
183
-
184
- rb_scan_args(argc, argv, "1:", &msg, &kws);
185
- if (!NIL_P(kws)) {
186
- data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
187
- if (!NIL_P(data)) {
188
- if (!RB_TYPE_P(data, T_STRING)) {
189
- raise_argerror("data must be a number.");
190
- return (Qnil);
191
- }
192
- cdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
193
- }
194
- }
195
- post_proxy_args args = {
196
- .handle = d->handle,
197
- .message = StringValueCStr(msg),
198
- .data = cdata
199
- };
200
- CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
201
- goto done;
202
-
203
- gerror:
204
- raise_rerror(NULL, _gerr);
205
- done:
206
- g_bytes_unref(args.data);
207
- return (Qnil);
208
- }
209
-
210
- void define_Script()
211
- {
212
- cScript = rb_define_class_under(mCFrida, "Script", cGObject);
213
-
214
- rb_define_method(cScript, "is_destroyed", Script_is_destroyed, 0);
215
- rb_define_method(cScript, "load", Script_load, 0);
216
- rb_define_method(cScript, "unload", Script_unload, 0);
217
- rb_define_method(cScript, "eternalize", Script_eternalize, 0);
218
- rb_define_method(cScript, "enable_debugger", Script_enable_debugger, -1);
219
- rb_define_method(cScript, "disable_debugger", Script_disable_debugger, 0);
220
- rb_define_method(cScript, "post", Script_post, -1);
221
- }
1
+ #include "Script.h"
2
+
3
+ VALUE Script_from_FridaScript(FridaScript *handle)
4
+ {
5
+ VALUE self;
6
+
7
+ if (!handle)
8
+ return (Qnil);
9
+ self = rb_class_new_instance(0, NULL, cScript);
10
+ GET_GOBJECT_DATA();
11
+ d->handle = handle;
12
+ d->destroy = frida_unref;
13
+ return (self);
14
+ }
15
+
16
+ /*
17
+ call-seq:
18
+ #is_destroyed() -> [TrueClass, FalseClass]
19
+ */
20
+ static VALUE Script_is_destroyed(VALUE self)
21
+ {
22
+ GET_GOBJECT_DATA();
23
+ REQUIRE_GOBJECT_HANDLE();
24
+ void *is_destroyed;
25
+
26
+ is_destroyed = rb_thread_call_without_gvl((void_fp)frida_script_is_destroyed, d->handle, NULL, NULL);
27
+ return (is_destroyed ? Qtrue : Qfalse);
28
+ }
29
+
30
+ GVL_FREE_PROXY_FUNC(load_sync, void *handle)
31
+ {
32
+ GError *gerr = NULL;
33
+
34
+ frida_script_load_sync(handle, NULL, &gerr);
35
+ RETURN_GVL_FREE_RESULT(NULL);
36
+ }
37
+
38
+ /*
39
+ call-seq:
40
+ #load() -> nil
41
+ */
42
+ static VALUE Script_load(VALUE self)
43
+ {
44
+ GET_GOBJECT_DATA();
45
+ REQUIRE_GOBJECT_HANDLE();
46
+
47
+ CALL_GVL_FREE_WITH_RET(void *dummy, load_sync, d->handle);
48
+ return (Qnil);
49
+
50
+ GERROR_BLOCK
51
+ }
52
+
53
+ GVL_FREE_PROXY_FUNC(eternalize_sync, void *handle)
54
+ {
55
+ GError *gerr = NULL;
56
+
57
+ frida_script_eternalize_sync(handle, NULL, &gerr);
58
+ RETURN_GVL_FREE_RESULT(NULL);
59
+ }
60
+
61
+ /*
62
+ call-seq:
63
+ #eternalize() -> nil
64
+ */
65
+ static VALUE Script_eternalize(VALUE self)
66
+ {
67
+ GET_GOBJECT_DATA();
68
+ REQUIRE_GOBJECT_HANDLE();
69
+
70
+ CALL_GVL_FREE_WITH_RET(void *dummy, eternalize_sync, d->handle);
71
+ return (Qnil);
72
+
73
+ GERROR_BLOCK
74
+ }
75
+
76
+ GVL_FREE_PROXY_FUNC(unload_sync, void *handle)
77
+ {
78
+ GError *gerr = NULL;
79
+
80
+ frida_script_unload_sync(handle, NULL, &gerr);
81
+ RETURN_GVL_FREE_RESULT(NULL);
82
+ }
83
+
84
+ /*
85
+ call-seq:
86
+ #unload() -> nil
87
+ */
88
+ static VALUE Script_unload(VALUE self)
89
+ {
90
+ GET_GOBJECT_DATA();
91
+ REQUIRE_GOBJECT_HANDLE();
92
+
93
+ CALL_GVL_FREE_WITH_RET(void *dummy, unload_sync, d->handle);
94
+ return (Qnil);
95
+
96
+ GERROR_BLOCK
97
+ }
98
+
99
+ GVL_FREE_PROXY_FUNC(disable_debugger_sync, void *handle)
100
+ {
101
+ GError *gerr = NULL;
102
+
103
+ frida_script_disable_debugger_sync(handle, NULL, &gerr);
104
+ RETURN_GVL_FREE_RESULT(NULL);
105
+ }
106
+
107
+ /*
108
+ call-seq:
109
+ #disable_debugger() -> nil
110
+ */
111
+ static VALUE Script_disable_debugger(VALUE self)
112
+ {
113
+ GET_GOBJECT_DATA();
114
+ REQUIRE_GOBJECT_HANDLE();
115
+
116
+ CALL_GVL_FREE_WITH_RET(void *dummy, disable_debugger_sync, d->handle);
117
+ return (Qnil);
118
+
119
+ GERROR_BLOCK
120
+ }
121
+
122
+ GVL_FREE_PROXY_FUNC(enable_debugger_sync, enable_debugger_proxy_args *args)
123
+ {
124
+ GError *gerr = NULL;
125
+
126
+ frida_script_enable_debugger_sync(args->handle, args->port, NULL, &gerr);
127
+ RETURN_GVL_FREE_RESULT(NULL);
128
+ }
129
+
130
+ /*
131
+ call-seq:
132
+ #enable_debugger(port:) -> nil
133
+ */
134
+ static VALUE Script_enable_debugger(int argc, VALUE *argv, VALUE self)
135
+ {
136
+ GET_GOBJECT_DATA();
137
+ REQUIRE_GOBJECT_HANDLE();
138
+ VALUE kws, rport;
139
+ uint port = 0;
140
+
141
+ rb_scan_args(argc, argv, ":", &kws);
142
+ if (!NIL_P(kws)) {
143
+ rport = rb_hash_aref(kws, ID2SYM(rb_intern("port")));
144
+ if (!NIL_P(rport)) {
145
+ if (!RB_TYPE_P(rport, T_FIXNUM)) {
146
+ raise_argerror("port must be a number.");
147
+ return (Qnil);
148
+ }
149
+ port = NUM2UINT(rport);
150
+ }
151
+ }
152
+ enable_debugger_proxy_args args = {
153
+ .handle = d->handle,
154
+ .port = port
155
+ };
156
+ CALL_GVL_FREE_WITH_RET(void *dummy, enable_debugger_sync, &args);
157
+ goto done;
158
+
159
+ gerror:
160
+ raise_rerror(NULL, _gerr);
161
+ done:
162
+ return (Qnil);
163
+ }
164
+
165
+ GVL_FREE_PROXY_FUNC(post, post_proxy_args *args)
166
+ {
167
+ GError *gerr = NULL;
168
+
169
+ frida_script_post(args->handle, args->message, args->data);
170
+ RETURN_GVL_FREE_RESULT(NULL);
171
+ }
172
+
173
+ /*
174
+ call-seq:
175
+ #post(message, data:) -> nil
176
+ */
177
+ static VALUE Script_post(int argc, VALUE *argv, VALUE self)
178
+ {
179
+ GET_GOBJECT_DATA();
180
+ REQUIRE_GOBJECT_HANDLE();
181
+ VALUE kws, msg, data;
182
+ gpointer cdata = NULL;
183
+
184
+ rb_scan_args(argc, argv, "1:", &msg, &kws);
185
+ if (!NIL_P(kws)) {
186
+ data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
187
+ if (!NIL_P(data)) {
188
+ if (!RB_TYPE_P(data, T_STRING)) {
189
+ raise_argerror("data must be a number.");
190
+ return (Qnil);
191
+ }
192
+ cdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
193
+ }
194
+ }
195
+ post_proxy_args args = {
196
+ .handle = d->handle,
197
+ .message = StringValueCStr(msg),
198
+ .data = cdata
199
+ };
200
+ CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
201
+ goto done;
202
+
203
+ gerror:
204
+ raise_rerror(NULL, _gerr);
205
+ done:
206
+ g_bytes_unref(args.data);
207
+ return (Qnil);
208
+ }
209
+
210
+ void define_Script()
211
+ {
212
+ cScript = rb_define_class_under(mCFrida, "Script", cGObject);
213
+
214
+ rb_define_method(cScript, "is_destroyed", Script_is_destroyed, 0);
215
+ rb_define_method(cScript, "load", Script_load, 0);
216
+ rb_define_method(cScript, "unload", Script_unload, 0);
217
+ rb_define_method(cScript, "eternalize", Script_eternalize, 0);
218
+ rb_define_method(cScript, "enable_debugger", Script_enable_debugger, -1);
219
+ rb_define_method(cScript, "disable_debugger", Script_disable_debugger, 0);
220
+ rb_define_method(cScript, "post", Script_post, -1);
221
+ }