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.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +84 -84
- data/Gemfile +12 -12
- data/Gemfile.lock +25 -25
- data/LICENSE.txt +21 -21
- data/README.md +64 -64
- data/Rakefile +20 -20
- data/exe/frida +3 -3
- data/ext/c_frida/Application.c +79 -79
- data/ext/c_frida/Bus.c +91 -91
- data/ext/c_frida/Child.c +134 -134
- data/ext/c_frida/Compiler.c +0 -0
- data/ext/c_frida/Crash.c +0 -0
- data/ext/c_frida/Device.c +955 -955
- data/ext/c_frida/DeviceManager.c +260 -260
- data/ext/c_frida/EndpointParameters.c +0 -0
- data/ext/c_frida/FileMonitor.c +0 -0
- data/ext/c_frida/GObject.c +0 -0
- data/ext/c_frida/IOStream.c +228 -228
- data/ext/c_frida/PortalMembership.c +0 -0
- data/ext/c_frida/PortalService.c +0 -0
- data/ext/c_frida/Process.c +67 -67
- data/ext/c_frida/Relay.c +0 -0
- data/ext/c_frida/Script.c +221 -221
- data/ext/c_frida/Session.c +626 -626
- data/ext/c_frida/Spawn.c +53 -53
- data/ext/c_frida/c_frida.c +68 -68
- data/ext/c_frida/extconf.rb +25 -25
- data/ext/c_frida/gutils.c +498 -498
- data/ext/c_frida/gvl_bridge.c +131 -131
- data/ext/c_frida/inc/Application.h +9 -9
- data/ext/c_frida/inc/Bus.h +15 -15
- data/ext/c_frida/inc/Child.h +9 -9
- data/ext/c_frida/inc/Compiler.h +0 -0
- data/ext/c_frida/inc/Crash.h +0 -0
- data/ext/c_frida/inc/Device.h +71 -71
- data/ext/c_frida/inc/DeviceManager.h +20 -20
- data/ext/c_frida/inc/EndpointParameters.h +0 -0
- data/ext/c_frida/inc/FileMonitor.h +0 -0
- data/ext/c_frida/inc/GObject.h +0 -0
- data/ext/c_frida/inc/IOStream.h +29 -29
- data/ext/c_frida/inc/PortalMembership.h +0 -0
- data/ext/c_frida/inc/PortalService.h +0 -0
- data/ext/c_frida/inc/Process.h +9 -9
- data/ext/c_frida/inc/Relay.h +0 -0
- data/ext/c_frida/inc/Script.h +21 -21
- data/ext/c_frida/inc/Session.h +40 -40
- data/ext/c_frida/inc/Spawn.h +9 -9
- data/ext/c_frida/inc/c_frida.h +129 -129
- data/ext/c_frida/inc/gutils.h +21 -21
- data/ext/c_frida/inc/gvl_bridge.h +42 -42
- data/lib/frida/version.rb +5 -5
- data/lib/frida.rb +8 -8
- metadata +3 -6
- data/frida.gemspec +0 -39
data/ext/c_frida/IOStream.c
CHANGED
@@ -1,228 +1,228 @@
|
|
1
|
-
#include "IOStream.h"
|
2
|
-
|
3
|
-
DEFINE_GOBJECT_CHILD_KLASS_DATA_TYPE(IOStream);
|
4
|
-
|
5
|
-
VALUE IOStream_from_GIOStream(GIOStream *stream)
|
6
|
-
{
|
7
|
-
VALUE self;
|
8
|
-
|
9
|
-
if (!stream) return (Qnil);
|
10
|
-
self = rb_class_new_instance(0, NULL, cIOStream);
|
11
|
-
GET_GOBJECT_DATA();
|
12
|
-
d->handle = stream;
|
13
|
-
GET_DATA_EX(IOStream, self, io_d);
|
14
|
-
io_d->input = g_io_stream_get_input_stream(d->handle);
|
15
|
-
io_d->output = g_io_stream_get_output_stream(d->handle);
|
16
|
-
return (self);
|
17
|
-
}
|
18
|
-
|
19
|
-
void IOStream_free(IOStream_d *d)
|
20
|
-
{
|
21
|
-
if (d->base.handle)
|
22
|
-
g_object_unref(d->base.handle);
|
23
|
-
xfree(d);
|
24
|
-
}
|
25
|
-
|
26
|
-
/*
|
27
|
-
call-seq:
|
28
|
-
#is_closed() -> [TrueClass, FalseClass]
|
29
|
-
*/
|
30
|
-
static VALUE IOStream_is_closed(VALUE self)
|
31
|
-
{
|
32
|
-
GET_GOBJECT_DATA();
|
33
|
-
REQUIRE_GOBJECT_HANDLE();
|
34
|
-
return (g_io_stream_is_closed(d->handle) ? Qtrue : Qfalse);
|
35
|
-
}
|
36
|
-
|
37
|
-
static VALUE IOStream_inspect(VALUE self)
|
38
|
-
{
|
39
|
-
GET_GOBJECT_DATA();
|
40
|
-
VALUE s;
|
41
|
-
|
42
|
-
s = rb_sprintf("#<IOStream: handle=\"%p\", is_closed=%+"PRIsVALUE">", d->handle, rb_funcall(self, rb_intern("is_closed"), 0, NULL));
|
43
|
-
return (s);
|
44
|
-
}
|
45
|
-
|
46
|
-
GVL_FREE_PROXY_FUNC(write, write_proxy_args *args)
|
47
|
-
{
|
48
|
-
GError *gerr = NULL;
|
49
|
-
gsize written;
|
50
|
-
|
51
|
-
written = g_output_stream_write(args->output, args->data, args->size, NULL, &gerr);
|
52
|
-
RETURN_GVL_FREE_RESULT((void*)written);
|
53
|
-
}
|
54
|
-
|
55
|
-
/*
|
56
|
-
call-seq:
|
57
|
-
#write(data) -> Fixnum
|
58
|
-
*/
|
59
|
-
static VALUE IOStream_write(VALUE self, VALUE data)
|
60
|
-
{
|
61
|
-
GET_GOBJECT_DATA();
|
62
|
-
REQUIRE_GOBJECT_HANDLE();
|
63
|
-
GET_DATA_EX(IOStream, self, io_d);
|
64
|
-
|
65
|
-
if (!RB_TYPE_P(data, T_STRING)) {
|
66
|
-
raise_argerror("data should be a string.");
|
67
|
-
return (Qnil);
|
68
|
-
}
|
69
|
-
write_proxy_args args = {
|
70
|
-
.output = io_d->output,
|
71
|
-
.data = RSTRING_PTR(data),
|
72
|
-
.size = RSTRING_LEN(data)
|
73
|
-
};
|
74
|
-
CALL_GVL_FREE_WITH_RET(void *written, write, &args);
|
75
|
-
return (ULONG2NUM((gsize)written));
|
76
|
-
|
77
|
-
GERROR_BLOCK
|
78
|
-
}
|
79
|
-
|
80
|
-
GVL_FREE_PROXY_FUNC(write_all, write_proxy_args *args)
|
81
|
-
{
|
82
|
-
GError *gerr = NULL;
|
83
|
-
|
84
|
-
g_output_stream_write_all(args->output, args->data, args->size, NULL, NULL, &gerr);
|
85
|
-
RETURN_GVL_FREE_RESULT(NULL);
|
86
|
-
}
|
87
|
-
|
88
|
-
/*
|
89
|
-
call-seq:
|
90
|
-
#write_all(data) -> nil
|
91
|
-
*/
|
92
|
-
static VALUE IOStream_write_all(VALUE self, VALUE data)
|
93
|
-
{
|
94
|
-
GET_GOBJECT_DATA();
|
95
|
-
REQUIRE_GOBJECT_HANDLE();
|
96
|
-
GET_DATA_EX(IOStream, self, io_d);
|
97
|
-
|
98
|
-
if (!RB_TYPE_P(data, T_STRING)) {
|
99
|
-
raise_argerror("data should be a string.");
|
100
|
-
return (Qnil);
|
101
|
-
}
|
102
|
-
write_proxy_args args = {
|
103
|
-
.output = io_d->output,
|
104
|
-
.data = RSTRING_PTR(data),
|
105
|
-
.size = RSTRING_LEN(data)
|
106
|
-
};
|
107
|
-
CALL_GVL_FREE_WITH_RET(void *dummy, write_all, &args);
|
108
|
-
return (Qnil);
|
109
|
-
|
110
|
-
GERROR_BLOCK
|
111
|
-
}
|
112
|
-
|
113
|
-
GVL_FREE_PROXY_FUNC(read, read_proxy_args *args)
|
114
|
-
{
|
115
|
-
GError *gerr = NULL;
|
116
|
-
gsize read;
|
117
|
-
|
118
|
-
read = g_input_stream_read(args->input, args->buffer, args->count, NULL, &gerr);
|
119
|
-
RETURN_GVL_FREE_RESULT((void*)read);
|
120
|
-
}
|
121
|
-
|
122
|
-
/*
|
123
|
-
call-seq:
|
124
|
-
#read(count) -> String
|
125
|
-
*/
|
126
|
-
static VALUE IOStream_read(VALUE self, VALUE count)
|
127
|
-
{
|
128
|
-
GET_GOBJECT_DATA();
|
129
|
-
REQUIRE_GOBJECT_HANDLE();
|
130
|
-
GET_DATA_EX(IOStream, self, io_d);
|
131
|
-
|
132
|
-
if (!FIXNUM_P(count)) {
|
133
|
-
raise_argerror("count should be a number.");
|
134
|
-
return (Qnil);
|
135
|
-
}
|
136
|
-
VALUE buffer = rb_str_new(NULL, NUM2ULONG(count));
|
137
|
-
read_proxy_args args = {
|
138
|
-
.input = io_d->input,
|
139
|
-
.buffer = RSTRING_PTR(buffer),
|
140
|
-
.count = NUM2ULONG(count)
|
141
|
-
};
|
142
|
-
CALL_GVL_FREE_WITH_RET(void *read, read, &args);
|
143
|
-
if ((gsize)read != NUM2ULONG(count))
|
144
|
-
buffer = rb_str_new(RSTRING_PTR(buffer), (gsize)read);
|
145
|
-
return (buffer);
|
146
|
-
|
147
|
-
GERROR_BLOCK
|
148
|
-
}
|
149
|
-
|
150
|
-
GVL_FREE_PROXY_FUNC(read_all, read_proxy_args *args)
|
151
|
-
{
|
152
|
-
GError *gerr = NULL;
|
153
|
-
gsize read;
|
154
|
-
|
155
|
-
g_input_stream_read_all(args->input, args->buffer, args->count, &read, NULL, &gerr);
|
156
|
-
RETURN_GVL_FREE_RESULT(NULL);
|
157
|
-
}
|
158
|
-
|
159
|
-
/*
|
160
|
-
call-seq:
|
161
|
-
#read_all(count) -> String
|
162
|
-
*/
|
163
|
-
static VALUE IOStream_read_all(VALUE self, VALUE count)
|
164
|
-
{
|
165
|
-
GET_GOBJECT_DATA();
|
166
|
-
REQUIRE_GOBJECT_HANDLE();
|
167
|
-
GET_DATA_EX(IOStream, self, io_d);
|
168
|
-
|
169
|
-
if (!FIXNUM_P(count)) {
|
170
|
-
raise_argerror("count should be a number.");
|
171
|
-
return (Qnil);
|
172
|
-
}
|
173
|
-
VALUE buffer = rb_str_new(NULL, NUM2ULONG(count));
|
174
|
-
read_proxy_args args = {
|
175
|
-
.input = io_d->input,
|
176
|
-
.buffer = RSTRING_PTR(buffer),
|
177
|
-
.count = NUM2ULONG(count)
|
178
|
-
};
|
179
|
-
CALL_GVL_FREE_WITH_RET(void *dummy, read_all, &args);
|
180
|
-
return (buffer);
|
181
|
-
|
182
|
-
GERROR_BLOCK
|
183
|
-
}
|
184
|
-
|
185
|
-
GVL_FREE_PROXY_FUNC(close, GIOStream *handle)
|
186
|
-
{
|
187
|
-
GError *gerr = NULL;
|
188
|
-
|
189
|
-
g_io_stream_close(handle, NULL, &gerr);
|
190
|
-
RETURN_GVL_FREE_RESULT(NULL);
|
191
|
-
}
|
192
|
-
|
193
|
-
/*
|
194
|
-
call-seq:
|
195
|
-
#close() -> nil
|
196
|
-
*/
|
197
|
-
static VALUE IOStream_close(VALUE self)
|
198
|
-
{
|
199
|
-
GET_GOBJECT_DATA();
|
200
|
-
REQUIRE_GOBJECT_HANDLE();
|
201
|
-
|
202
|
-
CALL_GVL_FREE_WITH_RET(void *dummy, close, d->handle);
|
203
|
-
return (Qnil);
|
204
|
-
|
205
|
-
GERROR_BLOCK
|
206
|
-
}
|
207
|
-
|
208
|
-
static VALUE IOStream_alloc(VALUE klass)
|
209
|
-
{
|
210
|
-
MAKE_DATA(IOStream);
|
211
|
-
memset(d, 0, sizeof(IOStream_d));
|
212
|
-
rb_ivar_set(obj, rb_intern("callbacks"), rb_hash_new());
|
213
|
-
return (obj);
|
214
|
-
}
|
215
|
-
|
216
|
-
void define_IOStream()
|
217
|
-
{
|
218
|
-
cIOStream = rb_define_class_under(mCFrida, "IOStream", cGObject);
|
219
|
-
rb_define_alloc_func(cIOStream, IOStream_alloc);
|
220
|
-
rb_define_method(cIOStream, "inspect", IOStream_inspect, 0);
|
221
|
-
rb_define_alias(cIOStream, "to_s", "inspect");
|
222
|
-
rb_define_method(cIOStream, "is_closed", IOStream_is_closed, 0);
|
223
|
-
rb_define_method(cIOStream, "read", IOStream_read, 1);
|
224
|
-
rb_define_method(cIOStream, "read_all", IOStream_read_all, 1);
|
225
|
-
rb_define_method(cIOStream, "write", IOStream_write, 1);
|
226
|
-
rb_define_method(cIOStream, "write_all", IOStream_write_all, 1);
|
227
|
-
rb_define_method(cIOStream, "close", IOStream_close, 0);
|
228
|
-
}
|
1
|
+
#include "IOStream.h"
|
2
|
+
|
3
|
+
DEFINE_GOBJECT_CHILD_KLASS_DATA_TYPE(IOStream);
|
4
|
+
|
5
|
+
VALUE IOStream_from_GIOStream(GIOStream *stream)
|
6
|
+
{
|
7
|
+
VALUE self;
|
8
|
+
|
9
|
+
if (!stream) return (Qnil);
|
10
|
+
self = rb_class_new_instance(0, NULL, cIOStream);
|
11
|
+
GET_GOBJECT_DATA();
|
12
|
+
d->handle = stream;
|
13
|
+
GET_DATA_EX(IOStream, self, io_d);
|
14
|
+
io_d->input = g_io_stream_get_input_stream(d->handle);
|
15
|
+
io_d->output = g_io_stream_get_output_stream(d->handle);
|
16
|
+
return (self);
|
17
|
+
}
|
18
|
+
|
19
|
+
void IOStream_free(IOStream_d *d)
|
20
|
+
{
|
21
|
+
if (d->base.handle)
|
22
|
+
g_object_unref(d->base.handle);
|
23
|
+
xfree(d);
|
24
|
+
}
|
25
|
+
|
26
|
+
/*
|
27
|
+
call-seq:
|
28
|
+
#is_closed() -> [TrueClass, FalseClass]
|
29
|
+
*/
|
30
|
+
static VALUE IOStream_is_closed(VALUE self)
|
31
|
+
{
|
32
|
+
GET_GOBJECT_DATA();
|
33
|
+
REQUIRE_GOBJECT_HANDLE();
|
34
|
+
return (g_io_stream_is_closed(d->handle) ? Qtrue : Qfalse);
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE IOStream_inspect(VALUE self)
|
38
|
+
{
|
39
|
+
GET_GOBJECT_DATA();
|
40
|
+
VALUE s;
|
41
|
+
|
42
|
+
s = rb_sprintf("#<IOStream: handle=\"%p\", is_closed=%+"PRIsVALUE">", d->handle, rb_funcall(self, rb_intern("is_closed"), 0, NULL));
|
43
|
+
return (s);
|
44
|
+
}
|
45
|
+
|
46
|
+
GVL_FREE_PROXY_FUNC(write, write_proxy_args *args)
|
47
|
+
{
|
48
|
+
GError *gerr = NULL;
|
49
|
+
gsize written;
|
50
|
+
|
51
|
+
written = g_output_stream_write(args->output, args->data, args->size, NULL, &gerr);
|
52
|
+
RETURN_GVL_FREE_RESULT((void*)written);
|
53
|
+
}
|
54
|
+
|
55
|
+
/*
|
56
|
+
call-seq:
|
57
|
+
#write(data) -> Fixnum
|
58
|
+
*/
|
59
|
+
static VALUE IOStream_write(VALUE self, VALUE data)
|
60
|
+
{
|
61
|
+
GET_GOBJECT_DATA();
|
62
|
+
REQUIRE_GOBJECT_HANDLE();
|
63
|
+
GET_DATA_EX(IOStream, self, io_d);
|
64
|
+
|
65
|
+
if (!RB_TYPE_P(data, T_STRING)) {
|
66
|
+
raise_argerror("data should be a string.");
|
67
|
+
return (Qnil);
|
68
|
+
}
|
69
|
+
write_proxy_args args = {
|
70
|
+
.output = io_d->output,
|
71
|
+
.data = RSTRING_PTR(data),
|
72
|
+
.size = RSTRING_LEN(data)
|
73
|
+
};
|
74
|
+
CALL_GVL_FREE_WITH_RET(void *written, write, &args);
|
75
|
+
return (ULONG2NUM((gsize)written));
|
76
|
+
|
77
|
+
GERROR_BLOCK
|
78
|
+
}
|
79
|
+
|
80
|
+
GVL_FREE_PROXY_FUNC(write_all, write_proxy_args *args)
|
81
|
+
{
|
82
|
+
GError *gerr = NULL;
|
83
|
+
|
84
|
+
g_output_stream_write_all(args->output, args->data, args->size, NULL, NULL, &gerr);
|
85
|
+
RETURN_GVL_FREE_RESULT(NULL);
|
86
|
+
}
|
87
|
+
|
88
|
+
/*
|
89
|
+
call-seq:
|
90
|
+
#write_all(data) -> nil
|
91
|
+
*/
|
92
|
+
static VALUE IOStream_write_all(VALUE self, VALUE data)
|
93
|
+
{
|
94
|
+
GET_GOBJECT_DATA();
|
95
|
+
REQUIRE_GOBJECT_HANDLE();
|
96
|
+
GET_DATA_EX(IOStream, self, io_d);
|
97
|
+
|
98
|
+
if (!RB_TYPE_P(data, T_STRING)) {
|
99
|
+
raise_argerror("data should be a string.");
|
100
|
+
return (Qnil);
|
101
|
+
}
|
102
|
+
write_proxy_args args = {
|
103
|
+
.output = io_d->output,
|
104
|
+
.data = RSTRING_PTR(data),
|
105
|
+
.size = RSTRING_LEN(data)
|
106
|
+
};
|
107
|
+
CALL_GVL_FREE_WITH_RET(void *dummy, write_all, &args);
|
108
|
+
return (Qnil);
|
109
|
+
|
110
|
+
GERROR_BLOCK
|
111
|
+
}
|
112
|
+
|
113
|
+
GVL_FREE_PROXY_FUNC(read, read_proxy_args *args)
|
114
|
+
{
|
115
|
+
GError *gerr = NULL;
|
116
|
+
gsize read;
|
117
|
+
|
118
|
+
read = g_input_stream_read(args->input, args->buffer, args->count, NULL, &gerr);
|
119
|
+
RETURN_GVL_FREE_RESULT((void*)read);
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
call-seq:
|
124
|
+
#read(count) -> String
|
125
|
+
*/
|
126
|
+
static VALUE IOStream_read(VALUE self, VALUE count)
|
127
|
+
{
|
128
|
+
GET_GOBJECT_DATA();
|
129
|
+
REQUIRE_GOBJECT_HANDLE();
|
130
|
+
GET_DATA_EX(IOStream, self, io_d);
|
131
|
+
|
132
|
+
if (!FIXNUM_P(count)) {
|
133
|
+
raise_argerror("count should be a number.");
|
134
|
+
return (Qnil);
|
135
|
+
}
|
136
|
+
VALUE buffer = rb_str_new(NULL, NUM2ULONG(count));
|
137
|
+
read_proxy_args args = {
|
138
|
+
.input = io_d->input,
|
139
|
+
.buffer = RSTRING_PTR(buffer),
|
140
|
+
.count = NUM2ULONG(count)
|
141
|
+
};
|
142
|
+
CALL_GVL_FREE_WITH_RET(void *read, read, &args);
|
143
|
+
if ((gsize)read != NUM2ULONG(count))
|
144
|
+
buffer = rb_str_new(RSTRING_PTR(buffer), (gsize)read);
|
145
|
+
return (buffer);
|
146
|
+
|
147
|
+
GERROR_BLOCK
|
148
|
+
}
|
149
|
+
|
150
|
+
GVL_FREE_PROXY_FUNC(read_all, read_proxy_args *args)
|
151
|
+
{
|
152
|
+
GError *gerr = NULL;
|
153
|
+
gsize read;
|
154
|
+
|
155
|
+
g_input_stream_read_all(args->input, args->buffer, args->count, &read, NULL, &gerr);
|
156
|
+
RETURN_GVL_FREE_RESULT(NULL);
|
157
|
+
}
|
158
|
+
|
159
|
+
/*
|
160
|
+
call-seq:
|
161
|
+
#read_all(count) -> String
|
162
|
+
*/
|
163
|
+
static VALUE IOStream_read_all(VALUE self, VALUE count)
|
164
|
+
{
|
165
|
+
GET_GOBJECT_DATA();
|
166
|
+
REQUIRE_GOBJECT_HANDLE();
|
167
|
+
GET_DATA_EX(IOStream, self, io_d);
|
168
|
+
|
169
|
+
if (!FIXNUM_P(count)) {
|
170
|
+
raise_argerror("count should be a number.");
|
171
|
+
return (Qnil);
|
172
|
+
}
|
173
|
+
VALUE buffer = rb_str_new(NULL, NUM2ULONG(count));
|
174
|
+
read_proxy_args args = {
|
175
|
+
.input = io_d->input,
|
176
|
+
.buffer = RSTRING_PTR(buffer),
|
177
|
+
.count = NUM2ULONG(count)
|
178
|
+
};
|
179
|
+
CALL_GVL_FREE_WITH_RET(void *dummy, read_all, &args);
|
180
|
+
return (buffer);
|
181
|
+
|
182
|
+
GERROR_BLOCK
|
183
|
+
}
|
184
|
+
|
185
|
+
GVL_FREE_PROXY_FUNC(close, GIOStream *handle)
|
186
|
+
{
|
187
|
+
GError *gerr = NULL;
|
188
|
+
|
189
|
+
g_io_stream_close(handle, NULL, &gerr);
|
190
|
+
RETURN_GVL_FREE_RESULT(NULL);
|
191
|
+
}
|
192
|
+
|
193
|
+
/*
|
194
|
+
call-seq:
|
195
|
+
#close() -> nil
|
196
|
+
*/
|
197
|
+
static VALUE IOStream_close(VALUE self)
|
198
|
+
{
|
199
|
+
GET_GOBJECT_DATA();
|
200
|
+
REQUIRE_GOBJECT_HANDLE();
|
201
|
+
|
202
|
+
CALL_GVL_FREE_WITH_RET(void *dummy, close, d->handle);
|
203
|
+
return (Qnil);
|
204
|
+
|
205
|
+
GERROR_BLOCK
|
206
|
+
}
|
207
|
+
|
208
|
+
static VALUE IOStream_alloc(VALUE klass)
|
209
|
+
{
|
210
|
+
MAKE_DATA(IOStream);
|
211
|
+
memset(d, 0, sizeof(IOStream_d));
|
212
|
+
rb_ivar_set(obj, rb_intern("callbacks"), rb_hash_new());
|
213
|
+
return (obj);
|
214
|
+
}
|
215
|
+
|
216
|
+
void define_IOStream()
|
217
|
+
{
|
218
|
+
cIOStream = rb_define_class_under(mCFrida, "IOStream", cGObject);
|
219
|
+
rb_define_alloc_func(cIOStream, IOStream_alloc);
|
220
|
+
rb_define_method(cIOStream, "inspect", IOStream_inspect, 0);
|
221
|
+
rb_define_alias(cIOStream, "to_s", "inspect");
|
222
|
+
rb_define_method(cIOStream, "is_closed", IOStream_is_closed, 0);
|
223
|
+
rb_define_method(cIOStream, "read", IOStream_read, 1);
|
224
|
+
rb_define_method(cIOStream, "read_all", IOStream_read_all, 1);
|
225
|
+
rb_define_method(cIOStream, "write", IOStream_write, 1);
|
226
|
+
rb_define_method(cIOStream, "write_all", IOStream_write_all, 1);
|
227
|
+
rb_define_method(cIOStream, "close", IOStream_close, 0);
|
228
|
+
}
|
File without changes
|
data/ext/c_frida/PortalService.c
CHANGED
File without changes
|
data/ext/c_frida/Process.c
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
#include "Process.h"
|
2
|
-
|
3
|
-
VALUE Process_from_FridaProcess(FridaProcess *handle)
|
4
|
-
{
|
5
|
-
VALUE self;
|
6
|
-
|
7
|
-
if (!handle)
|
8
|
-
return (Qnil);
|
9
|
-
self = rb_class_new_instance(0, NULL, cProcess);
|
10
|
-
GET_GOBJECT_DATA();
|
11
|
-
d->handle = handle;
|
12
|
-
d->destroy = g_object_unref;
|
13
|
-
rb_ivar_set(self, rb_intern("pid"), LL2NUM(frida_process_get_pid(d->handle)));
|
14
|
-
rb_ivar_set(self, rb_intern("name"), rb_str_new_cstr(frida_process_get_name(d->handle)));
|
15
|
-
rb_ivar_set(self, rb_intern("parameters"), rbProcess_marshal_parameters_dict(frida_process_get_parameters(d->handle)));
|
16
|
-
return (self);
|
17
|
-
}
|
18
|
-
|
19
|
-
static VALUE Process_inspect(VALUE self)
|
20
|
-
{
|
21
|
-
VALUE s;
|
22
|
-
|
23
|
-
s = rb_sprintf("#<Process: name=%+"PRIsVALUE", pid=%+"PRIsVALUE", parameters=%+"PRIsVALUE">", \
|
24
|
-
rb_funcall(self, rb_intern("name"), 0, NULL),
|
25
|
-
rb_funcall(self, rb_intern("pid"), 0, NULL),
|
26
|
-
rb_funcall(self, rb_intern("parameters"), 0, NULL)
|
27
|
-
);
|
28
|
-
return (s);
|
29
|
-
}
|
30
|
-
|
31
|
-
/*
|
32
|
-
call-seq:
|
33
|
-
#pid() -> Fixnum
|
34
|
-
*/
|
35
|
-
static VALUE Process_pid(VALUE self)
|
36
|
-
{
|
37
|
-
return (rb_ivar_get(self, rb_intern("pid")));
|
38
|
-
}
|
39
|
-
|
40
|
-
/*
|
41
|
-
call-seq:
|
42
|
-
#name() -> String
|
43
|
-
*/
|
44
|
-
static VALUE Process_name(VALUE self)
|
45
|
-
{
|
46
|
-
return (rb_ivar_get(self, rb_intern("name")));
|
47
|
-
}
|
48
|
-
|
49
|
-
/*
|
50
|
-
call-seq:
|
51
|
-
#parameters() -> Hash
|
52
|
-
*/
|
53
|
-
static VALUE Process_parameters(VALUE self)
|
54
|
-
{
|
55
|
-
return (rb_ivar_get(self, rb_intern("parameters")));
|
56
|
-
}
|
57
|
-
|
58
|
-
void define_Process()
|
59
|
-
{
|
60
|
-
cProcess = rb_define_class_under(mCFrida, "Process", cGObject);
|
61
|
-
|
62
|
-
rb_define_method(cProcess, "inspect", Process_inspect, 0);
|
63
|
-
rb_define_alias(cProcess, "to_s", "inspect");
|
64
|
-
rb_define_method(cProcess, "pid", Process_pid, 0);
|
65
|
-
rb_define_method(cProcess, "name", Process_name, 0);
|
66
|
-
rb_define_method(cProcess, "parameters", Process_parameters, 0);
|
67
|
-
}
|
1
|
+
#include "Process.h"
|
2
|
+
|
3
|
+
VALUE Process_from_FridaProcess(FridaProcess *handle)
|
4
|
+
{
|
5
|
+
VALUE self;
|
6
|
+
|
7
|
+
if (!handle)
|
8
|
+
return (Qnil);
|
9
|
+
self = rb_class_new_instance(0, NULL, cProcess);
|
10
|
+
GET_GOBJECT_DATA();
|
11
|
+
d->handle = handle;
|
12
|
+
d->destroy = g_object_unref;
|
13
|
+
rb_ivar_set(self, rb_intern("pid"), LL2NUM(frida_process_get_pid(d->handle)));
|
14
|
+
rb_ivar_set(self, rb_intern("name"), rb_str_new_cstr(frida_process_get_name(d->handle)));
|
15
|
+
rb_ivar_set(self, rb_intern("parameters"), rbProcess_marshal_parameters_dict(frida_process_get_parameters(d->handle)));
|
16
|
+
return (self);
|
17
|
+
}
|
18
|
+
|
19
|
+
static VALUE Process_inspect(VALUE self)
|
20
|
+
{
|
21
|
+
VALUE s;
|
22
|
+
|
23
|
+
s = rb_sprintf("#<Process: name=%+"PRIsVALUE", pid=%+"PRIsVALUE", parameters=%+"PRIsVALUE">", \
|
24
|
+
rb_funcall(self, rb_intern("name"), 0, NULL),
|
25
|
+
rb_funcall(self, rb_intern("pid"), 0, NULL),
|
26
|
+
rb_funcall(self, rb_intern("parameters"), 0, NULL)
|
27
|
+
);
|
28
|
+
return (s);
|
29
|
+
}
|
30
|
+
|
31
|
+
/*
|
32
|
+
call-seq:
|
33
|
+
#pid() -> Fixnum
|
34
|
+
*/
|
35
|
+
static VALUE Process_pid(VALUE self)
|
36
|
+
{
|
37
|
+
return (rb_ivar_get(self, rb_intern("pid")));
|
38
|
+
}
|
39
|
+
|
40
|
+
/*
|
41
|
+
call-seq:
|
42
|
+
#name() -> String
|
43
|
+
*/
|
44
|
+
static VALUE Process_name(VALUE self)
|
45
|
+
{
|
46
|
+
return (rb_ivar_get(self, rb_intern("name")));
|
47
|
+
}
|
48
|
+
|
49
|
+
/*
|
50
|
+
call-seq:
|
51
|
+
#parameters() -> Hash
|
52
|
+
*/
|
53
|
+
static VALUE Process_parameters(VALUE self)
|
54
|
+
{
|
55
|
+
return (rb_ivar_get(self, rb_intern("parameters")));
|
56
|
+
}
|
57
|
+
|
58
|
+
void define_Process()
|
59
|
+
{
|
60
|
+
cProcess = rb_define_class_under(mCFrida, "Process", cGObject);
|
61
|
+
|
62
|
+
rb_define_method(cProcess, "inspect", Process_inspect, 0);
|
63
|
+
rb_define_alias(cProcess, "to_s", "inspect");
|
64
|
+
rb_define_method(cProcess, "pid", Process_pid, 0);
|
65
|
+
rb_define_method(cProcess, "name", Process_name, 0);
|
66
|
+
rb_define_method(cProcess, "parameters", Process_parameters, 0);
|
67
|
+
}
|
data/ext/c_frida/Relay.c
CHANGED
File without changes
|