pwntools 0.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +96 -15
  3. data/Rakefile +8 -2
  4. data/lib/pwn.rb +10 -7
  5. data/lib/pwnlib/abi.rb +61 -0
  6. data/lib/pwnlib/asm.rb +357 -0
  7. data/lib/pwnlib/constants/constant.rb +19 -3
  8. data/lib/pwnlib/constants/constants.rb +46 -20
  9. data/lib/pwnlib/constants/linux/amd64.rb +32 -1
  10. data/lib/pwnlib/constants/linux/i386.rb +2 -0
  11. data/lib/pwnlib/context.rb +128 -27
  12. data/lib/pwnlib/dynelf.rb +122 -54
  13. data/lib/pwnlib/elf/elf.rb +340 -0
  14. data/lib/pwnlib/errors.rb +31 -0
  15. data/lib/pwnlib/ext/array.rb +2 -1
  16. data/lib/pwnlib/ext/helper.rb +6 -5
  17. data/lib/pwnlib/ext/integer.rb +2 -1
  18. data/lib/pwnlib/ext/string.rb +3 -2
  19. data/lib/pwnlib/logger.rb +245 -0
  20. data/lib/pwnlib/memleak.rb +59 -29
  21. data/lib/pwnlib/pwn.rb +27 -9
  22. data/lib/pwnlib/reg_sort.rb +109 -110
  23. data/lib/pwnlib/runner.rb +53 -0
  24. data/lib/pwnlib/shellcraft/generators/amd64/common/common.rb +16 -0
  25. data/lib/pwnlib/shellcraft/generators/amd64/common/infloop.rb +24 -0
  26. data/lib/pwnlib/shellcraft/generators/amd64/common/memcpy.rb +35 -0
  27. data/lib/pwnlib/shellcraft/generators/amd64/common/mov.rb +131 -0
  28. data/lib/pwnlib/shellcraft/generators/amd64/common/nop.rb +18 -0
  29. data/lib/pwnlib/shellcraft/generators/amd64/common/popad.rb +28 -0
  30. data/lib/pwnlib/shellcraft/generators/amd64/common/pushstr.rb +66 -0
  31. data/lib/pwnlib/shellcraft/generators/amd64/common/pushstr_array.rb +24 -0
  32. data/lib/pwnlib/shellcraft/generators/amd64/common/ret.rb +33 -0
  33. data/lib/pwnlib/shellcraft/generators/amd64/common/setregs.rb +24 -0
  34. data/lib/pwnlib/shellcraft/generators/amd64/linux/cat.rb +24 -0
  35. data/lib/pwnlib/shellcraft/generators/amd64/linux/execve.rb +24 -0
  36. data/lib/pwnlib/shellcraft/generators/amd64/linux/exit.rb +24 -0
  37. data/lib/pwnlib/shellcraft/generators/amd64/linux/linux.rb +16 -0
  38. data/lib/pwnlib/shellcraft/generators/amd64/linux/ls.rb +24 -0
  39. data/lib/pwnlib/shellcraft/generators/amd64/linux/open.rb +24 -0
  40. data/lib/pwnlib/shellcraft/generators/amd64/linux/sh.rb +24 -0
  41. data/lib/pwnlib/shellcraft/generators/amd64/linux/sleep.rb +24 -0
  42. data/lib/pwnlib/shellcraft/generators/amd64/linux/syscall.rb +24 -0
  43. data/lib/pwnlib/shellcraft/generators/helper.rb +115 -0
  44. data/lib/pwnlib/shellcraft/generators/i386/common/common.rb +16 -0
  45. data/lib/pwnlib/shellcraft/generators/i386/common/infloop.rb +24 -0
  46. data/lib/pwnlib/shellcraft/generators/i386/common/memcpy.rb +34 -0
  47. data/lib/pwnlib/shellcraft/generators/i386/common/mov.rb +93 -0
  48. data/lib/pwnlib/shellcraft/generators/i386/common/nop.rb +18 -0
  49. data/lib/pwnlib/shellcraft/generators/i386/common/pushstr.rb +41 -0
  50. data/lib/pwnlib/shellcraft/generators/i386/common/pushstr_array.rb +24 -0
  51. data/lib/pwnlib/shellcraft/generators/i386/common/setregs.rb +24 -0
  52. data/lib/pwnlib/shellcraft/generators/i386/linux/cat.rb +24 -0
  53. data/lib/pwnlib/shellcraft/generators/i386/linux/execve.rb +24 -0
  54. data/lib/pwnlib/shellcraft/generators/i386/linux/exit.rb +24 -0
  55. data/lib/pwnlib/shellcraft/generators/i386/linux/linux.rb +16 -0
  56. data/lib/pwnlib/shellcraft/generators/i386/linux/ls.rb +24 -0
  57. data/lib/pwnlib/shellcraft/generators/i386/linux/open.rb +24 -0
  58. data/lib/pwnlib/shellcraft/generators/i386/linux/sh.rb +24 -0
  59. data/lib/pwnlib/shellcraft/generators/i386/linux/sleep.rb +24 -0
  60. data/lib/pwnlib/shellcraft/generators/i386/linux/syscall.rb +24 -0
  61. data/lib/pwnlib/shellcraft/generators/x86/common/common.rb +29 -0
  62. data/lib/pwnlib/shellcraft/generators/x86/common/infloop.rb +24 -0
  63. data/lib/pwnlib/shellcraft/generators/x86/common/memcpy.rb +17 -0
  64. data/lib/pwnlib/shellcraft/generators/x86/common/mov.rb +17 -0
  65. data/lib/pwnlib/shellcraft/generators/x86/common/pushstr.rb +17 -0
  66. data/lib/pwnlib/shellcraft/generators/x86/common/pushstr_array.rb +86 -0
  67. data/lib/pwnlib/shellcraft/generators/x86/common/setregs.rb +84 -0
  68. data/lib/pwnlib/shellcraft/generators/x86/linux/cat.rb +54 -0
  69. data/lib/pwnlib/shellcraft/generators/x86/linux/execve.rb +72 -0
  70. data/lib/pwnlib/shellcraft/generators/x86/linux/exit.rb +34 -0
  71. data/lib/pwnlib/shellcraft/generators/x86/linux/linux.rb +16 -0
  72. data/lib/pwnlib/shellcraft/generators/x86/linux/ls.rb +67 -0
  73. data/lib/pwnlib/shellcraft/generators/x86/linux/open.rb +47 -0
  74. data/lib/pwnlib/shellcraft/generators/x86/linux/sh.rb +53 -0
  75. data/lib/pwnlib/shellcraft/generators/x86/linux/sleep.rb +52 -0
  76. data/lib/pwnlib/shellcraft/generators/x86/linux/syscall.rb +52 -0
  77. data/lib/pwnlib/shellcraft/registers.rb +148 -0
  78. data/lib/pwnlib/shellcraft/shellcraft.rb +73 -0
  79. data/lib/pwnlib/timer.rb +67 -0
  80. data/lib/pwnlib/tubes/buffer.rb +99 -0
  81. data/lib/pwnlib/tubes/process.rb +155 -0
  82. data/lib/pwnlib/tubes/serialtube.rb +114 -0
  83. data/lib/pwnlib/tubes/sock.rb +101 -0
  84. data/lib/pwnlib/tubes/tube.rb +442 -0
  85. data/lib/pwnlib/ui.rb +21 -0
  86. data/lib/pwnlib/util/cyclic.rb +97 -94
  87. data/lib/pwnlib/util/fiddling.rb +288 -220
  88. data/lib/pwnlib/util/getdents.rb +85 -0
  89. data/lib/pwnlib/util/hexdump.rb +116 -112
  90. data/lib/pwnlib/util/lists.rb +58 -0
  91. data/lib/pwnlib/util/packing.rb +223 -228
  92. data/lib/pwnlib/util/ruby.rb +19 -0
  93. data/lib/pwnlib/version.rb +3 -1
  94. data/test/abi_test.rb +22 -0
  95. data/test/asm_test.rb +177 -0
  96. data/test/constants/constant_test.rb +2 -0
  97. data/test/constants/constants_test.rb +5 -2
  98. data/test/context_test.rb +14 -3
  99. data/test/data/assembly/aarch64.s +19 -0
  100. data/test/data/assembly/amd64.s +21 -0
  101. data/test/data/assembly/arm.s +9 -0
  102. data/test/data/assembly/i386.s +21 -0
  103. data/test/data/assembly/mips.s +16 -0
  104. data/test/data/assembly/mips64.s +6 -0
  105. data/test/data/assembly/powerpc.s +18 -0
  106. data/test/data/assembly/powerpc64.s +36 -0
  107. data/test/data/assembly/sparc.s +33 -0
  108. data/test/data/assembly/sparc64.s +5 -0
  109. data/test/data/assembly/thumb.s +37 -0
  110. data/test/data/echo.rb +16 -0
  111. data/test/data/elfs/Makefile +24 -0
  112. data/test/data/elfs/amd64.frelro.elf +0 -0
  113. data/test/data/elfs/amd64.frelro.pie.elf +0 -0
  114. data/test/data/elfs/amd64.nrelro.elf +0 -0
  115. data/test/data/elfs/amd64.prelro.elf +0 -0
  116. data/test/data/elfs/amd64.static.elf +0 -0
  117. data/test/data/elfs/i386.frelro.pie.elf +0 -0
  118. data/test/data/elfs/i386.prelro.elf +0 -0
  119. data/test/data/elfs/source.cpp +19 -0
  120. data/test/data/flag +1 -0
  121. data/test/data/lib32/ld.so.2 +0 -0
  122. data/test/data/lib32/libc.so.6 +0 -0
  123. data/test/data/lib64/ld.so.2 +0 -0
  124. data/test/data/lib64/libc.so.6 +0 -0
  125. data/test/dynelf_test.rb +62 -25
  126. data/test/elf/elf_test.rb +147 -0
  127. data/test/ext_test.rb +4 -2
  128. data/test/files/use_pwn.rb +3 -6
  129. data/test/files/use_pwnlib.rb +2 -1
  130. data/test/full_file_test.rb +6 -0
  131. data/test/logger_test.rb +120 -0
  132. data/test/memleak_test.rb +5 -33
  133. data/test/reg_sort_test.rb +4 -1
  134. data/test/runner_test.rb +32 -0
  135. data/test/shellcraft/infloop_test.rb +27 -0
  136. data/test/shellcraft/linux/cat_test.rb +87 -0
  137. data/test/shellcraft/linux/ls_test.rb +109 -0
  138. data/test/shellcraft/linux/sh_test.rb +120 -0
  139. data/test/shellcraft/linux/sleep_test.rb +68 -0
  140. data/test/shellcraft/linux/syscalls/execve_test.rb +137 -0
  141. data/test/shellcraft/linux/syscalls/exit_test.rb +57 -0
  142. data/test/shellcraft/linux/syscalls/open_test.rb +87 -0
  143. data/test/shellcraft/linux/syscalls/syscall_test.rb +84 -0
  144. data/test/shellcraft/memcpy_test.rb +50 -0
  145. data/test/shellcraft/mov_test.rb +99 -0
  146. data/test/shellcraft/nop_test.rb +27 -0
  147. data/test/shellcraft/popad_test.rb +30 -0
  148. data/test/shellcraft/pushstr_array_test.rb +92 -0
  149. data/test/shellcraft/pushstr_test.rb +109 -0
  150. data/test/shellcraft/registers_test.rb +33 -0
  151. data/test/shellcraft/ret_test.rb +31 -0
  152. data/test/shellcraft/setregs_test.rb +63 -0
  153. data/test/shellcraft/shellcraft_test.rb +30 -0
  154. data/test/test_helper.rb +61 -2
  155. data/test/timer_test.rb +42 -0
  156. data/test/tubes/buffer_test.rb +46 -0
  157. data/test/tubes/process_test.rb +105 -0
  158. data/test/tubes/serialtube_test.rb +162 -0
  159. data/test/tubes/sock_test.rb +68 -0
  160. data/test/tubes/tube_test.rb +320 -0
  161. data/test/ui_test.rb +18 -0
  162. data/test/util/cyclic_test.rb +3 -1
  163. data/test/util/fiddling_test.rb +12 -3
  164. data/test/util/getdents_test.rb +33 -0
  165. data/test/util/hexdump_test.rb +9 -10
  166. data/test/util/lists_test.rb +22 -0
  167. data/test/util/packing_test.rb +5 -3
  168. metadata +357 -37
