bin/ctf-party in ctf-party-2.3.0 vs bin/ctf-party in ctf-party-3.0.0
- old
+ new
@@ -10,23 +10,27 @@
require 'docopt'
cmd_whitelist = {
# ctf-party commands
alternatecase: 'Change one characte on two upcase and the other downcase',
+ bin2dec: 'Convert a binary string to decimal',
bin2hex: 'Encode an binary string to a hexadecimal string',
bin2str: 'Alias for from_bin',
+ dec2bin: 'Convert a decimal string to binary',
dec2hex: 'Encode an decimal string to a hexadecimal string',
dec2str: 'Alias for from_dec',
defang_domain: 'Defang domain name',
defang_email: 'Defang email address',
defang_ip: 'Defang IP address',
defang_uri: 'Defang URI',
from_b64: 'Decode the string from base64',
from_bin: 'Decode a binary string',
from_dec: 'Decode a decimal string (decimal to hexadecimal then hexadecimal to string)',
from_hex: 'Decode a hexadecimal string',
- from_hexip: 'Decode a hexadecimal IP string into a dotted decimal one',
+ from_hexip: 'Decode a hexadecimal IPv4 string into a dotted decimal one',
+ from_hexipv4: 'Decode a hexadecimal IPv4 string into a dotted decimal one',
+ from_hexipv6: 'Decode a hexadecimal IPv6 string into a the double-dotted hexadecimal format',
hex2bin: 'Encode an hexadecimal string to a binary string',
hex2dec: 'Encode an hexadecimal string to a decimal string',
hex2str: 'Alias for from_hex',
htmlescape: 'HTML escape the string',
htmlunescape: 'HTML unescape the string',
@@ -50,38 +54,41 @@
str2hex: 'Alias for to_hex',
to_b64: 'Encode the string into base64',
to_bin: 'Encode a string into binary',
to_dec: 'Encode a string into decimal (string to hexadecimal then hexadecimal to decimal)',
to_hex: 'Encode a string into hexadecimal',
- to_hexip: 'Encode a dotted decimal IP into a hexadecimal one',
- urldecode: 'URL-decode the string',
- urldecode_component: 'URL-decode the URL component string',
- urlencode: 'URL-encode the string',
- urlencode_component: 'URL-encode the URL component string',
+ to_hexip: 'Encode a dotted decimal IPv4 into a hexadecimal one',
+ to_hexipv4: 'Encode a dotted decimal IPv4 into a hexadecimal one',
+ urldecode: 'URL-decode the string (RFC 2396)',
+ urldecode_component: 'URL-decode the URL component string (RFC 3986)',
+ urldecode_data: 'URL-decode the form data (application/x-www-form-urlencoded) string',
+ urlencode: 'URL-encode the string (RFC 2396)',
+ urlencode_component: 'URL-encode the URL component string (RFC 3986)',
+ urlencode_data: 'URL-encode form data (application/x-www-form-urlencoded) string',
# native string commands
- bytesize: 'https://rubyapi.org/3.1/o/string#method-i-bytesize',
- capitalize: 'https://rubyapi.org/3.1/o/string#method-i-capitalize',
- chomp: 'https://rubyapi.org/3.1/o/string#method-i-chomp',
- chop: 'https://rubyapi.org/3.1/o/string#method-i-chop',
- downcase: 'https://rubyapi.org/3.1/o/string#method-i-downcase',
- dump: 'https://rubyapi.org/3.1/o/string#method-i-dump',
- hex: 'https://rubyapi.org/3.1/o/string#method-i-hex',
- inspect: 'https://rubyapi.org/3.1/o/string#method-i-inspect',
- length: 'https://rubyapi.org/3.1/o/string#method-i-length',
- lstrip: 'https://rubyapi.org/3.1/o/string#method-i-lstrip',
- reverse: 'https://rubyapi.org/3.1/o/string#method-i-reverse',
- rstrip: 'https://rubyapi.org/3.1/o/string#method-i-rstrip',
- scrub: 'https://rubyapi.org/3.1/o/string#method-i-scrub',
- shellescape: 'https://rubyapi.org/3.1/o/string#method-i-shellescape',
- size: 'https://rubyapi.org/3.1/o/string#method-i-size',
- squeeze: 'https://rubyapi.org/3.1/o/string#method-i-squeeze',
- strip: 'https://rubyapi.org/3.1/o/string#method-i-strip',
- succ: 'https://rubyapi.org/3.1/o/string#method-i-succ',
- swapcase: 'https://rubyapi.org/3.1/o/string#method-i-swapcase',
- undump: 'https://rubyapi.org/3.1/o/string#method-i-undump',
- unicode_normalize: 'https://rubyapi.org/3.1/o/string#method-i-unicode_normalize',
- upcase: 'https://rubyapi.org/3.1/o/string#method-i-upcase'
+ bytesize: 'https://rubyapi.org/3.2/o/string#method-i-bytesize',
+ capitalize: 'https://rubyapi.org/3.2/o/string#method-i-capitalize',
+ chomp: 'https://rubyapi.org/3.2/o/string#method-i-chomp',
+ chop: 'https://rubyapi.org/3.2/o/string#method-i-chop',
+ downcase: 'https://rubyapi.org/3.2/o/string#method-i-downcase',
+ dump: 'https://rubyapi.org/3.2/o/string#method-i-dump',
+ hex: 'https://rubyapi.org/3.2/o/string#method-i-hex',
+ inspect: 'https://rubyapi.org/3.2/o/string#method-i-inspect',
+ length: 'https://rubyapi.org/3.2/o/string#method-i-length',
+ lstrip: 'https://rubyapi.org/3.2/o/string#method-i-lstrip',
+ reverse: 'https://rubyapi.org/3.2/o/string#method-i-reverse',
+ rstrip: 'https://rubyapi.org/3.2/o/string#method-i-rstrip',
+ scrub: 'https://rubyapi.org/3.2/o/string#method-i-scrub',
+ shellescape: 'https://rubyapi.org/3.2/o/string#method-i-shellescape',
+ size: 'https://rubyapi.org/3.2/o/string#method-i-size',
+ squeeze: 'https://rubyapi.org/3.2/o/string#method-i-squeeze',
+ strip: 'https://rubyapi.org/3.2/o/string#method-i-strip',
+ succ: 'https://rubyapi.org/3.2/o/string#method-i-succ',
+ swapcase: 'https://rubyapi.org/3.2/o/string#method-i-swapcase',
+ undump: 'https://rubyapi.org/3.2/o/string#method-i-undump',
+ unicode_normalize: 'https://rubyapi.org/3.2/o/string#method-i-unicode_normalize',
+ upcase: 'https://rubyapi.org/3.2/o/string#method-i-upcase'
}
doc = <<~DOCOPT
ctf-party v#{Version::VERSION} by noraj
@@ -113,10 +120,10 @@
DOCOPT
begin
args = Docopt.docopt(doc, version: Version::VERSION)
# use case 1, using the tool
- pp args if args['--debug']
+ puts args if args['--debug']
if args['<string>']
args['<string>'] = $stdin.read.chomp if args['<string>'] == '-'
args['<string>'] = File.read(args['<string>']) if args['--file'] && File.exist?(args['<string>'])
wrong_cmd = args['<cmd>'] - cmd_whitelist.keys.map(&:to_s)
if wrong_cmd.empty?