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/Spawn.c CHANGED
@@ -1,53 +1,53 @@
1
- #include "Spawn.h"
2
-
3
- VALUE Spawn_from_FridaSpawn(FridaSpawn *handle)
4
- {
5
- VALUE self;
6
-
7
- if (!handle)
8
- return (Qnil);
9
- self = rb_class_new_instance(0, NULL, cSpawn);
10
- GET_GOBJECT_DATA();
11
- d->handle = handle;
12
- d->destroy = g_object_unref;
13
- rb_ivar_set(self, rb_intern("pid"), UINT2NUM(frida_spawn_get_pid(d->handle)));
14
- rb_ivar_set(self, rb_intern("identifier"), rbGObject_marshal_string(frida_spawn_get_identifier(d->handle)));
15
- return (self);
16
- }
17
-
18
- static VALUE Spawn_inspect(VALUE self)
19
- {
20
- VALUE s;
21
-
22
- s = rb_sprintf("#<Spawn: pid=%+"PRIsVALUE", identifier=%+"PRIsVALUE">", \
23
- rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL));
24
- return (s);
25
- }
26
-
27
- /*
28
- call-seq:
29
- #pid() -> Fixnum
30
- */
31
- static VALUE Spawn_pid(VALUE self)
32
- {
33
- return (rb_ivar_get(self, rb_intern("pid")));
34
- }
35
-
36
- /*
37
- call-seq:
38
- #identifier() -> String
39
- */
40
- static VALUE Spawn_identifier(VALUE self)
41
- {
42
- return (rb_ivar_get(self, rb_intern("identifier")));
43
- }
44
-
45
- void define_Spawn()
46
- {
47
- cSpawn = rb_define_class_under(mCFrida, "Spawn", cGObject);
48
-
49
- rb_define_method(cSpawn, "inspect", Spawn_inspect, 0);
50
- rb_define_alias(cSpawn, "to_s", "inspect");
51
- rb_define_method(cSpawn, "pid", Spawn_pid, 0);
52
- rb_define_method(cSpawn, "identifier", Spawn_identifier, 0);
53
- }
1
+ #include "Spawn.h"
2
+
3
+ VALUE Spawn_from_FridaSpawn(FridaSpawn *handle)
4
+ {
5
+ VALUE self;
6
+
7
+ if (!handle)
8
+ return (Qnil);
9
+ self = rb_class_new_instance(0, NULL, cSpawn);
10
+ GET_GOBJECT_DATA();
11
+ d->handle = handle;
12
+ d->destroy = g_object_unref;
13
+ rb_ivar_set(self, rb_intern("pid"), UINT2NUM(frida_spawn_get_pid(d->handle)));
14
+ rb_ivar_set(self, rb_intern("identifier"), rbGObject_marshal_string(frida_spawn_get_identifier(d->handle)));
15
+ return (self);
16
+ }
17
+
18
+ static VALUE Spawn_inspect(VALUE self)
19
+ {
20
+ VALUE s;
21
+
22
+ s = rb_sprintf("#<Spawn: pid=%+"PRIsVALUE", identifier=%+"PRIsVALUE">", \
23
+ rb_funcall(self, rb_intern("pid"), 0, NULL), rb_funcall(self, rb_intern("identifier"), 0, NULL));
24
+ return (s);
25
+ }
26
+
27
+ /*
28
+ call-seq:
29
+ #pid() -> Fixnum
30
+ */
31
+ static VALUE Spawn_pid(VALUE self)
32
+ {
33
+ return (rb_ivar_get(self, rb_intern("pid")));
34
+ }
35
+
36
+ /*
37
+ call-seq:
38
+ #identifier() -> String
39
+ */
40
+ static VALUE Spawn_identifier(VALUE self)
41
+ {
42
+ return (rb_ivar_get(self, rb_intern("identifier")));
43
+ }
44
+
45
+ void define_Spawn()
46
+ {
47
+ cSpawn = rb_define_class_under(mCFrida, "Spawn", cGObject);
48
+
49
+ rb_define_method(cSpawn, "inspect", Spawn_inspect, 0);
50
+ rb_define_alias(cSpawn, "to_s", "inspect");
51
+ rb_define_method(cSpawn, "pid", Spawn_pid, 0);
52
+ rb_define_method(cSpawn, "identifier", Spawn_identifier, 0);
53
+ }
@@ -1,68 +1,68 @@
1
- #include "c_frida.h"
2
-
3
- VALUE _gvl_bridge_thread;
4
-
5
- VALUE mCFrida;
6
- VALUE cGObject;
7
- VALUE cDevice;
8
- VALUE cDeviceManager;
9
- VALUE cBus;
10
- VALUE cIOStream;
11
- VALUE cApplication;
12
- VALUE cProcess;
13
- VALUE cSpawn;
14
- VALUE cChild;
15
- VALUE cSession;
16
- VALUE cScript;
17
- VALUE cRelay;
18
- VALUE cPortalMembership;
19
- VALUE cCrash;
20
- VALUE cFileMonitor;
21
- VALUE cCompiler;
22
- VALUE cEndpointParameters;
23
- VALUE cPortalService;
24
-
25
- void raise_argerror(char *err)
26
- {
27
- rb_raise(rb_eArgError, "%s", err);
28
- }
29
-
30
- void raise_rerror(char *err, GError *gerr)
31
- {
32
- if (!gerr)
33
- rb_raise(rb_eRuntimeError, "%s", err);
34
- else if (gerr->message) {
35
- VALUE ruby_string = rb_str_new_cstr(gerr->message);
36
- rb_funcall(ruby_string, rb_intern("force_encoding"), 1, rb_const_get(rb_cEncoding, rb_intern("UTF_8")));
37
- rb_funcall(rb_mKernel, rb_intern("raise"), 2, rb_eRuntimeError, ruby_string);
38
- g_error_free(gerr);
39
- } else
40
- raise_rerror("error.", NULL);
41
- }
42
-
43
- void Init_c_frida(void)
44
- {
45
- rb_require("date");
46
- mCFrida = rb_define_module("CFrida");
47
- frida_init();
48
- rb_define_const(mCFrida, "FRIDA_VERSION", rb_str_new_cstr(frida_version_string()));
49
- define_GObject();
50
- define_Device();
51
- define_DeviceManager();
52
- define_Bus();
53
- define_IOStream();
54
- define_Application();
55
- define_Process();
56
- define_Spawn();
57
- define_Child();
58
- define_Session();
59
- define_Script();
60
- define_Relay();
61
- define_PortalMembership();
62
- define_Crash();
63
- define_FileMonitor();
64
- define_Compiler();
65
- define_EndpointParameters();
66
- define_PortalService();
67
- _gvl_bridge_thread = rb_thread_create(RUBY_METHOD_FUNC(gvl_bridge), NULL);
68
- }
1
+ #include "c_frida.h"
2
+
3
+ VALUE _gvl_bridge_thread;
4
+
5
+ VALUE mCFrida;
6
+ VALUE cGObject;
7
+ VALUE cDevice;
8
+ VALUE cDeviceManager;
9
+ VALUE cBus;
10
+ VALUE cIOStream;
11
+ VALUE cApplication;
12
+ VALUE cProcess;
13
+ VALUE cSpawn;
14
+ VALUE cChild;
15
+ VALUE cSession;
16
+ VALUE cScript;
17
+ VALUE cRelay;
18
+ VALUE cPortalMembership;
19
+ VALUE cCrash;
20
+ VALUE cFileMonitor;
21
+ VALUE cCompiler;
22
+ VALUE cEndpointParameters;
23
+ VALUE cPortalService;
24
+
25
+ void raise_argerror(char *err)
26
+ {
27
+ rb_raise(rb_eArgError, "%s", err);
28
+ }
29
+
30
+ void raise_rerror(char *err, GError *gerr)
31
+ {
32
+ if (!gerr)
33
+ rb_raise(rb_eRuntimeError, "%s", err);
34
+ else if (gerr->message) {
35
+ VALUE ruby_string = rb_str_new_cstr(gerr->message);
36
+ rb_funcall(ruby_string, rb_intern("force_encoding"), 1, rb_const_get(rb_cEncoding, rb_intern("UTF_8")));
37
+ rb_funcall(rb_mKernel, rb_intern("raise"), 2, rb_eRuntimeError, ruby_string);
38
+ g_error_free(gerr);
39
+ } else
40
+ raise_rerror("error.", NULL);
41
+ }
42
+
43
+ void Init_c_frida(void)
44
+ {
45
+ rb_require("date");
46
+ mCFrida = rb_define_module("CFrida");
47
+ frida_init();
48
+ rb_define_const(mCFrida, "FRIDA_VERSION", rb_str_new_cstr(frida_version_string()));
49
+ define_GObject();
50
+ define_Device();
51
+ define_DeviceManager();
52
+ define_Bus();
53
+ define_IOStream();
54
+ define_Application();
55
+ define_Process();
56
+ define_Spawn();
57
+ define_Child();
58
+ define_Session();
59
+ define_Script();
60
+ define_Relay();
61
+ define_PortalMembership();
62
+ define_Crash();
63
+ define_FileMonitor();
64
+ define_Compiler();
65
+ define_EndpointParameters();
66
+ define_PortalService();
67
+ _gvl_bridge_thread = rb_thread_create(RUBY_METHOD_FUNC(gvl_bridge), NULL);
68
+ }
@@ -1,26 +1,26 @@
1
- # frozen_string_literal: true
2
- require "mkmf"
3
-
4
- unless ENV["FRIDA_CORE_DEVKIT"] && File.directory?(ENV["FRIDA_CORE_DEVKIT"])
5
- abort "please download frida-core devkit, and set its path in the env variable FRIDA_CORE_DEVKIT"
6
- end
7
-
8
- # todo: use the native #have_header and #have_library
9
- unless File.file?("#{ENV["FRIDA_CORE_DEVKIT"]}/frida-core.h") && File.file?("#{ENV["FRIDA_CORE_DEVKIT"]}/libfrida-core.a")
10
- abort "could not find frida-core.h or libfrida-core.a in the configured env variable FRIDA_CORE_DEVKIT"
11
- end
12
-
13
- if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /x86_64/
14
- target = "x86_64-apple-macos10.9"
15
- $CFLAGS << " -I#{ENV["FRIDA_CORE_DEVKIT"]} -I#{File.dirname(__FILE__)}/inc"
16
- $CFLAGS << " -target #{target} -w"
17
- $libs << " -L. -L#{ENV["FRIDA_CORE_DEVKIT"]} -lfrida-core -lbsm -ldl -lm -lresolv"
18
- $LDFLAGS << " -Wl,-framework,Foundation,-framework,AppKit,-dead_strip"
19
- elsif RUBY_PLATFORM =~ /linux/
20
- $CFLAGS = "-g3 -ffunction-sections -fdata-sections -I#{ENV["FRIDA_CORE_DEVKIT"]} -I#{File.dirname(__FILE__)}/inc"
21
- $LDFLAGS = "-Wl,--export-dynamic -static-libgcc -Wl,-z,noexecstack,--gc-sections -L#{ENV["FRIDA_CORE_DEVKIT"]} -lfrida-core -ldl -lrt -lm -lresolv -pthread"
22
- else
23
- abort "Platform not supported."
24
- end
25
-
1
+ # frozen_string_literal: true
2
+ require "mkmf"
3
+
4
+ unless ENV["FRIDA_CORE_DEVKIT"] && File.directory?(ENV["FRIDA_CORE_DEVKIT"])
5
+ abort "please download frida-core devkit, and set its path in the env variable FRIDA_CORE_DEVKIT"
6
+ end
7
+
8
+ # todo: use the native #have_header and #have_library
9
+ unless File.file?("#{ENV["FRIDA_CORE_DEVKIT"]}/frida-core.h") && File.file?("#{ENV["FRIDA_CORE_DEVKIT"]}/libfrida-core.a")
10
+ abort "could not find frida-core.h or libfrida-core.a in the configured env variable FRIDA_CORE_DEVKIT"
11
+ end
12
+
13
+ if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /x86_64/
14
+ target = "x86_64-apple-macos10.9"
15
+ $CFLAGS << " -I#{ENV["FRIDA_CORE_DEVKIT"]} -I#{File.dirname(__FILE__)}/inc"
16
+ $CFLAGS << " -target #{target} -w"
17
+ $libs << " -L. -L#{ENV["FRIDA_CORE_DEVKIT"]} -lfrida-core -lbsm -ldl -lm -lresolv"
18
+ $LDFLAGS << " -Wl,-framework,Foundation,-framework,AppKit,-dead_strip"
19
+ elsif RUBY_PLATFORM =~ /linux/
20
+ $CFLAGS = "-g3 -ffunction-sections -fdata-sections -I#{ENV["FRIDA_CORE_DEVKIT"]} -I#{File.dirname(__FILE__)}/inc"
21
+ $LDFLAGS = "-Wl,--export-dynamic -static-libgcc -Wl,-z,noexecstack,--gc-sections -L#{ENV["FRIDA_CORE_DEVKIT"]} -lfrida-core -ldl -lrt -lm -lresolv -pthread"
22
+ else
23
+ abort "Platform not supported."
24
+ end
25
+
26
26
  create_makefile("c_frida")