@@ -0,0 +1,33 @@
1
+ # encoding: ASCII-8BIT
2
+ # frozen_string_literal: true
3
+
4
+ require 'test_helper'
5
+
6
+ require 'pwnlib/context'
7
+ require 'pwnlib/util/getdents'
8
+
9
+ class GetdentsTest < MiniTest::Test
10
+ include ::Pwnlib::Context
11
+ include ::Pwnlib::Util::Getdents
12
+
13
+ def test_parse
14
+ context.local(arch: 'i386') do
15
+ assert_equal("REG README.md\nDIR lib\n",
16
+ parse("\x92\x22\x0e\x01\x8f\x4a\xb3\x41" \
17
+ "\x18\x00\x52\x45\x41\x44\x4d\x45" \
18
+ "\x2e\x6d\x64\x00\x30\x00\x00\x08" \
19
+ "\xb5\x10\x34\x01\xff\xff\xff\x7f" \
20
+ "\x10\x00\x6c\x69\x62\x00\x00\x04"))
21
+ end
22
+ context.local(arch: 'amd64') do
23
+ assert_equal("REG README.md\nDIR lib\n",
24
+ parse("\x92\x22\x0e\x01\x00\x00\x00\x00" \
25
+ "\x3d\xf6\x7c\x45\x8f\x4a\xb3\x41" \
26
+ "\x20\x00\x52\x45\x41\x44\x4d\x45" \
27
+ "\x2e\x6d\x64\x00\x30\x00\x00\x08" \
28
+ "\xb5\x10\x34\x01\x00\x00\x00\x00" \
29
+ "\xff\xff\xff\xff\xff\xff\xff\x7f" \
30
+ "\x18\x00\x6c\x69\x62\x00\x00\x04"))
31
+ end
32
+ end
33
+ end
@@ -1,15 +1,14 @@
1
- require 'rainbow'
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ # This test use UTF-8 encoding for strings since the output for hexdump contains lots of UTF-8 characters.
2
5
 
