ctf-party 3.0.0 → 4.0.0
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/lib/ctf_party/base64.rb +2 -4
- data/lib/ctf_party/cgi.rb +2 -2
- data/lib/ctf_party/defang.rb +0 -11
- data/lib/ctf_party/hex.rb +10 -3
- data/lib/ctf_party/network.rb +4 -4
- data/lib/ctf_party/version.rb +2 -2
- data/lib/ctf_party.rb +1 -0
- metadata +27 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb800f2b8374568f0f0caf62902e9851de280e60f136079486ddb1d80d597a3
|
4
|
+
data.tar.gz: 5202083c9dcfe5d3f917fd1a706d8bfc305d20e004f1857d406f7ef86c3a674f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfd29ec5d68b4904f60eb2331fd22773865aa80e549c366c285bc7ce3a0448a543729ac3ec8df00821942a70eec740d6ee20942939469463cd8cc15036e9793
|
7
|
+
data.tar.gz: b9cce70eaeaa54d167f2e657e5b120a776bb3510b9555916ea42739e1011bb335e493045ebf609a8cc2ca55041fbc93c40b30b930700f219193950f584fc10d4
|
data/lib/ctf_party/base64.rb
CHANGED
@@ -14,8 +14,7 @@ class String
|
|
14
14
|
# 'Super lib!'.to_b64 # => "U3VwZXIgbGliIQ=="
|
15
15
|
def to_b64(opts = {})
|
16
16
|
opts[:mode] ||= :strict
|
17
|
-
return Base64.strict_encode64(self) if opts[:mode]
|
18
|
-
opts[:mode] == :rfc4648
|
17
|
+
return Base64.strict_encode64(self) if %i[strict rfc4648].include?(opts[:mode])
|
19
18
|
return Base64.encode64(self) if opts[:mode] == :rfc2045
|
20
19
|
return Base64.urlsafe_encode64(self) if opts[:mode] == :urlsafe
|
21
20
|
end
|
@@ -40,8 +39,7 @@ class String
|
|
40
39
|
# 'UnVieQ=='.from_b64 # => "Ruby"
|
41
40
|
def from_b64(opts = {})
|
42
41
|
opts[:mode] ||= :strict
|
43
|
-
return Base64.strict_decode64(self) if opts[:mode]
|
44
|
-
opts[:mode] == :rfc4648
|
42
|
+
return Base64.strict_decode64(self) if %i[strict rfc4648].include?(opts[:mode])
|
45
43
|
return Base64.decode64(self) if opts[:mode] == :rfc2045
|
46
44
|
return Base64.urlsafe_decode64(self) if opts[:mode] == :urlsafe
|
47
45
|
end
|
data/lib/ctf_party/cgi.rb
CHANGED
@@ -11,7 +11,7 @@ class String
|
|
11
11
|
# 'http://vulnerable.site/search.aspx?txt="><script>alert(/Rubyfu/.source)</script>'.urlencode # => "http://vulnerable.site/search.aspx?txt=%22%3E%3Cscript%3Ealert(/Rubyfu/.source)%3C/script%3E"
|
12
12
|
# "'Stop!' said Fred".urlencode # => "'Stop!'%20said%20Fred"
|
13
13
|
def urlencode
|
14
|
-
URI::
|
14
|
+
URI::RFC2396_PARSER.escape self
|
15
15
|
end
|
16
16
|
|
17
17
|
# URL-encode the string in place as described for {String#urlencode}.
|
@@ -41,7 +41,7 @@ class String
|
|
41
41
|
# "'Stop!'%20said%20Fred".urldecode # => "'Stop!' said Fred"
|
42
42
|
# '%27Stop%21%27+said+Fred'.urldecode # => "'Stop!'+said+Fred"
|
43
43
|
def urldecode
|
44
|
-
URI::
|
44
|
+
URI::RFC2396_PARSER.unescape self
|
45
45
|
end
|
46
46
|
|
47
47
|
# URL-decode the string in place as described for {String#urldecode}.
|
data/lib/ctf_party/defang.rb
CHANGED
@@ -80,17 +80,6 @@ class String
|
|
80
80
|
puts e
|
81
81
|
return gsub('.', '[.]')
|
82
82
|
end
|
83
|
-
begin
|
84
|
-
# temporary fix until backport for ruby 3.0 https://github.com/ruby/ruby/pull/7260
|
85
|
-
# rubocop:disable Lint/Void
|
86
|
-
URI::WS
|
87
|
-
URI::WSS
|
88
|
-
# rubocop:enable Lint/Void
|
89
|
-
rescue NameError => e
|
90
|
-
puts e
|
91
|
-
require 'uri/ws'
|
92
|
-
require 'uri/wss'
|
93
|
-
end
|
94
83
|
case uri
|
95
84
|
when URI::HTTP, URI::HTTPS, URI::FTP
|
96
85
|
uri.scheme = uri.scheme.gsub(/t/i, 'x')
|
data/lib/ctf_party/hex.rb
CHANGED
@@ -5,18 +5,25 @@ class String
|
|
5
5
|
# @param opts [Hash] optional parameters
|
6
6
|
# @option opts [String] :prefix Prefix of the input. Default value is a void
|
7
7
|
# string. Example of values: `0x`, `\x`, `\\x`.
|
8
|
+
# @option opts [Symbol] :padding Minimum size of the decimal display
|
9
|
+
# (number of characters) for the output. Default is no padding.
|
8
10
|
# @return [String] the decimal encoded string
|
9
11
|
# @example
|
10
12
|
# 'ff'.hex2dec # => "255"
|
11
13
|
# '\xf3'.hex2dec(prefix: '\x') # => "243"
|
12
14
|
# '6e6f72616a'.hex2dec # => "474316169578"
|
13
15
|
# '\\x6e\\x6f\\x72\\x61\\x6a'.hex2dec(prefix: '\\x') # => "474316169578"
|
16
|
+
# '41'.hex2dec(padding: 3) # => "065"
|
14
17
|
def hex2dec(opts = {})
|
15
18
|
opts[:prefix] ||= ''
|
19
|
+
opts[:padding] ||= 0
|
16
20
|
# remove prefix
|
17
21
|
out = gsub(opts[:prefix], '')
|
18
22
|
# convert
|
19
|
-
|
23
|
+
out = out.hex.to_s
|
24
|
+
# padding
|
25
|
+
out = ('0' * (opts[:padding] - out.size)) + out if out.size < opts[:padding]
|
26
|
+
return out
|
20
27
|
end
|
21
28
|
|
22
29
|
# Encode an hexadecimal string to a decimal string in place as described
|
@@ -29,7 +36,7 @@ class String
|
|
29
36
|
replace(hex2dec(opts))
|
30
37
|
end
|
31
38
|
|
32
|
-
# Encode
|
39
|
+
# Encode a decimal string to a hexadecimal string
|
33
40
|
# @param opts [Hash] optional parameters
|
34
41
|
# @option opts [String] :prefix Prefix of the output. Default value is a void
|
35
42
|
# string. Example of values: `0x`, `\x`.
|
@@ -66,7 +73,7 @@ class String
|
|
66
73
|
return opts[:prefix] + out
|
67
74
|
end
|
68
75
|
|
69
|
-
# Encode
|
76
|
+
# Encode a decimal string to a hexadecimal string in place as described
|
70
77
|
# for {String#dec2hex}.
|
71
78
|
# @example
|
72
79
|
# a = '255'
|
data/lib/ctf_party/network.rb
CHANGED
@@ -35,22 +35,22 @@ class String
|
|
35
35
|
ipv4? || ipv6?
|
36
36
|
end
|
37
37
|
|
38
|
-
# Is the string a valid URI?
|
38
|
+
# Is the string a valid (RFC 2396) URI?
|
39
39
|
# @param opts [Hash] optional parameters
|
40
40
|
# @option opts [Symbol] :lax Default value: `false`.
|
41
41
|
# When `lax: false`, only URI matching common protocols (ftp http https ldap ldaps mailto ws wss) are recognized,
|
42
42
|
# but is still a bit lax (eg. `http://` is seen as valid).
|
43
43
|
# When `lax: true`, the parser will accept more types of URI (gopher magnet matrix), but will be very lax and accept
|
44
44
|
# nearly anything including `:`.
|
45
|
-
# @return [Boolean] `true` if the string is a valid URI, `false` else.
|
45
|
+
# @return [Boolean] `true` if the string is a valid (RFC 2396) URI, `false` else.
|
46
46
|
# @example
|
47
47
|
# 'ftp://ftp.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.xz'.uri? # => true
|
48
48
|
# 'a:'.uri? # => false
|
49
49
|
# 'a:'.uri?(lax: true) # => true
|
50
50
|
def uri?(opts = {})
|
51
51
|
opts[:lax] ||= false
|
52
|
-
strict = URI::
|
53
|
-
lax = URI::
|
52
|
+
strict = URI::RFC2396_PARSER.make_regexp(%w[ftp http https ldap ldaps mailto ws wss]).match?(self)
|
53
|
+
lax = URI::RFC2396_PARSER.make_regexp.match?(self)
|
54
54
|
if opts[:lax] == true
|
55
55
|
strict || lax
|
56
56
|
else
|
data/lib/ctf_party/version.rb
CHANGED
data/lib/ctf_party.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ctf-party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre ZANNI
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: base64
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 0.2.0
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 0.2.0
|
13
26
|
- !ruby/object:Gem::Dependency
|
14
27
|
name: docopt
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -28,22 +41,22 @@ dependencies:
|
|
28
41
|
name: uri
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
30
43
|
requirements:
|
31
|
-
- - "
|
44
|
+
- - "~>"
|
32
45
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
34
|
-
- - "
|
46
|
+
version: '1.0'
|
47
|
+
- - ">="
|
35
48
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
49
|
+
version: 1.0.2
|
37
50
|
type: :runtime
|
38
51
|
prerelease: false
|
39
52
|
version_requirements: !ruby/object:Gem::Requirement
|
40
53
|
requirements:
|
41
|
-
- - "
|
54
|
+
- - "~>"
|
42
55
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
44
|
-
- - "
|
56
|
+
version: '1.0'
|
57
|
+
- - ">="
|
45
58
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
59
|
+
version: 1.0.2
|
47
60
|
description: A CLI tool & library to enhance and speed up script/exploit writing for
|
48
61
|
CTF players (or security researchers, bug bounty hunters, pentesters but mostly
|
49
62
|
focused on CTF) by patching the String class to add a short syntax of usual code
|
@@ -86,8 +99,8 @@ metadata:
|
|
86
99
|
documentation_uri: https://noraj.github.io/ctf-party/
|
87
100
|
homepage_uri: https://noraj.github.io/ctf-party/
|
88
101
|
source_code_uri: https://github.com/noraj/ctf-party/
|
102
|
+
funding_uri: https://github.com/sponsors/noraj
|
89
103
|
rubygems_mfa_required: 'true'
|
90
|
-
post_install_message:
|
91
104
|
rdoc_options: []
|
92
105
|
require_paths:
|
93
106
|
- lib
|
@@ -95,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
108
|
requirements:
|
96
109
|
- - ">="
|
97
110
|
- !ruby/object:Gem::Version
|
98
|
-
version: 3.
|
111
|
+
version: 3.1.0
|
99
112
|
- - "<"
|
100
113
|
- !ruby/object:Gem::Version
|
101
114
|
version: '4.0'
|
@@ -105,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
118
|
- !ruby/object:Gem::Version
|
106
119
|
version: '0'
|
107
120
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
121
|
+
rubygems_version: 3.6.2
|
110
122
|
specification_version: 4
|
111
123
|
summary: A CLI tool & library to enhance and speed up script/exploit writing with
|
112
124
|
string conversion/manipulation
|