ctf-party 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +29 -0
  3. data/.yardopts +4 -0
  4. data/.yardopts-dev +6 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +52 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +57 -0
  9. data/Rakefile +11 -0
  10. data/bin/ctf_party_console +7 -0
  11. data/bin/ctf_party_setup +6 -0
  12. data/docs/.nojekyll +0 -0
  13. data/docs/About.md +5 -0
  14. data/docs/CHANGELOG.md +5 -0
  15. data/docs/README.md +52 -0
  16. data/docs/_coverpage.md +10 -0
  17. data/docs/_media/logo.png +0 -0
  18. data/docs/_navbar.md +3 -0
  19. data/docs/_sidebar.md +13 -0
  20. data/docs/index.html +31 -0
  21. data/docs/pages/documentation.md +30 -0
  22. data/docs/pages/install.md +84 -0
  23. data/docs/pages/publishing.md +39 -0
  24. data/docs/pages/quick-start.md +23 -0
  25. data/docs/pages/usage.md +61 -0
  26. data/docs/vendor/docsify.js +1 -0
  27. data/docs/vendor/plugins/emoji.min.js +1 -0
  28. data/docs/vendor/plugins/search.min.js +1 -0
  29. data/docs/vendor/prismjs/components/prism-ruby.min.js +1 -0
  30. data/docs/vendor/themes/vue.css +1 -0
  31. data/docs/yard/String.html +2909 -0
  32. data/docs/yard/Version.html +121 -0
  33. data/docs/yard/_index.html +123 -0
  34. data/docs/yard/class_list.html +51 -0
  35. data/docs/yard/css/common.css +1 -0
  36. data/docs/yard/css/full_list.css +58 -0
  37. data/docs/yard/css/style.css +496 -0
  38. data/docs/yard/file.LICENSE.html +70 -0
  39. data/docs/yard/file.README.html +124 -0
  40. data/docs/yard/file_list.html +61 -0
  41. data/docs/yard/frames.html +17 -0
  42. data/docs/yard/index.html +124 -0
  43. data/docs/yard/js/app.js +303 -0
  44. data/docs/yard/js/full_list.js +216 -0
  45. data/docs/yard/js/jquery.js +4 -0
  46. data/docs/yard/method_list.html +275 -0
  47. data/docs/yard/top-level-namespace.html +112 -0
  48. data/lib/ctf_party.rb +7 -0
  49. data/lib/ctf_party/base64.rb +99 -0
  50. data/lib/ctf_party/digest.rb +115 -0
  51. data/lib/ctf_party/flag.rb +94 -0
  52. data/lib/ctf_party/rot.rb +47 -0
  53. data/lib/ctf_party/version.rb +5 -0
  54. data/test/test_string.rb +134 -0
  55. metadata +218 -0
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Version
4
+ VERSION = '1.0.0'
5
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: false
2
+
3
+ require 'minitest/autorun'
4
+ require 'ctf_party'
5
+
6
+ class CTFPartyTest < Minitest::Test
7
+ # base64 tests currently doesn't check options
8
+ def test_base64_to_b64
9
+ assert_equal('U3VwZXIgbGliIQ==', 'Super lib!'.to_b64)
10
+ end
11
+
12
+ def test_base64_to_b64!
13
+ my_str = 'Ruby'
14
+ my_str.to_b64!
15
+ assert_equal('UnVieQ==', my_str)
16
+ end
17
+
18
+ def test_base64_from_b64
19
+ assert_equal('Ruby', 'UnVieQ=='.from_b64)
20
+ end
21
+
22
+ def test_base64_from_b64!
23
+ a = 'SGVsbG8gd29ybGQh'
24
+ a.from_b64!
25
+ assert_equal('Hello world!', a)
26
+ end
27
+
28
+ def test_base64_b64?
29
+ assert('SGVsbG8gd29ybGQh'.b64?)
30
+ refute('SGVsbG8g@@d29ybGQh'.b64?)
31
+ end
32
+
33
+ def test_digest_md5
34
+ assert_equal('556cc23863fef20fab5c456db166bc6e', 'noraj'.md5)
35
+ end
36
+
37
+ def test_digest_md5!
38
+ a = '\o/'
39
+ a.md5!
40
+ assert_equal('881419964e480e66162da521ccc25ebf', a)
41
+ end
42
+
43
+ def test_digest_sha1
44
+ assert_equal('5a64f3bc491d0977e1e3578a48c65a89a16a5fe8', 'ctf-party'.sha1)
45
+ end
46
+
47
+ def test_digest_sha1!
48
+ bob = 'alice'
49
+ bob.sha1!
50
+ assert_equal('522b276a356bdf39013dfabea2cd43e141ecc9e8', bob)
51
+ end
52
+
53
+ def test_digest_sha2
54
+ assert_equal('5321ff2d4b1389b3a350dfe8ca77e3889dc6259bb233adfd069f0f6c474ba128', 'try harder'.sha2)
55
+ end
56
+
57
+ def test_digest_sha2!
58
+ th = 'try harder'
59
+ th.sha2!(bitlen: 384)
60
+ assert_equal('bb7f60b9562a19c3a83c23791440af11591c42ede9988334cdfd7efa4261a3d493d594d08aae5c3b63c7680297ea8f16', th)
61
+ end
62
+
63
+ def test_digest_sha2_256
64
+ assert_equal(''.sha2, ''.sha2_256)
65
+ end
66
+
67
+ def test_digest_sha2_256!
68
+ # skip
69
+ end
70
+
71
+ def test_digest_sha2_384
72
+ assert_equal(''.sha2(bitlen: 384), ''.sha2_384)
73
+ end
74
+
75
+ def test_digest_sha2_384!
76
+ # skip
77
+ end
78
+
79
+ def test_digest_sha2_512
80
+ assert_equal(''.sha2(bitlen: 512), ''.sha2_512)
81
+ end
82
+
83
+ def test_digest_sha2_512!
84
+ # skip
85
+ end
86
+
87
+ def test_digest_rmd160
88
+ assert_equal('3c6255c112d409dafdb84d5b0edba98dfd27b44f', 'payload'.rmd160)
89
+ end
90
+
91
+ def test_digest_rmd160!
92
+ pl = 'payload'
93
+ pl.rmd160!
94
+ assert_equal('3c6255c112d409dafdb84d5b0edba98dfd27b44f', pl)
95
+ end
96
+
97
+ def test_flag_flag
98
+ hash = { prefix: 'sigsegv', suffix: '', enclosing: ['{', '}'], digest: 'md5' }
99
+ String.flag = hash
100
+ assert_equal(hash, String.flag)
101
+ assert_equal('sigsegv{a5bec9e2a86b6b70d288451eb38dfec8}', 'this_1s_a_fl4g'.flag)
102
+ end
103
+
104
+ def test_flag_flag?
105
+ String.flag = { prefix: 'flag', suffix: '', enclosing: ['{', '}'], digest: nil }
106
+ flag = 'Brav0!'
107
+ flag.flag!
108
+ assert_equal('flag{Brav0!}', flag)
109
+ assert(flag.flag?)
110
+ flag = 'ctf{Brav0!}'
111
+ refute(flag.flag?)
112
+ end
113
+
114
+ def test_rot_rot
115
+ assert_equal('Uryyb jbeyq!', 'Hello world!'.rot)
116
+ assert_equal('Spwwz hzcwo!', 'Hello world!'.rot(shift: 11))
117
+ assert_equal('Hello world!', 'Uryyb jbeyq!'.rot)
118
+ assert_equal('Hello world!', 'Spwwz hzcwo!'.rot(shift: 26 - 11))
119
+ end
120
+
121
+ def test_rot_rot!
122
+ a = 'Bonjour le monde !'
123
+ a.rot!
124
+ assert_equal('Obawbhe yr zbaqr !', a)
125
+ end
126
+
127
+ def test_rot_rot13
128
+ assert_equal('Ab'.rot, 'Ab'.rot13)
129
+ end
130
+
131
+ def test_rot_rot13!
132
+ # skip
133
+ end
134
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ctf-party
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexandre ZANNI
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: commonmarker
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.20'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.20'
41
+ - !ruby/object:Gem::Dependency
42
+ name: github-markup
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.11'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '12.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '12.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: redcarpet
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.63'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.63'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.9'
125
+ description: A library to enhance and speed up script/exploit writtingfor CTF players
126
+ (or security researchers, bug bountyhunters, pentesters but mostly focused on CTF)
127
+ bypatching the String class to add a short syntax of usual code patterns.
128
+ email: alexandre.zanni@engineer.com
129
+ executables:
130
+ - ctf_party_console
131
+ - ctf_party_setup
132
+ extensions: []
133
+ extra_rdoc_files: []
134
+ files:
135
+ - ".rubocop.yml"
136
+ - ".yardopts"
137
+ - ".yardopts-dev"
138
+ - Gemfile
139
+ - Gemfile.lock
140
+ - LICENSE.txt
141
+ - README.md
142
+ - Rakefile
143
+ - bin/ctf_party_console
144
+ - bin/ctf_party_setup
145
+ - docs/.nojekyll
146
+ - docs/About.md
147
+ - docs/CHANGELOG.md
148
+ - docs/README.md
149
+ - docs/_coverpage.md
150
+ - docs/_media/logo.png
151
+ - docs/_navbar.md
152
+ - docs/_sidebar.md
153
+ - docs/index.html
154
+ - docs/pages/documentation.md
155
+ - docs/pages/install.md
156
+ - docs/pages/publishing.md
157
+ - docs/pages/quick-start.md
158
+ - docs/pages/usage.md
159
+ - docs/vendor/docsify.js
160
+ - docs/vendor/plugins/emoji.min.js
161
+ - docs/vendor/plugins/search.min.js
162
+ - docs/vendor/prismjs/components/prism-ruby.min.js
163
+ - docs/vendor/themes/vue.css
164
+ - docs/yard/String.html
165
+ - docs/yard/Version.html
166
+ - docs/yard/_index.html
167
+ - docs/yard/class_list.html
168
+ - docs/yard/css/common.css
169
+ - docs/yard/css/full_list.css
170
+ - docs/yard/css/style.css
171
+ - docs/yard/file.LICENSE.html
172
+ - docs/yard/file.README.html
173
+ - docs/yard/file_list.html
174
+ - docs/yard/frames.html
175
+ - docs/yard/index.html
176
+ - docs/yard/js/app.js
177
+ - docs/yard/js/full_list.js
178
+ - docs/yard/js/jquery.js
179
+ - docs/yard/method_list.html
180
+ - docs/yard/top-level-namespace.html
181
+ - lib/ctf_party.rb
182
+ - lib/ctf_party/base64.rb
183
+ - lib/ctf_party/digest.rb
184
+ - lib/ctf_party/flag.rb
185
+ - lib/ctf_party/rot.rb
186
+ - lib/ctf_party/version.rb
187
+ - test/test_string.rb
188
+ homepage: https://orange-cyberdefense.github.io/ctf-party/
189
+ licenses:
190
+ - MIT
191
+ metadata:
192
+ yard.run: yard
193
+ bug_tracker_uri: https://github.com/Orange-Cyberdefense/ctf-party/issues
194
+ changelog_uri: https://github.com/Orange-Cyberdefense/ctf-party/blob/master/docs/CHANGELOG.md
195
+ documentation_uri: https://orange-cyberdefense.github.io/ctf-party/
196
+ homepage_uri: https://orange-cyberdefense.github.io/ctf-party/
197
+ source_code_uri: https://github.com/Orange-Cyberdefense/ctf-party/
198
+ post_install_message:
199
+ rdoc_options: []
200
+ require_paths:
201
+ - lib
202
+ required_ruby_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - "~>"
205
+ - !ruby/object:Gem::Version
206
+ version: '2.4'
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ requirements: []
213
+ rubygems_version: 3.0.1
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: A library to enhance and speed up script/exploit writting for CTF players
217
+ test_files:
218
+ - test/test_string.rb