3
6
  require 'test_helper'
7
+
4
8
  require 'pwnlib/util/hexdump'
5
9
 
6
10
  class HexDumpTest < MiniTest::Test
7
- include ::Pwnlib::Util::HexDump::ClassMethods
8
-
9
- def setup
10
- # Default to disable coloring for easier testing.
11
- Rainbow.enabled = false
12
- end
11
+ include ::Pwnlib::Util::HexDump
13
12
 
14
13
  def assert_lines_equal(s1, s2)
15
14
  s1l = s1.chomp.lines
@@ -151,13 +150,13 @@ class HexDumpTest < MiniTest::Test
151
150
  orig_style = HIGHLIGHT_STYLE
152
151
  begin
153
152
  $VERBOSE = nil
154
- ::Pwnlib::Util::HexDump::ClassMethods.const_set(:HIGHLIGHT_STYLE, ->(s) { "#{s}!" })
153
+ ::Pwnlib::Util::HexDump.const_set(:HIGHLIGHT_STYLE, ->(s) { "#{s}!" })
155
154
  assert_lines_equal(<<-'EOS', hexdump('abcdefghi', highlight: 'aeiou'))
156
155
  00000000 61! 62 63 64 65! 66 67 68 69! │a!bcd│e!fgh│i!│
157
156
  00000009
