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/Bus.c CHANGED
@@ -1,91 +1,91 @@
1
- #include "Bus.h"
2
-
3
- VALUE Bus_from_FridaBus(FridaBus *fridabus)
4
- {
5
- VALUE self;
6
-
7
- self = rb_class_new_instance(0, NULL, cBus);
8
- GET_GOBJECT_DATA();
9
- d->handle = fridabus;
10
- d->destroy = g_object_unref;
11
- return (self);
12
- }
13
-
14
- GVL_FREE_PROXY_FUNC(attach_sync, void *handle)
15
- {
16
- GError *gerr = NULL;
17
-
18
- frida_bus_attach_sync(handle, NULL, &gerr);
19
- RETURN_GVL_FREE_RESULT(NULL);
20
- }
21
-
22
- /*
23
- call-seq:
24
- #attach() -> nil
25
- */
26
- static VALUE Bus_attach(VALUE self)
27
- {
28
- GET_GOBJECT_DATA();
29
- REQUIRE_GOBJECT_HANDLE();
30
-
31
- CALL_GVL_FREE_WITH_RET(void *dummy, attach_sync, d->handle);
32
- return (Qnil);
33
-
34
- GERROR_BLOCK
35
- }
36
-
37
- GVL_FREE_PROXY_FUNC(post, bus_post_proxy_args *args)
38
- {
39
- GError *gerr = NULL;
40
-
41
- frida_bus_post(args->handle, args->message, args->data);
42
- RETURN_GVL_FREE_RESULT(NULL);
43
- }
44
-
45
- /*
46
- call-seq:
47
- #post(message, data:) -> nil
48
- */
49
- static VALUE Bus_post(int argc, VALUE *argv, VALUE self)
50
- {
51
- GET_GOBJECT_DATA();
52
- REQUIRE_GOBJECT_HANDLE();
53
- VALUE message, kws, data;
54
- GBytes *gdata = NULL;
55
-
56
- rb_scan_args(argc, argv, "1:", &message, &kws);
57
- if (!RB_TYPE_P(message, T_STRING)) {
58
- raise_argerror("message should be a string.");
59
- return (Qnil);
60
- }
61
- if (!NIL_P(kws)) {
62
- data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
63
- if (!NIL_P(data)) {
64
- if (!RB_TYPE_P(data, T_STRING)) {
65
- raise_argerror("scope must be a string.");
66
- return (Qnil);
67
- }
68
- gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
69
- }
70
- }
71
- bus_post_proxy_args args = {
72
- .handle = d->handle,
73
- .message = StringValueCStr(message),
74
- .data = gdata
75
- };
76
- CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
77
- g_bytes_unref(gdata);
78
- return (Qnil);
79
-
80
- gerror:
81
- g_bytes_unref(gdata);
82
- raise_rerror(NULL, _gerr);
83
- return (Qnil);
84
- }
85
-
86
- void define_Bus()
87
- {
88
- cBus = rb_define_class_under(mCFrida, "Bus", cGObject);
89
- rb_define_method(cBus, "attach", Bus_attach, 0);
90
- rb_define_method(cBus, "post", Bus_post, -1);
91
- }
1
+ #include "Bus.h"
2
+
3
+ VALUE Bus_from_FridaBus(FridaBus *fridabus)
4
+ {
5
+ VALUE self;
6
+
7
+ self = rb_class_new_instance(0, NULL, cBus);
8
+ GET_GOBJECT_DATA();
9
+ d->handle = fridabus;
10
+ d->destroy = g_object_unref;
11
+ return (self);
12
+ }
13
+
14
+ GVL_FREE_PROXY_FUNC(attach_sync, void *handle)
15
+ {
16
+ GError *gerr = NULL;
17
+
18
+ frida_bus_attach_sync(handle, NULL, &gerr);
19
+ RETURN_GVL_FREE_RESULT(NULL);
20
+ }
21
+
22
+ /*
23
+ call-seq:
24
+ #attach() -> nil
25
+ */
26
+ static VALUE Bus_attach(VALUE self)
27
+ {
28
+ GET_GOBJECT_DATA();
29
+ REQUIRE_GOBJECT_HANDLE();
30
+
31
+ CALL_GVL_FREE_WITH_RET(void *dummy, attach_sync, d->handle);
32
+ return (Qnil);
33
+
34
+ GERROR_BLOCK
35
+ }
36
+
37
+ GVL_FREE_PROXY_FUNC(post, bus_post_proxy_args *args)
38
+ {
39
+ GError *gerr = NULL;
40
+
41
+ frida_bus_post(args->handle, args->message, args->data);
42
+ RETURN_GVL_FREE_RESULT(NULL);
43
+ }
44
+
45
+ /*
46
+ call-seq:
47
+ #post(message, data:) -> nil
48
+ */
49
+ static VALUE Bus_post(int argc, VALUE *argv, VALUE self)
50
+ {
51
+ GET_GOBJECT_DATA();
52
+ REQUIRE_GOBJECT_HANDLE();
53
+ VALUE message, kws, data;
54
+ GBytes *gdata = NULL;
55
+
56
+ rb_scan_args(argc, argv, "1:", &message, &kws);
57
+ if (!RB_TYPE_P(message, T_STRING)) {
58
+ raise_argerror("message should be a string.");
59
+ return (Qnil);
60
+ }
61
+ if (!NIL_P(kws)) {
62
+ data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
63
+ if (!NIL_P(data)) {
64
+ if (!RB_TYPE_P(data, T_STRING)) {
65
+ raise_argerror("scope must be a string.");
66
+ return (Qnil);
67
+ }
68
+ gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
69
+ }
70
+ }
71
+ bus_post_proxy_args args = {
72
+ .handle = d->handle,
73
+ .message = StringValueCStr(message),
74
+ .data = gdata
75
+ };
76
+ CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
77
+ g_bytes_unref(gdata);
78
+ return (Qnil);
79
+
80
+ gerror:
81
+ g_bytes_unref(gdata);
82
+ raise_rerror(NULL, _gerr);
83
+ return (Qnil);
84
+ }
85
+
86
+ void define_Bus()
87
+ {
88
+ cBus = rb_define_class_under(mCFrida, "Bus", cGObject);
89
+ rb_define_method(cBus, "attach", Bus_attach, 0);
90
+ rb_define_method(cBus, "post", Bus_post, -1);
91
+ }
data/ext/c_frida/Child.c CHANGED
@@ -1,134 +1,134 @@
1
- #include "Child.h"
2
-
3
- VALUE Child_from_FridaChild(FridaChild *handle)
4
- {
5
- VALUE self;
6
-
7
- if (!handle)
8
- return (Qnil);
9
- self = rb_class_new_instance(0, NULL, cChild);
10
- GET_GOBJECT_DATA();
11
- d->handle = handle;
12
- d->destroy = g_object_unref;
13
- rb_ivar_set(self, rb_intern("pid"), UINT2NUM(frida_child_get_pid(d->handle)));
14
- rb_ivar_set(self, rb_intern("parent_pid"), UINT2NUM(frida_child_get_parent_pid(d->handle)));
15
- rb_ivar_set(self, rb_intern("identifier"), rbGObject_marshal_string(frida_child_get_identifier(d->handle)));
16
- rb_ivar_set(self, rb_intern("path"), rbGObject_marshal_string(frida_child_get_path(d->handle)));
17
- rb_ivar_set(self, rb_intern("origin"), rbGObject_marshal_enum(frida_child_get_origin(d->handle), FRIDA_TYPE_CHILD_ORIGIN));
18
- gint len;
19
- rb_ivar_set(self, rb_intern("argv"), rbGObject_marshal_strv((gchar **)frida_child_get_argv(d->handle, &len), len));
20
- rb_ivar_set(self, rb_intern("envp"), rbGObject_marshal_envp((const gchar **)frida_child_get_envp(d->handle, &len), len));
21
- return (self);
22
- }
23
-
24
- static VALUE Child_inspect(VALUE self)
25
- {
26
- GET_GOBJECT_DATA();
27
-
28
- VALUE s;
29
- FridaChildOrigin origin;
30
- GString *inspect_s;
31
-
32
- inspect_s = g_string_new("#<Child: ");
33
- g_string_append(inspect_s, "pid=%+"PRIsVALUE", parent_pid=%+"PRIsVALUE);
34
- g_string_append(inspect_s, ", origin=%+"PRIsVALUE", identifier=%+"PRIsVALUE);
35
-
36
- if (d->handle)
37
- origin = frida_child_get_origin(d->handle);
38
- else
39
- origin = FRIDA_CHILD_ORIGIN_FORK;
40
- if (origin != FRIDA_CHILD_ORIGIN_FORK) {
41
- g_string_append(inspect_s, ", path=%+"PRIsVALUE", argv=%+"PRIsVALUE", envp=%+"PRIsVALUE);
42
- g_string_append(inspect_s, ">");
43
- s = rb_sprintf(inspect_s->str, \
44
- rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("parent_pid"), 0, NULL), \
45
- rb_funcall(self, rb_intern("origin"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL), \
46
- rb_funcall(self, rb_intern("path"), 0, NULL), rb_funcall(self, rb_intern("argv"), 0, NULL), \
47
- rb_funcall(self, rb_intern("envp"), 0, NULL));
48
- } else {
49
- g_string_append(inspect_s, ">");
50
- s = rb_sprintf(inspect_s->str, \
51
- rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("parent_pid"), 0, NULL), \
52
- rb_funcall(self, rb_intern("origin"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL));
53
- }
54
- g_string_free(inspect_s, TRUE);
55
- return (s);
56
- }
57
-
58
- /*
59
- call-seq:
60
- #pid() -> Fixnum
61
- */
62
- static VALUE Child_pid(VALUE self)
63
- {
64
- return (rb_ivar_get(self, rb_intern("pid")));
65
- }
66
-
67
- /*
68
- call-seq:
69
- #identifier() -> String
70
- */
71
- static VALUE Child_identifier(VALUE self)
72
- {
73
- return (rb_ivar_get(self, rb_intern("identifier")));
74
- }
75
-
76
- /*
77
- call-seq:
78
- #parent_pid() -> Fixnum
79
- */
80
- static VALUE Child_parent_pid(VALUE self)
81
- {
82
- return (rb_ivar_get(self, rb_intern("parent_pid")));
83
- }
84
-
85
- /*
86
- call-seq:
87
- #path() -> String
88
- */
89
- static VALUE Child_path(VALUE self)
90
- {
91
- return (rb_ivar_get(self, rb_intern("path")));
92
- }
93
-
94
- /*
95
- call-seq:
96
- #argv() -> Array
97
- */
98
- static VALUE Child_argv(VALUE self)
99
- {
100
- return (rb_ivar_get(self, rb_intern("argv")));
101
- }
102
-
103
- /*
104
- call-seq:
105
- #envp() -> Array
106
- */
107
- static VALUE Child_envp(VALUE self)
108
- {
109
- return (rb_ivar_get(self, rb_intern("envp")));
110
- }
111
-
112
- /*
113
- call-seq:
114
- #origin() -> String
115
- */
116
- static VALUE Child_origin(VALUE self)
117
- {
118
- return (rb_ivar_get(self, rb_intern("origin")));
119
- }
120
-
121
- void define_Child()
122
- {
123
- cChild = rb_define_class_under(mCFrida, "Child", cGObject);
124
-
125
- rb_define_method(cChild, "inspect", Child_inspect, 0);
126
- rb_define_alias(cChild, "to_s", "inspect");
127
- rb_define_method(cChild, "pid", Child_pid, 0);
128
- rb_define_method(cChild, "parent_pid", Child_parent_pid, 0);
129
- rb_define_method(cChild, "identifier", Child_identifier, 0);
130
- rb_define_method(cChild, "origin", Child_origin, 0);
131
- rb_define_method(cChild, "path", Child_path, 0);
132
- rb_define_method(cChild, "argv", Child_argv, 0);
133
- rb_define_method(cChild, "envp", Child_envp, 0);
134
- }
1
+ #include "Child.h"
2
+
3
+ VALUE Child_from_FridaChild(FridaChild *handle)
4
+ {
5
+ VALUE self;
6
+
7
+ if (!handle)
8
+ return (Qnil);
9
+ self = rb_class_new_instance(0, NULL, cChild);
10
+ GET_GOBJECT_DATA();
11
+ d->handle = handle;
12
+ d->destroy = g_object_unref;
13
+ rb_ivar_set(self, rb_intern("pid"), UINT2NUM(frida_child_get_pid(d->handle)));
14
+ rb_ivar_set(self, rb_intern("parent_pid"), UINT2NUM(frida_child_get_parent_pid(d->handle)));
15
+ rb_ivar_set(self, rb_intern("identifier"), rbGObject_marshal_string(frida_child_get_identifier(d->handle)));
16
+ rb_ivar_set(self, rb_intern("path"), rbGObject_marshal_string(frida_child_get_path(d->handle)));
17
+ rb_ivar_set(self, rb_intern("origin"), rbGObject_marshal_enum(frida_child_get_origin(d->handle), FRIDA_TYPE_CHILD_ORIGIN));
18
+ gint len;
19
+ rb_ivar_set(self, rb_intern("argv"), rbGObject_marshal_strv((gchar **)frida_child_get_argv(d->handle, &len), len));
20
+ rb_ivar_set(self, rb_intern("envp"), rbGObject_marshal_envp((const gchar **)frida_child_get_envp(d->handle, &len), len));
21
+ return (self);
22
+ }
23
+
24
+ static VALUE Child_inspect(VALUE self)
25
+ {
26
+ GET_GOBJECT_DATA();
27
+
28
+ VALUE s;
29
+ FridaChildOrigin origin;
30
+ GString *inspect_s;
31
+
32
+ inspect_s = g_string_new("#<Child: ");
33
+ g_string_append(inspect_s, "pid=%+"PRIsVALUE", parent_pid=%+"PRIsVALUE);
34
+ g_string_append(inspect_s, ", origin=%+"PRIsVALUE", identifier=%+"PRIsVALUE);
35
+
36
+ if (d->handle)
37
+ origin = frida_child_get_origin(d->handle);
38
+ else
39
+ origin = FRIDA_CHILD_ORIGIN_FORK;
40
+ if (origin != FRIDA_CHILD_ORIGIN_FORK) {
41
+ g_string_append(inspect_s, ", path=%+"PRIsVALUE", argv=%+"PRIsVALUE", envp=%+"PRIsVALUE);
42
+ g_string_append(inspect_s, ">");
43
+ s = rb_sprintf(inspect_s->str, \
44
+ rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("parent_pid"), 0, NULL), \
45
+ rb_funcall(self, rb_intern("origin"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL), \
46
+ rb_funcall(self, rb_intern("path"), 0, NULL), rb_funcall(self, rb_intern("argv"), 0, NULL), \
47
+ rb_funcall(self, rb_intern("envp"), 0, NULL));
48
+ } else {
49
+ g_string_append(inspect_s, ">");
50
+ s = rb_sprintf(inspect_s->str, \
51
+ rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("parent_pid"), 0, NULL), \
52
+ rb_funcall(self, rb_intern("origin"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL));
53
+ }
54
+ g_string_free(inspect_s, TRUE);
55
+ return (s);
56
+ }
57
+
58
+ /*
59
+ call-seq:
60
+ #pid() -> Fixnum
61
+ */
62
+ static VALUE Child_pid(VALUE self)
63
+ {
64
+ return (rb_ivar_get(self, rb_intern("pid")));
65
+ }
66
+
67
+ /*
68
+ call-seq:
69
+ #identifier() -> String
70
+ */
71
+ static VALUE Child_identifier(VALUE self)
72
+ {
73
+ return (rb_ivar_get(self, rb_intern("identifier")));
74
+ }
75
+
76
+ /*
77
+ call-seq:
78
+ #parent_pid() -> Fixnum
79
+ */
80
+ static VALUE Child_parent_pid(VALUE self)
81
+ {
82
+ return (rb_ivar_get(self, rb_intern("parent_pid")));
83
+ }
84
+
85
+ /*
86
+ call-seq:
87
+ #path() -> String
88
+ */
89
+ static VALUE Child_path(VALUE self)
90
+ {
91
+ return (rb_ivar_get(self, rb_intern("path")));
92
+ }
93
+
94
+ /*
95
+ call-seq:
96
+ #argv() -> Array
97
+ */
98
+ static VALUE Child_argv(VALUE self)
99
+ {
100
+ return (rb_ivar_get(self, rb_intern("argv")));
101
+ }
102
+
103
+ /*
104
+ call-seq:
105
+ #envp() -> Array
106
+ */
107
+ static VALUE Child_envp(VALUE self)
108
+ {
109
+ return (rb_ivar_get(self, rb_intern("envp")));
110
+ }
111
+
112
+ /*
113
+ call-seq:
114
+ #origin() -> String
115
+ */
116
+ static VALUE Child_origin(VALUE self)
117
+ {
118
+ return (rb_ivar_get(self, rb_intern("origin")));
119
+ }
120
+
121
+ void define_Child()
122
+ {
123
+ cChild = rb_define_class_under(mCFrida, "Child", cGObject);
124
+
125
+ rb_define_method(cChild, "inspect", Child_inspect, 0);
126
+ rb_define_alias(cChild, "to_s", "inspect");
127
+ rb_define_method(cChild, "pid", Child_pid, 0);
128
+ rb_define_method(cChild, "parent_pid", Child_parent_pid, 0);
129
+ rb_define_method(cChild, "identifier", Child_identifier, 0);
130
+ rb_define_method(cChild, "origin", Child_origin, 0);
131
+ rb_define_method(cChild, "path", Child_path, 0);
132
+ rb_define_method(cChild, "argv", Child_argv, 0);
133
+ rb_define_method(cChild, "envp", Child_envp, 0);
134
+ }
File without changes
data/ext/c_frida/Crash.c CHANGED
File without changes