ctf-party 3.0.0 → 5.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/LICENSE.txt +1 -1
- data/bin/ctf-party +2 -2
- 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 +38 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9413ed422b3e1da59bf459e2156421fae2025ec2ee516693ae64ccc0900f959
|
|
4
|
+
data.tar.gz: d02a82b63761515a32ac2bc8f026752bee898f2e3b0e270247cf46cd310c8b3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed6080f4edaf43af64aa5460cffa7992cec4e1e17b9bbc86b9c394fdacc6c6cd67fbcd4479c946e4211e68ffd863ee8cdd2c4e04073b0e07ed1365ffaa9031f8
|
|
7
|
+
data.tar.gz: 00f281a6dd25cb97807bc091838d516da2bafd2f190aac318a8e7fdf7a4f5a2fdda38b429eac086ad141aab442cf16bcb53724a961a7297119e40a5d5082b5a1
|
data/LICENSE.txt
CHANGED
data/bin/ctf-party
CHANGED
|
@@ -90,7 +90,7 @@ cmd_whitelist = {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
doc = <<~DOCOPT
|
|
93
|
-
ctf-party v#{
|
|
93
|
+
ctf-party v#{CTFParty::VERSION} by noraj
|
|
94
94
|
|
|
95
95
|
Usage:
|
|
96
96
|
ctf-party <string> <cmd>... [--row --file] [--debug]
|
|
@@ -120,7 +120,7 @@ doc = <<~DOCOPT
|
|
|
120
120
|
DOCOPT
|
|
121
121
|
|
|
122
122
|
begin
|
|
123
|
-
args = Docopt.docopt(doc, version:
|
|
123
|
+
args = Docopt.docopt(doc, version: CTFParty::VERSION)
|
|
124
124
|
# use case 1, using the tool
|
|
125
125
|
puts args if args['--debug']
|
|
126
126
|
if args['<string>']
|
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,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ctf-party
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.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: 1980-01-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
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: cgi
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.4'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.4'
|
|
13
40
|
- !ruby/object:Gem::Dependency
|
|
14
41
|
name: docopt
|
|
15
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -28,22 +55,16 @@ dependencies:
|
|
|
28
55
|
name: uri
|
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
|
30
57
|
requirements:
|
|
31
|
-
- - "
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.12.1
|
|
34
|
-
- - "<"
|
|
58
|
+
- - "~>"
|
|
35
59
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
60
|
+
version: '1.1'
|
|
37
61
|
type: :runtime
|
|
38
62
|
prerelease: false
|
|
39
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
64
|
requirements:
|
|
41
|
-
- - "
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.12.1
|
|
44
|
-
- - "<"
|
|
65
|
+
- - "~>"
|
|
45
66
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
67
|
+
version: '1.1'
|
|
47
68
|
description: A CLI tool & library to enhance and speed up script/exploit writing for
|
|
48
69
|
CTF players (or security researchers, bug bounty hunters, pentesters but mostly
|
|
49
70
|
focused on CTF) by patching the String class to add a short syntax of usual code
|
|
@@ -86,8 +107,8 @@ metadata:
|
|
|
86
107
|
documentation_uri: https://noraj.github.io/ctf-party/
|
|
87
108
|
homepage_uri: https://noraj.github.io/ctf-party/
|
|
88
109
|
source_code_uri: https://github.com/noraj/ctf-party/
|
|
110
|
+
funding_uri: https://github.com/sponsors/noraj
|
|
89
111
|
rubygems_mfa_required: 'true'
|
|
90
|
-
post_install_message:
|
|
91
112
|
rdoc_options: []
|
|
92
113
|
require_paths:
|
|
93
114
|
- lib
|
|
@@ -95,18 +116,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
95
116
|
requirements:
|
|
96
117
|
- - ">="
|
|
97
118
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: 3.
|
|
119
|
+
version: 3.2.0
|
|
99
120
|
- - "<"
|
|
100
121
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '
|
|
122
|
+
version: '5.0'
|
|
102
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
124
|
requirements:
|
|
104
125
|
- - ">="
|
|
105
126
|
- !ruby/object:Gem::Version
|
|
106
127
|
version: '0'
|
|
107
128
|
requirements: []
|
|
108
|
-
rubygems_version:
|
|
109
|
-
signing_key:
|
|
129
|
+
rubygems_version: 4.0.3
|
|
110
130
|
specification_version: 4
|
|
111
131
|
summary: A CLI tool & library to enhance and speed up script/exploit writing with
|
|
112
132
|
string conversion/manipulation
|