158
- EOS
157
+ EOS
159
158
  ensure
160
- ::Pwnlib::Util::HexDump::ClassMethods.const_set(:HIGHLIGHT_STYLE, orig_style)
159
+ ::Pwnlib::Util::HexDump.const_set(:HIGHLIGHT_STYLE, orig_style)
161
160
  $VERBOSE = orig_verbose
162
161
  end
163
162
  end
@@ -0,0 +1,22 @@
1
+ # encoding: ASCII-8BIT
2
+ # frozen_string_literal: true
3
+
4
+ require 'test_helper'
5
+
6
+ require 'pwnlib/util/lists'
7
+
8
+ class FiddlingTest < MiniTest::Test
9
+ include ::Pwnlib::Util::Lists
10
+
11
+ def test_slice
12
+ assert_equal(%w(A B C D), slice(1, 'ABCD'))
13
+ assert_equal(%w(AB CD E), slice(2, 'ABCDE'))
14
+ assert_equal(%w(AB CD), slice(2, 'ABCDE', underfull_action: :drop))
15
+ assert_equal(%w(AB CD EX), slice(2, 'ABCDE', underfull_action: :fill, fill_value: 'X'))
16
+ assert_equal(%w(AB CD EF), slice(2, 'ABCDEF', underfull_action: :fill, fill_value: 'X'))
17
+ err = assert_raises(ArgumentError) { slice(2, 'ABCDE', underfull_action: :pusheen) }
18
+ assert_equal('underfull_action expect to be one of :ignore, :drop, and :fill', err.message)
19
+ err = assert_raises(ArgumentError) { slice(2, 'ABCDE', underfull_action: :fill, fill_value: nil) }
20
+ assert_equal('fill_value must be a character', err.message)
21
+ end
22
+ end
@@ -1,10 +1,12 @@
1
1
  # encoding: ASCII-8BIT
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'test_helper'
5
+
4
6
  require 'pwnlib/util/packing'
5
7
 
6
8
  class PackingTest < MiniTest::Test
7
- include ::Pwnlib::Util::Packing::ClassMethods
9
+ include ::Pwnlib::Util::Packing
8
10
 
9
11
  def test_pack
