ctf-party 1.3.1 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1bc032bfe7236e135eccd26e75a67d6b178b2486b1610741017d61e6cd78c16
4
- data.tar.gz: 40ec92a25213dc22154190cf2e726ad87ce693e9f2e283c7b544c1e378634869
3
+ metadata.gz: 43e5c5fba11ab29415687644876bc3185a7b220adcc0da51bf36bac65b970600
4
+ data.tar.gz: 6dc55b3100a380a0ff2c11e61eda9f67fd7a7a1ae5fc9effae3bae870cf701df
5
5
  SHA512:
6
- metadata.gz: 6d2fb3942843aafde1c157ec4ee598cdfdb9970a178f66fb291964d3f5e867838c94683068ab4a8e6bc02318e3e56336f3832315f7e0a8e01581649354cd7840
7
- data.tar.gz: 91709a253527bec78f79cb45c5bf0611f09262dc0c25beacb0a153c534f4f4042e18977a3c020f961c7786551017a056b423114f72ee2ba7a794c09d8f5378ed
6
+ metadata.gz: 36b8f7a716e66fcfb1aed39b71f586d5ad73e9c099a11651c7dfd29093e09f60b15e278036f7e4e7d74150ceca1c374308864634f8f58b8e4078ca261f60a389
7
+ data.tar.gz: 17618c1a863ed02b9f838bae87e2135e108d50350658c639494d9d9d2a7751319720a022f801a10a79a0bf0a03417d5262d043c137313d7a004dd08a81b5ab61
@@ -7,3 +7,4 @@ require 'ctf_party/digest'
7
7
  require 'ctf_party/flag'
8
8
  require 'ctf_party/hex'
9
9
  require 'ctf_party/case'
10
+ require 'ctf_party/cgi'
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Ruby standard library
4
+ require 'cgi'
5
+
6
+ class String
7
+ # URL-encode the string
8
+ # @return [String] the URL-encoded string
9
+ # @example
10
+ # "'Stop!' said Fred".urlencode # => "%27Stop%21%27+said+Fred"
11
+ def urlencode
12
+ CGI.escape self
13
+ end
14
+
15
+ # URL-encode the string in place as described for {String#urlencode}.
16
+ def urlencode!
17
+ replace(urlencode)
18
+ end
19
+
20
+ # URL-decode the string
21
+ # @return [String] the URL-decoded string
22
+ # @example
23
+ # "%27Stop%21%27+said+Fred".urldecode # => "'Stop!' said Fred"
24
+ def urldecode
25
+ CGI.unescape self
26
+ end
27
+
28
+ # URL-decode the string in place as described for {String#urldecode}.
29
+ def urldecode!
30
+ replace(urldecode)
31
+ end
32
+
33
+ # HTML escape the string
34
+ # @return [String] the HTML escaped string
35
+ # @example
36
+ # 'Usage: foo "bar" <baz>'.htmlescape # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
37
+ def htmlescape
38
+ CGI.escapeHTML self
39
+ end
40
+
41
+ # HTML escape the string in place as described for {String#htmlescape}.
42
+ def htmlescape!
43
+ replace(htmlescape)
44
+ end
45
+
46
+ # HTML unescape the string
47
+ # @return [String] the HTML unescaped string
48
+ # @example
49
+ # "Usage: foo &quot;bar&quot; &lt;baz&gt;".htmlunescape # => "Usage: foo \"bar\" <baz>"
50
+ def htmlunescape
51
+ CGI.unescapeHTML self
52
+ end
53
+
54
+ # HTML unescape the string in place as described for {String#htmlunescape}.
55
+ def htmlunescape!
56
+ replace(htmlunescape)
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '1.3.1'
4
+ VERSION = '1.3.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctf-party
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
@@ -136,6 +136,7 @@ files:
136
136
  - lib/ctf_party.rb
137
137
  - lib/ctf_party/base64.rb
138
138
  - lib/ctf_party/case.rb
139
+ - lib/ctf_party/cgi.rb
139
140
  - lib/ctf_party/digest.rb
140
141
  - lib/ctf_party/flag.rb
141
142
  - lib/ctf_party/hex.rb