10
12
  assert_equal('ABC',
@@ -115,8 +117,8 @@ class PackingTest < MiniTest::Test
115
117
  def test_up_rand
116
118
  srand(217)
117
119
  [8, 16, 32, 64].each do |sz|
118
- u = ->(*x) { public_send("u#{sz}", *x) }
119
- p = ->(*x) { public_send("p#{sz}", *x) }
120
+ u = ->(*x, **k) { ::Pwnlib::Util::Packing.public_send("u#{sz}", *x, **k) }
121
+ p = ->(*x, **k) { ::Pwnlib::Util::Packing.public_send("p#{sz}", *x, **k) }
120
122
  100.times do
121
123
  limit = (1 << sz)
122
124
  val = rand(0...limit)
metadata CHANGED
@@ -1,58 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwntools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - peter50216@gmail.com
8
8
  - david942j@gmail.com
9
+ - hanhan0912@gmail.com
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2016-03-23 00:00:00.000000000 Z
13
+ date: 2021-03-21 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: rainbow
16
+ name: crabstone
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
19
  - - "~>"
19
20
  - !ruby/object:Gem::Version
20
- version: '2.2'
21
+ version: '4'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '4'
29
+ - !ruby/object:Gem::Dependency
30
+ name: dentaku
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.0.11
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: 3.5.0
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.11
46
+ - - "<"
47
+ - !ruby/object:Gem::Version
48
+ version: 3.5.0
49
+ - !ruby/object:Gem::Dependency
50
+ name: elftools
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.1
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: 1.2.0
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.1
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.2.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: keystone-engine
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.9'
21
76
  type: :runtime
22
77
  prerelease: false
23
78
  version_requirements: !ruby/object:Gem::Requirement
24
79
  requirements:
25
80
  - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: method_source
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: one_gadget
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.6.2
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: 1.8.0
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 1.6.2
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: 1.8.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: rainbow
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
26
122
  - !ruby/object:Gem::Version
27
123
  version: '2.2'
124
+ - - "<"
125
+ - !ruby/object:Gem::Version
126
+ version: '4.0'
127
+ type: :runtime
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '2.2'
134
+ - - "<"
135
+ - !ruby/object:Gem::Version
136
+ version: '4.0'
28
137
  - !ruby/object:Gem::Dependency
29
- name: codeclimate-test-reporter
138
+ name: ruby2ruby
30
139
  requirement: !ruby/object:Gem::Requirement
31
140
  requirements:
32
141
  - - "~>"
33
142
  - !ruby/object:Gem::Version
34
- version: '0.6'
35
- type: :development
143
+ version: '2.4'
144
+ type: :runtime
36
145
  prerelease: false
37
146
  version_requirements: !ruby/object:Gem::Requirement
38
147
  requirements:
39
148
  - - "~>"
40
149
  - !ruby/object:Gem::Version
41
- version: '0.6'
150
+ version: '2.4'
42
151
  - !ruby/object:Gem::Dependency
43
- name: minitest
152
+ name: rubyserial
44
153
  requirement: !ruby/object:Gem::Requirement
45
154
  requirements:
46
155
  - - "~>"
47
156
  - !ruby/object:Gem::Version
48
- version: '5.8'
49
- type: :development
157
+ version: '0.5'
158
+ type: :runtime
50
159
  prerelease: false
51
160
  version_requirements: !ruby/object:Gem::Requirement
52
161
  requirements:
53
162
  - - "~>"
54
163
  - !ruby/object:Gem::Version
55
- version: '5.8'
164
+ version: '0.5'
165
+ - !ruby/object:Gem::Dependency
166
+ name: minitest
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - '='
170
+ - !ruby/object:Gem::Version
171
+ version: 5.10.1
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - '='
177
+ - !ruby/object:Gem::Version
178
+ version: 5.10.1
56
179
  - !ruby/object:Gem::Dependency
57
180
  name: pry
58
181
  requirement: !ruby/object:Gem::Requirement
@@ -73,42 +196,48 @@ dependencies:
73
196
  requirements:
74
197
  - - "~>"
75
198
  - !ruby/object:Gem::Version
76
- version: '12.0'
199
+ version: '13.0'
77
200
  type: :development
78
201
  prerelease: false
79
202
  version_requirements: !ruby/object:Gem::Requirement
80
203
  requirements:
81
204
  - - "~>"
82
205
  - !ruby/object:Gem::Version
83
- version: '12.0'
206
+ version: '13.0'
84
207
  - !ruby/object:Gem::Dependency
85
208
  name: rubocop
86
209
  requirement: !ruby/object:Gem::Requirement
87
210
  requirements:
88
211
  - - "~>"
89
212
  - !ruby/object:Gem::Version
90
- version: '0.46'
213
+ version: '1'
91
214
  type: :development
92
215
  prerelease: false
93
216
  version_requirements: !ruby/object:Gem::Requirement
94
217
  requirements:
95
218
  - - "~>"
96
219
  - !ruby/object:Gem::Version
97
- version: '0.46'
220
+ version: '1'
98
221
  - !ruby/object:Gem::Dependency
99
222
  name: simplecov
100
223
  requirement: !ruby/object:Gem::Requirement
101
224
  requirements:
102
225
  - - "~>"
103
226
  - !ruby/object:Gem::Version
104
- version: '0.12'
227
+ version: '0.15'
228
+ - - "<"
229
+ - !ruby/object:Gem::Version
230
+ version: '0.18'
105
231
  type: :development
106
232
  prerelease: false
107
233
  version_requirements: !ruby/object:Gem::Requirement
108
234
  requirements:
109
235
  - - "~>"
110
236
  - !ruby/object:Gem::Version
111
- version: '0.12'
237
+ version: '0.15'
238
+ - - "<"
239
+ - !ruby/object:Gem::Version
240
+ version: '0.18'
112
241
  - !ruby/object:Gem::Dependency
113
242
  name: tty-platform
114
243
  requirement: !ruby/object:Gem::Requirement
@@ -142,7 +271,10 @@ description: |2
142
271
  Implement useful/easy functions first,
143
272
  try to be of ruby style and don't follow original pwntools everywhere.
144
273
  Would still try to have similar name whenever possible.
145
- email:
274
+ email:
275
+ - peter50216@gmail.com
276
+ - david942j@gmail.com
277
+ - hanhan0912@gmail.com
146
278
  executables: []
147
279
  extensions: []
148
280
  extra_rdoc_files: []
@@ -150,43 +282,173 @@ files:
150
282
  - README.md
151
283
  - Rakefile
152
284
  - lib/pwn.rb
285
+ - lib/pwnlib/abi.rb
286
+ - lib/pwnlib/asm.rb
153
287
  - lib/pwnlib/constants/constant.rb
154
288
  - lib/pwnlib/constants/constants.rb
155
289
  - lib/pwnlib/constants/linux/amd64.rb
156
290
  - lib/pwnlib/constants/linux/i386.rb
157
291
  - lib/pwnlib/context.rb
158
292
  - lib/pwnlib/dynelf.rb
293
+ - lib/pwnlib/elf/elf.rb
294
+ - lib/pwnlib/errors.rb
159
295
  - lib/pwnlib/ext/array.rb
160
296
  - lib/pwnlib/ext/helper.rb
161
297
  - lib/pwnlib/ext/integer.rb
162
298
  - lib/pwnlib/ext/string.rb
299
+ - lib/pwnlib/logger.rb
163
300
  - lib/pwnlib/memleak.rb
164
301
  - lib/pwnlib/pwn.rb
165
302
  - lib/pwnlib/reg_sort.rb
303
+ - lib/pwnlib/runner.rb
304
+ - lib/pwnlib/shellcraft/generators/amd64/common/common.rb
305
+ - lib/pwnlib/shellcraft/generators/amd64/common/infloop.rb
306
+ - lib/pwnlib/shellcraft/generators/amd64/common/memcpy.rb
307
+ - lib/pwnlib/shellcraft/generators/amd64/common/mov.rb
308
+ - lib/pwnlib/shellcraft/generators/amd64/common/nop.rb
309
+ - lib/pwnlib/shellcraft/generators/amd64/common/popad.rb
310
+ - lib/pwnlib/shellcraft/generators/amd64/common/pushstr.rb
311
+ - lib/pwnlib/shellcraft/generators/amd64/common/pushstr_array.rb
312
+ - lib/pwnlib/shellcraft/generators/amd64/common/ret.rb
313
+ - lib/pwnlib/shellcraft/generators/amd64/common/setregs.rb
314
+ - lib/pwnlib/shellcraft/generators/amd64/linux/cat.rb
315
+ - lib/pwnlib/shellcraft/generators/amd64/linux/execve.rb
316
+ - lib/pwnlib/shellcraft/generators/amd64/linux/exit.rb
317
+ - lib/pwnlib/shellcraft/generators/amd64/linux/linux.rb
318
+ - lib/pwnlib/shellcraft/generators/amd64/linux/ls.rb
319
+ - lib/pwnlib/shellcraft/generators/amd64/linux/open.rb
320
+ - lib/pwnlib/shellcraft/generators/amd64/linux/sh.rb
321
+ - lib/pwnlib/shellcraft/generators/amd64/linux/sleep.rb
322
+ - lib/pwnlib/shellcraft/generators/amd64/linux/syscall.rb
323
+ - lib/pwnlib/shellcraft/generators/helper.rb
324
+ - lib/pwnlib/shellcraft/generators/i386/common/common.rb
325
+ - lib/pwnlib/shellcraft/generators/i386/common/infloop.rb
326
+ - lib/pwnlib/shellcraft/generators/i386/common/memcpy.rb
327
+ - lib/pwnlib/shellcraft/generators/i386/common/mov.rb
328
+ - lib/pwnlib/shellcraft/generators/i386/common/nop.rb
329
+ - lib/pwnlib/shellcraft/generators/i386/common/pushstr.rb
330
+ - lib/pwnlib/shellcraft/generators/i386/common/pushstr_array.rb
331
+ - lib/pwnlib/shellcraft/generators/i386/common/setregs.rb
332
+ - lib/pwnlib/shellcraft/generators/i386/linux/cat.rb
333
+ - lib/pwnlib/shellcraft/generators/i386/linux/execve.rb
334
+ - lib/pwnlib/shellcraft/generators/i386/linux/exit.rb
335
+ - lib/pwnlib/shellcraft/generators/i386/linux/linux.rb
336
+ - lib/pwnlib/shellcraft/generators/i386/linux/ls.rb
337
+ - lib/pwnlib/shellcraft/generators/i386/linux/open.rb
338
+ - lib/pwnlib/shellcraft/generators/i386/linux/sh.rb
339
+ - lib/pwnlib/shellcraft/generators/i386/linux/sleep.rb
340
+ - lib/pwnlib/shellcraft/generators/i386/linux/syscall.rb
341
+ - lib/pwnlib/shellcraft/generators/x86/common/common.rb
342
+ - lib/pwnlib/shellcraft/generators/x86/common/infloop.rb
343
+ - lib/pwnlib/shellcraft/generators/x86/common/memcpy.rb
344
+ - lib/pwnlib/shellcraft/generators/x86/common/mov.rb
345
+ - lib/pwnlib/shellcraft/generators/x86/common/pushstr.rb
346
+ - lib/pwnlib/shellcraft/generators/x86/common/pushstr_array.rb
347
+ - lib/pwnlib/shellcraft/generators/x86/common/setregs.rb
348
+ - lib/pwnlib/shellcraft/generators/x86/linux/cat.rb
349
+ - lib/pwnlib/shellcraft/generators/x86/linux/execve.rb
350
+ - lib/pwnlib/shellcraft/generators/x86/linux/exit.rb
351
+ - lib/pwnlib/shellcraft/generators/x86/linux/linux.rb
352
+ - lib/pwnlib/shellcraft/generators/x86/linux/ls.rb
353
+ - lib/pwnlib/shellcraft/generators/x86/linux/open.rb
354
+ - lib/pwnlib/shellcraft/generators/x86/linux/sh.rb
355
+ - lib/pwnlib/shellcraft/generators/x86/linux/sleep.rb
356
+ - lib/pwnlib/shellcraft/generators/x86/linux/syscall.rb
357
+ - lib/pwnlib/shellcraft/registers.rb
358
+ - lib/pwnlib/shellcraft/shellcraft.rb
359
+ - lib/pwnlib/timer.rb
360
+ - lib/pwnlib/tubes/buffer.rb
361
+ - lib/pwnlib/tubes/process.rb
362
+ - lib/pwnlib/tubes/serialtube.rb
363
+ - lib/pwnlib/tubes/sock.rb
364
+ - lib/pwnlib/tubes/tube.rb
365
+ - lib/pwnlib/ui.rb
166
366
  - lib/pwnlib/util/cyclic.rb
167
367
  - lib/pwnlib/util/fiddling.rb
368
+ - lib/pwnlib/util/getdents.rb
168
369
  - lib/pwnlib/util/hexdump.rb
370
+ - lib/pwnlib/util/lists.rb
169
371
  - lib/pwnlib/util/packing.rb
372
+ - lib/pwnlib/util/ruby.rb
170
373
  - lib/pwnlib/version.rb
374
+ - test/abi_test.rb
375
+ - test/asm_test.rb
171
376
  - test/constants/constant_test.rb
172
377
  - test/constants/constants_test.rb
173
378
  - test/context_test.rb
379
+ - test/data/assembly/aarch64.s
380
+ - test/data/assembly/amd64.s
381
+ - test/data/assembly/arm.s
382
+ - test/data/assembly/i386.s
383
+ - test/data/assembly/mips.s
384
+ - test/data/assembly/mips64.s
385
+ - test/data/assembly/powerpc.s
386
+ - test/data/assembly/powerpc64.s
387
+ - test/data/assembly/sparc.s
388
+ - test/data/assembly/sparc64.s
389
+ - test/data/assembly/thumb.s
390
+ - test/data/echo.rb
391
+ - test/data/elfs/Makefile
392
+ - test/data/elfs/amd64.frelro.elf
393
+ - test/data/elfs/amd64.frelro.pie.elf
394
+ - test/data/elfs/amd64.nrelro.elf
395
+ - test/data/elfs/amd64.prelro.elf
396
+ - test/data/elfs/amd64.static.elf
397
+ - test/data/elfs/i386.frelro.pie.elf
398
+ - test/data/elfs/i386.prelro.elf
399
+ - test/data/elfs/source.cpp
400
+ - test/data/flag
401
+ - test/data/lib32/ld.so.2
402
+ - test/data/lib32/libc.so.6
403
+ - test/data/lib64/ld.so.2
404
+ - test/data/lib64/libc.so.6
174
405
  - test/data/victim.c
175
406
  - test/data/victim32
176
407
  - test/data/victim64
177
408
  - test/dynelf_test.rb
409
+ - test/elf/elf_test.rb
178
410
  - test/ext_test.rb
179
411
  - test/files/use_pwn.rb
180
412
  - test/files/use_pwnlib.rb
181
413
  - test/full_file_test.rb
414
+ - test/logger_test.rb
182
415
  - test/memleak_test.rb
183
416
  - test/reg_sort_test.rb
417
+ - test/runner_test.rb
418
+ - test/shellcraft/infloop_test.rb
419
+ - test/shellcraft/linux/cat_test.rb
420
+ - test/shellcraft/linux/ls_test.rb
421
+ - test/shellcraft/linux/sh_test.rb
422
+ - test/shellcraft/linux/sleep_test.rb
423
+ - test/shellcraft/linux/syscalls/execve_test.rb
424
+ - test/shellcraft/linux/syscalls/exit_test.rb
425
+ - test/shellcraft/linux/syscalls/open_test.rb
426
+ - test/shellcraft/linux/syscalls/syscall_test.rb
427
+ - test/shellcraft/memcpy_test.rb
428
+ - test/shellcraft/mov_test.rb
429
+ - test/shellcraft/nop_test.rb
430
+ - test/shellcraft/popad_test.rb
431
+ - test/shellcraft/pushstr_array_test.rb
432
+ - test/shellcraft/pushstr_test.rb
433
+ - test/shellcraft/registers_test.rb
434
+ - test/shellcraft/ret_test.rb
435
+ - test/shellcraft/setregs_test.rb
436
+ - test/shellcraft/shellcraft_test.rb
184
437
  - test/test_helper.rb
438
+ - test/timer_test.rb
439
+ - test/tubes/buffer_test.rb
440
+ - test/tubes/process_test.rb
441
+ - test/tubes/serialtube_test.rb
442
+ - test/tubes/sock_test.rb
443
+ - test/tubes/tube_test.rb
444
+ - test/ui_test.rb
185
445
  - test/util/cyclic_test.rb
186
446
  - test/util/fiddling_test.rb
447
+ - test/util/getdents_test.rb
187
448
  - test/util/hexdump_test.rb
449
+ - test/util/lists_test.rb
188
450
  - test/util/packing_test.rb
189
- homepage:
451
+ homepage: https://github.com/peter50216/pwntools-ruby
190
452
  licenses:
191
453
  - MIT
192
454
  metadata: {}
@@ -198,34 +460,92 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
460
  requirements:
199
461
  - - ">="
200
462
  - !ruby/object:Gem::Version
201
- version: 2.1.0
463
+ version: '2.3'
202
464
  required_rubygems_version: !ruby/object:Gem::Requirement
203
465
  requirements:
204
466
  - - ">="
205
467
  - !ruby/object:Gem::Version
206
468
  version: '0'
207
469
  requirements: []
208
- rubyforge_project:
209
- rubygems_version: 2.5.2
470
+ rubygems_version: 3.1.4
210
471
  signing_key:
211
472
  specification_version: 4
212
473
  summary: pwntools
213
474
  test_files:
214
- - test/files/use_pwn.rb
215
- - test/files/use_pwnlib.rb
216
- - test/dynelf_test.rb
217
- - test/ext_test.rb
475
+ - test/util/cyclic_test.rb
476
+ - test/util/getdents_test.rb
477
+ - test/util/hexdump_test.rb
478
+ - test/util/lists_test.rb
479
+ - test/util/fiddling_test.rb
480
+ - test/util/packing_test.rb
481
+ - test/abi_test.rb
482
+ - test/elf/elf_test.rb
483
+ - test/context_test.rb
484
+ - test/runner_test.rb
485
+ - test/reg_sort_test.rb
218
486
  - test/test_helper.rb
219
- - test/data/victim.c
220
- - test/data/victim64
487
+ - test/shellcraft/popad_test.rb
488
+ - test/shellcraft/mov_test.rb
489
+ - test/shellcraft/registers_test.rb
490
+ - test/shellcraft/nop_test.rb
491
+ - test/shellcraft/shellcraft_test.rb
492
+ - test/shellcraft/ret_test.rb
493
+ - test/shellcraft/memcpy_test.rb
494
+ - test/shellcraft/linux/sleep_test.rb
495
+ - test/shellcraft/linux/cat_test.rb
496
+ - test/shellcraft/linux/syscalls/syscall_test.rb
497
+ - test/shellcraft/linux/syscalls/execve_test.rb
498
+ - test/shellcraft/linux/syscalls/open_test.rb
499
+ - test/shellcraft/linux/syscalls/exit_test.rb
500
+ - test/shellcraft/linux/sh_test.rb
501
+ - test/shellcraft/linux/ls_test.rb
502
+ - test/shellcraft/pushstr_test.rb
503
+ - test/shellcraft/setregs_test.rb
504
+ - test/shellcraft/infloop_test.rb
505
+ - test/shellcraft/pushstr_array_test.rb
506
+ - test/data/lib64/ld.so.2
507
+ - test/data/lib64/libc.so.6
508
+ - test/data/flag
221
509
  - test/data/victim32
222
- - test/reg_sort_test.rb
223
- - test/full_file_test.rb
224
- - test/context_test.rb
225
- - test/constants/constant_test.rb
510
+ - test/data/lib32/ld.so.2
511
+ - test/data/lib32/libc.so.6
512
+ - test/data/elfs/amd64.frelro.elf
513
+ - test/data/elfs/i386.frelro.pie.elf
514
+ - test/data/elfs/amd64.prelro.elf
515
+ - test/data/elfs/source.cpp
516
+ - test/data/elfs/amd64.frelro.pie.elf
517
+ - test/data/elfs/amd64.static.elf
518
+ - test/data/elfs/i386.prelro.elf
519
+ - test/data/elfs/amd64.nrelro.elf
520
+ - test/data/elfs/Makefile
521
+ - test/data/echo.rb
522
+ - test/data/victim64
523
+ - test/data/victim.c
524
+ - test/data/assembly/amd64.s
525
+ - test/data/assembly/sparc64.s
526
+ - test/data/assembly/i386.s
527
+ - test/data/assembly/mips.s
528
+ - test/data/assembly/mips64.s
529
+ - test/data/assembly/powerpc64.s
530
+ - test/data/assembly/arm.s
531
+ - test/data/assembly/sparc.s
532
+ - test/data/assembly/powerpc.s
533
+ - test/data/assembly/aarch64.s
534
+ - test/data/assembly/thumb.s
535
+ - test/asm_test.rb
226
536
  - test/constants/constants_test.rb
537
+ - test/constants/constant_test.rb
538
+ - test/ui_test.rb
227
539
  - test/memleak_test.rb
228
- - test/util/packing_test.rb
229
- - test/util/hexdump_test.rb
230
- - test/util/cyclic_test.rb
231
- - test/util/fiddling_test.rb
540
+ - test/tubes/process_test.rb
541
+ - test/tubes/sock_test.rb
542
+ - test/tubes/buffer_test.rb
543
+ - test/tubes/tube_test.rb
544
+ - test/tubes/serialtube_test.rb
545
+ - test/full_file_test.rb
546
+ - test/logger_test.rb
547
+ - test/dynelf_test.rb
548
+ - test/timer_test.rb
549
+ - test/files/use_pwnlib.rb
550
+ - test/files/use_pwn.rb
551
+ - test/ext_test.rb