ronin 2.0.0 → 2.0.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 +4 -4
- data/.github/workflows/ruby.yml +14 -0
- data/.rubocop.yml +21 -0
- data/ChangeLog.md +35 -2
- data/Gemfile +20 -16
- data/README.md +42 -23
- data/Rakefile +2 -2
- data/bin/ronin +6 -7
- data/data/new/project/Gemfile.erb +9 -9
- data/gemspec.yml +7 -7
- data/lib/ronin/cli/char_set_options.rb +1 -1
- data/lib/ronin/cli/cipher_command.rb +3 -1
- data/lib/ronin/cli/command.rb +3 -0
- data/lib/ronin/cli/commands/asn.rb +1 -1
- data/lib/ronin/cli/commands/banner_grab.rb +5 -3
- data/lib/ronin/cli/commands/cert_dump.rb +4 -7
- data/lib/ronin/cli/commands/cert_gen.rb +4 -4
- data/lib/ronin/cli/commands/cert_grab.rb +5 -6
- data/lib/ronin/cli/commands/decode.rb +14 -14
- data/lib/ronin/cli/commands/dns.rb +2 -2
- data/lib/ronin/cli/commands/encode.rb +14 -14
- data/lib/ronin/cli/commands/extract.rb +1 -1
- data/lib/ronin/cli/commands/grep.rb +7 -5
- data/lib/ronin/cli/commands/hexdump.rb +54 -22
- data/lib/ronin/cli/commands/hmac.rb +1 -1
- data/lib/ronin/cli/commands/host.rb +15 -15
- data/lib/ronin/cli/commands/http.rb +42 -25
- data/lib/ronin/cli/commands/ip.rb +5 -3
- data/lib/ronin/cli/commands/iprange.rb +2 -2
- data/lib/ronin/cli/commands/netcat.rb +32 -38
- data/lib/ronin/cli/commands/new/project.rb +19 -19
- data/lib/ronin/cli/commands/new/script.rb +12 -12
- data/lib/ronin/cli/commands/proxy.rb +37 -41
- data/lib/ronin/cli/commands/rot.rb +11 -10
- data/lib/ronin/cli/commands/strings.rb +1 -1
- data/lib/ronin/cli/commands/unhexdump.rb +1 -1
- data/lib/ronin/cli/dns.rb +3 -0
- data/lib/ronin/cli/file_processor_command.rb +3 -0
- data/lib/ronin/cli/host_and_port.rb +58 -0
- data/lib/ronin/cli/http_shell.rb +19 -16
- data/lib/ronin/cli/key_options.rb +3 -5
- data/lib/ronin/cli/method_options.rb +0 -2
- data/lib/ronin/cli/pattern_options.rb +5 -6
- data/lib/ronin/cli/printing/syntax_highlighting.rb +3 -0
- data/lib/ronin/cli/typo_options.rb +1 -1
- data/lib/ronin/cli/value_processor_command.rb +1 -1
- data/lib/ronin/config.rb +3 -3
- data/lib/ronin/version.rb +2 -2
- data/man/ronin-asn.1 +11 -1
- data/man/ronin-asn.1.md +9 -1
- data/man/ronin-banner-grab.1 +1 -1
- data/man/ronin-banner-grab.1.md +1 -1
- data/man/ronin-bitflip.1 +1 -1
- data/man/ronin-bitflip.1.md +1 -1
- data/man/ronin-cert-dump.1 +1 -1
- data/man/ronin-cert-dump.1.md +1 -1
- data/man/ronin-cert-gen.1 +16 -7
- data/man/ronin-cert-gen.1.md +11 -5
- data/man/ronin-cert-grab.1 +1 -1
- data/man/ronin-cert-grab.1.md +1 -1
- data/man/ronin-decode.1 +1 -1
- data/man/ronin-decode.1.md +1 -1
- data/man/ronin-decrypt.1 +31 -1
- data/man/ronin-decrypt.1.md +19 -1
- data/man/ronin-dns.1 +2 -2
- data/man/ronin-dns.1.md +2 -2
- data/man/ronin-email-addr.1 +3 -3
- data/man/ronin-email-addr.1.md +3 -3
- data/man/ronin-encode.1 +1 -1
- data/man/ronin-encode.1.md +1 -1
- data/man/ronin-encrypt.1 +31 -1
- data/man/ronin-encrypt.1.md +19 -1
- data/man/ronin-entropy.1 +1 -1
- data/man/ronin-entropy.1.md +1 -1
- data/man/ronin-escape.1 +2 -2
- data/man/ronin-escape.1.md +2 -2
- data/man/ronin-extract.1 +1 -1
- data/man/ronin-extract.1.md +1 -1
- data/man/ronin-grep.1 +1 -1
- data/man/ronin-grep.1.md +1 -1
- data/man/ronin-help.1 +1 -1
- data/man/ronin-help.1.md +1 -1
- data/man/ronin-hexdump.1 +2 -2
- data/man/ronin-hexdump.1.md +2 -2
- data/man/ronin-highlight.1 +1 -1
- data/man/ronin-highlight.1.md +1 -1
- data/man/ronin-hmac.1 +1 -1
- data/man/ronin-hmac.1.md +1 -1
- data/man/ronin-homoglyph.1 +1 -1
- data/man/ronin-homoglyph.1.md +1 -1
- data/man/ronin-host.1 +3 -3
- data/man/ronin-host.1.md +3 -3
- data/man/ronin-http.1 +1 -1
- data/man/ronin-http.1.md +1 -1
- data/man/ronin-ip.1 +1 -1
- data/man/ronin-ip.1.md +1 -1
- data/man/ronin-iprange.1 +1 -1
- data/man/ronin-iprange.1.md +1 -1
- data/man/ronin-irb.1 +1 -1
- data/man/ronin-irb.1.md +1 -1
- data/man/ronin-md5.1 +1 -1
- data/man/ronin-md5.1.md +1 -1
- data/man/ronin-netcat.1 +1 -1
- data/man/ronin-netcat.1.md +1 -1
- data/man/ronin-new-project.1 +1 -1
- data/man/ronin-new-project.1.md +1 -1
- data/man/ronin-new-script.1 +1 -1
- data/man/ronin-new-script.1.md +1 -1
- data/man/ronin-new.1 +1 -1
- data/man/ronin-new.1.md +1 -1
- data/man/ronin-proxy.1 +2 -2
- data/man/ronin-proxy.1.md +2 -2
- data/man/ronin-public-suffix-list.1 +11 -1
- data/man/ronin-public-suffix-list.1.md +9 -1
- data/man/ronin-quote.1 +2 -2
- data/man/ronin-quote.1.md +2 -2
- data/man/ronin-rot.1 +20 -3
- data/man/ronin-rot.1.md +14 -3
- data/man/ronin-sha1.1 +1 -1
- data/man/ronin-sha1.1.md +1 -1
- data/man/ronin-sha256.1 +2 -2
- data/man/ronin-sha256.1.md +2 -2
- data/man/ronin-sha512.1 +1 -1
- data/man/ronin-sha512.1.md +1 -1
- data/man/ronin-strings.1 +1 -1
- data/man/ronin-strings.1.md +1 -1
- data/man/ronin-tips.1 +1 -1
- data/man/ronin-tips.1.md +1 -1
- data/man/ronin-tld-list.1 +11 -1
- data/man/ronin-tld-list.1.md +9 -1
- data/man/ronin-typo.1 +1 -1
- data/man/ronin-typo.1.md +1 -1
- data/man/ronin-typosquat.1 +1 -1
- data/man/ronin-typosquat.1.md +1 -1
- data/man/ronin-unescape.1 +1 -1
- data/man/ronin-unescape.1.md +1 -1
- data/man/ronin-unhexdump.1 +1 -1
- data/man/ronin-unhexdump.1.md +1 -1
- data/man/ronin-unquote.1 +1 -1
- data/man/ronin-unquote.1.md +1 -1
- data/man/ronin-url.1 +1 -1
- data/man/ronin-url.1.md +1 -1
- data/man/ronin-xor.1 +1 -1
- data/man/ronin-xor.1.md +1 -1
- data/man/ronin.1 +1 -1
- data/man/ronin.1.md +1 -1
- data/ronin.gemspec +4 -3
- metadata +40 -2
|
@@ -61,14 +61,14 @@ module Ronin
|
|
|
61
61
|
class Encode < StringMethodsCommand
|
|
62
62
|
|
|
63
63
|
option :base16, desc: 'Base16 encodes the data' do
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
require 'ronin/support/encoding/base16'
|
|
65
|
+
@method_calls << :base16_encode
|
|
66
|
+
end
|
|
67
67
|
|
|
68
68
|
option :base32, desc: 'Base32 encodes the data' do
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
require 'ronin/support/encoding/base32'
|
|
70
|
+
@method_calls << :base32_encode
|
|
71
|
+
end
|
|
72
72
|
|
|
73
73
|
option :base64, short: '-b',
|
|
74
74
|
equals: true,
|
|
@@ -78,11 +78,11 @@ module Ronin
|
|
|
78
78
|
},
|
|
79
79
|
desc: 'Base64 encodes the data' do |mode=nil|
|
|
80
80
|
require 'ronin/support/encoding/base64'
|
|
81
|
-
if mode
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
@method_calls << if mode
|
|
82
|
+
[:base64_encode, [mode]]
|
|
83
|
+
else
|
|
84
|
+
:base64_encode
|
|
85
|
+
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
option :zlib, short: '-z',
|
|
@@ -122,9 +122,9 @@ module Ronin
|
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
option :http, desc: 'HTTP encodes the data' do
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
require 'ronin/support/encoding/http'
|
|
126
|
+
@method_calls << :http_encode
|
|
127
|
+
end
|
|
128
128
|
|
|
129
129
|
option :js, short: '-j',
|
|
130
130
|
desc: 'JavaScript encodes the data' do
|
|
@@ -136,7 +136,7 @@ module Ronin
|
|
|
136
136
|
def run(*files)
|
|
137
137
|
unless @pattern
|
|
138
138
|
print_error "must specify a pattern to search for"
|
|
139
|
-
exit
|
|
139
|
+
exit(-1)
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
super(*files)
|
|
@@ -151,8 +151,8 @@ module Ronin
|
|
|
151
151
|
def process_input(input)
|
|
152
152
|
filename = filename_of(input)
|
|
153
153
|
|
|
154
|
-
input.each_line(chomp: true).
|
|
155
|
-
match_line(line, filename: filename, line_number: index+1)
|
|
154
|
+
input.each_line(chomp: true).with_index do |line,index|
|
|
155
|
+
match_line(line, filename: filename, line_number: index + 1)
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
|
|
@@ -184,7 +184,9 @@ module Ronin
|
|
|
184
184
|
#
|
|
185
185
|
def match_line(line,**kwargs)
|
|
186
186
|
index = 0
|
|
187
|
+
|
|
187
188
|
printed_prefix = false
|
|
189
|
+
only_matching = options[:only_matching]
|
|
188
190
|
|
|
189
191
|
while (match = line.match(@pattern,index))
|
|
190
192
|
unless printed_prefix
|
|
@@ -195,13 +197,13 @@ module Ronin
|
|
|
195
197
|
match_start, match_stop = match.offset(0)
|
|
196
198
|
|
|
197
199
|
# print the text before the match, unless --only-matching is enabled
|
|
198
|
-
print(line[index...match_start]) unless
|
|
200
|
+
print(line[index...match_start]) unless only_matching
|
|
199
201
|
print_match(match)
|
|
200
202
|
|
|
201
203
|
index = match_stop
|
|
202
204
|
end
|
|
203
205
|
|
|
204
|
-
unless
|
|
206
|
+
unless only_matching
|
|
205
207
|
# print the rest of the line, if we've had at least one match
|
|
206
208
|
puts(line[index..]) if index > 0
|
|
207
209
|
end
|
|
@@ -60,7 +60,7 @@ module Ronin
|
|
|
60
60
|
# ## Arguments
|
|
61
61
|
#
|
|
62
62
|
# [FILE] Optional file to hexdump
|
|
63
|
-
#
|
|
63
|
+
#
|
|
64
64
|
class Hexdump < FileProcessorCommand
|
|
65
65
|
|
|
66
66
|
# Supported types for the `-t,--type` option.
|
|
@@ -149,7 +149,7 @@ module Ronin
|
|
|
149
149
|
option :length, short: '-L',
|
|
150
150
|
value: {
|
|
151
151
|
type: Integer,
|
|
152
|
-
usage: 'LEN'
|
|
152
|
+
usage: 'LEN'
|
|
153
153
|
},
|
|
154
154
|
desc: 'Length of data to hexdump'
|
|
155
155
|
|
|
@@ -399,7 +399,7 @@ module Ronin
|
|
|
399
399
|
end
|
|
400
400
|
|
|
401
401
|
regexp = Regexp.new(value[1...index])
|
|
402
|
-
style = parse_style(value[index+2..])
|
|
402
|
+
style = parse_style(value[(index + 2)..])
|
|
403
403
|
|
|
404
404
|
return [regexp, style]
|
|
405
405
|
else
|
|
@@ -408,7 +408,7 @@ module Ronin
|
|
|
408
408
|
end
|
|
409
409
|
|
|
410
410
|
pattern = value[0...index]
|
|
411
|
-
style = parse_style(value[index+1..])
|
|
411
|
+
style = parse_style(value[(index + 1)..])
|
|
412
412
|
|
|
413
413
|
return [pattern, style]
|
|
414
414
|
end
|
|
@@ -417,6 +417,7 @@ module Ronin
|
|
|
417
417
|
# List of command `options` that directly map to the keyword arguments
|
|
418
418
|
# of `Hexdump.hexdump`.
|
|
419
419
|
HEXDUMP_OPTIONS = [
|
|
420
|
+
:type,
|
|
420
421
|
:format,
|
|
421
422
|
:offset,
|
|
422
423
|
:length,
|
|
@@ -445,34 +446,65 @@ module Ronin
|
|
|
445
446
|
kwargs[key] = options[key] if options.has_key?(key)
|
|
446
447
|
end
|
|
447
448
|
|
|
448
|
-
if (
|
|
449
|
-
(
|
|
450
|
-
(
|
|
451
|
-
kwargs[:style] =
|
|
452
|
-
kwargs[:style][:index] = index_style if index_style
|
|
453
|
-
kwargs[:style][:numeric] = numeric_style if numeric_style
|
|
454
|
-
kwargs[:style][:chars] = chars_style if chars_style
|
|
449
|
+
if options.has_key?(:style_index) ||
|
|
450
|
+
options.has_key?(:style_numeric) ||
|
|
451
|
+
options.has_key?(:style_chars)
|
|
452
|
+
kwargs[:style] = hexdump_style_kwargs
|
|
455
453
|
end
|
|
456
454
|
|
|
457
455
|
if !@highlight_index.empty? ||
|
|
458
456
|
!@highlight_numeric.empty? ||
|
|
459
457
|
!@highlight_chars.empty?
|
|
460
|
-
kwargs[:highlights] =
|
|
458
|
+
kwargs[:highlights] = hexdump_highlights_kwargs
|
|
459
|
+
end
|
|
461
460
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
end
|
|
461
|
+
return kwargs
|
|
462
|
+
end
|
|
465
463
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
#
|
|
465
|
+
# The hexdump `style:` keyword arguments.
|
|
466
|
+
#
|
|
467
|
+
# @return [Hash{Symbol => Object}]
|
|
468
|
+
#
|
|
469
|
+
def hexdump_style_kwargs
|
|
470
|
+
style = {}
|
|
469
471
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
end
|
|
472
|
+
if (index_style = options[:style_index])
|
|
473
|
+
style[:index] = index_style
|
|
473
474
|
end
|
|
474
475
|
|
|
475
|
-
|
|
476
|
+
if (numeric_style = options[:style_numeric])
|
|
477
|
+
style[:numeric] = numeric_style
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
if (chars_style = options[:style_chars])
|
|
481
|
+
style[:chars] = chars_style
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
return style
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
#
|
|
488
|
+
# The hexdump `highlights:` keyword arguments.
|
|
489
|
+
#
|
|
490
|
+
# @return [Hash{Symbol => Object}]
|
|
491
|
+
#
|
|
492
|
+
def hexdump_highlights_kwargs
|
|
493
|
+
highlights = {}
|
|
494
|
+
|
|
495
|
+
unless @highlight_index.empty?
|
|
496
|
+
highlights[:index] = @highlight_index
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
unless @highlight_numeric.empty?
|
|
500
|
+
highlights[:numeric] = @highlight_numeric
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
unless @highlight_chars.empty?
|
|
504
|
+
highlights[:chars] = @highlight_chars
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
return highlights
|
|
476
508
|
end
|
|
477
509
|
|
|
478
510
|
end
|
|
@@ -30,17 +30,17 @@ module Ronin
|
|
|
30
30
|
#
|
|
31
31
|
# ## Usage
|
|
32
32
|
#
|
|
33
|
-
# ronin host [options]
|
|
33
|
+
# ronin host [options] {HOST ... | --file FILE}
|
|
34
34
|
#
|
|
35
35
|
# ## Options
|
|
36
36
|
#
|
|
37
37
|
# -f, --file FILE Optional file to read values from
|
|
38
38
|
# --subdomain SUBNAME Converts the hostname to a sub-domain
|
|
39
39
|
# -d, --domain Converts the hostname to a domain
|
|
40
|
-
# -T, --tld Converts the hostname to it's TLD
|
|
40
|
+
# -T, --tld Converts the hostname to it's TLD
|
|
41
41
|
# -s, --suffix Converts the hostname to it's suffix
|
|
42
42
|
# -S, --change-suffix SUFFIX Changes the suffix of each hostname
|
|
43
|
-
# --enum-tlds Enumerates over every TLD
|
|
43
|
+
# --enum-tlds Enumerates over every TLD
|
|
44
44
|
# --enum-suffixes[={icann|private}]
|
|
45
45
|
# Enumerates over every domain suffix
|
|
46
46
|
# --enum-subdomains FILE Enumerates over every subdomain in the wordlist
|
|
@@ -63,7 +63,7 @@ module Ronin
|
|
|
63
63
|
|
|
64
64
|
include DNS
|
|
65
65
|
|
|
66
|
-
usage '[options]
|
|
66
|
+
usage '[options] {HOST ... | --file FILE}'
|
|
67
67
|
|
|
68
68
|
option :subdomain, value: {
|
|
69
69
|
type: String,
|
|
@@ -117,20 +117,20 @@ module Ronin
|
|
|
117
117
|
option :has_records, short: '-H',
|
|
118
118
|
value: {
|
|
119
119
|
type: {
|
|
120
|
-
A:
|
|
121
|
-
AAAA:
|
|
122
|
-
ANY:
|
|
120
|
+
A: :a,
|
|
121
|
+
AAAA: :aaaa,
|
|
122
|
+
ANY: :any,
|
|
123
123
|
CNAME: :cname,
|
|
124
124
|
HINFO: :hinfo,
|
|
125
|
-
LOC:
|
|
125
|
+
LOC: :loc,
|
|
126
126
|
MINFO: :minfo,
|
|
127
|
-
MX:
|
|
128
|
-
NS:
|
|
129
|
-
PTR:
|
|
130
|
-
SOA:
|
|
131
|
-
SRV:
|
|
132
|
-
TXT:
|
|
133
|
-
WKS:
|
|
127
|
+
MX: :mx,
|
|
128
|
+
NS: :ns,
|
|
129
|
+
PTR: :ptr,
|
|
130
|
+
SOA: :soa,
|
|
131
|
+
SRV: :srv,
|
|
132
|
+
TXT: :txt,
|
|
133
|
+
WKS: :wks
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
desc: 'Filters hostnames that have a certain DNS record type'
|
|
@@ -22,6 +22,7 @@ require 'ronin/cli/http_shell'
|
|
|
22
22
|
require 'ronin/support/network/http'
|
|
23
23
|
|
|
24
24
|
require 'command_kit/options/verbose'
|
|
25
|
+
require 'addressable/uri'
|
|
25
26
|
|
|
26
27
|
module Ronin
|
|
27
28
|
class CLI
|
|
@@ -74,6 +75,9 @@ module Ronin
|
|
|
74
75
|
include CommandKit::Options::Verbose
|
|
75
76
|
include Printing::HTTP
|
|
76
77
|
|
|
78
|
+
# `http://` and `https://` URL validation regex.
|
|
79
|
+
URL_REGEX = URI::DEFAULT_PARSER.make_regexp(%w[http https])
|
|
80
|
+
|
|
77
81
|
usage '[options] {URL [...] | --shell URL}'
|
|
78
82
|
|
|
79
83
|
option :method, value: {
|
|
@@ -147,10 +151,14 @@ module Ronin
|
|
|
147
151
|
end
|
|
148
152
|
|
|
149
153
|
option :shell, value: {
|
|
150
|
-
type:
|
|
154
|
+
type: URL_REGEX,
|
|
151
155
|
usage: 'URL'
|
|
152
156
|
},
|
|
153
|
-
desc: 'Open an interactive HTTP shell'
|
|
157
|
+
desc: 'Open an interactive HTTP shell' do |url|
|
|
158
|
+
options[:shell] = Addressable::URI.parse(url)
|
|
159
|
+
rescue Addressable::URI::InvalidURIError => error
|
|
160
|
+
raise(OptionParser::InvalidArgument,"invalid URL: #{error.message}")
|
|
161
|
+
end
|
|
154
162
|
|
|
155
163
|
option :proxy, short: '-P',
|
|
156
164
|
value: {
|
|
@@ -172,11 +180,9 @@ module Ronin
|
|
|
172
180
|
|
|
173
181
|
option :user_agent, short: '-u',
|
|
174
182
|
value: {
|
|
175
|
-
type:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
]
|
|
183
|
+
type: Support::Network::HTTP::UserAgents::ALIASES.transform_keys { |key|
|
|
184
|
+
key.to_s.tr('_','-')
|
|
185
|
+
}
|
|
180
186
|
},
|
|
181
187
|
desc: 'The User-Agent to use' do |name|
|
|
182
188
|
@user_agent = name
|
|
@@ -326,25 +332,36 @@ module Ronin
|
|
|
326
332
|
# The URL to request.
|
|
327
333
|
#
|
|
328
334
|
def process_value(url)
|
|
329
|
-
url
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
335
|
+
unless url =~ URL_REGEX
|
|
336
|
+
print_error "invalid URL: #{url.inspect}"
|
|
337
|
+
return
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
uri = begin
|
|
341
|
+
Addressable::URI.parse(url)
|
|
342
|
+
rescue Addressable::URI::InvalidURIError => error
|
|
343
|
+
print_error "invalid URL: #{error.message}"
|
|
344
|
+
return
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
begin
|
|
348
|
+
Support::Network::HTTP.request(
|
|
349
|
+
@http_method, uri, proxy: @proxy,
|
|
350
|
+
user_agent: @user_agent,
|
|
351
|
+
query_params: @query_params,
|
|
352
|
+
headers: @headers,
|
|
353
|
+
body: @body,
|
|
354
|
+
form_data: @form_data
|
|
355
|
+
) do |response|
|
|
356
|
+
# NOTE: we must call HTTP.request with a block to avoid causing
|
|
357
|
+
# #read_body to be called twice.
|
|
358
|
+
print_response(response)
|
|
359
|
+
end
|
|
360
|
+
rescue StandardError => error
|
|
361
|
+
if verbose? then print_exception(error)
|
|
362
|
+
else print_error(error.message)
|
|
363
|
+
end
|
|
344
364
|
end
|
|
345
|
-
rescue => error
|
|
346
|
-
print_error(error.message)
|
|
347
|
-
exit(1)
|
|
348
365
|
end
|
|
349
366
|
|
|
350
367
|
#
|
|
@@ -135,12 +135,12 @@ module Ronin
|
|
|
135
135
|
desc: 'The query string for the URI'
|
|
136
136
|
|
|
137
137
|
option :http, desc: 'Converts the IP address into a http:// URI' do
|
|
138
|
-
options[:uri]
|
|
138
|
+
options[:uri] = true
|
|
139
139
|
options[:uri_scheme] = 'http'
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
option :https, desc: 'Converts the IP address into a https:// URI' do
|
|
143
|
-
options[:uri]
|
|
143
|
+
options[:uri] = true
|
|
144
144
|
options[:uri_scheme] = 'https'
|
|
145
145
|
end
|
|
146
146
|
|
|
@@ -197,7 +197,9 @@ module Ronin
|
|
|
197
197
|
|
|
198
198
|
puts "#{ip}/#{ip.prefix}"
|
|
199
199
|
elsif options[:host]
|
|
200
|
-
|
|
200
|
+
if (host = ip.host)
|
|
201
|
+
puts host
|
|
202
|
+
end
|
|
201
203
|
elsif options[:port]
|
|
202
204
|
puts "#{format_ip(ip)}:#{options[:port]}"
|
|
203
205
|
elsif options[:uri]
|
|
@@ -47,7 +47,7 @@ module Ronin
|
|
|
47
47
|
# ronin iprange 1.1.2-4.10-50
|
|
48
48
|
# ronin iprange --start 1.1.1.10 --stop 1.1.4.100
|
|
49
49
|
# ronin iprange --file list.txt
|
|
50
|
-
#
|
|
50
|
+
#
|
|
51
51
|
class Iprange < ValueProcessorCommand
|
|
52
52
|
|
|
53
53
|
usage '[options] [IP_RANGE ... | --start IP --stop IP]'
|
|
@@ -104,7 +104,7 @@ module Ronin
|
|
|
104
104
|
if !@start.empty? && !@stop.empty?
|
|
105
105
|
unless @start.length == @stop.length
|
|
106
106
|
print_error "must specify an equal number of --start and --stop options"
|
|
107
|
-
exit
|
|
107
|
+
exit(-1)
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
@start.zip(@stop).each do |(start,stop)|
|
|
@@ -132,16 +132,14 @@ module Ronin
|
|
|
132
132
|
|
|
133
133
|
option :ssl_key, value: {
|
|
134
134
|
type: String,
|
|
135
|
-
usage: 'FILE'
|
|
135
|
+
usage: 'FILE'
|
|
136
136
|
},
|
|
137
137
|
desc: 'Specifies the SSL key file'
|
|
138
138
|
|
|
139
139
|
option :ssl_verify, value: {
|
|
140
|
-
type:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
]
|
|
140
|
+
type: Support::Network::SSL::VERIFY.transform_keys { |key|
|
|
141
|
+
key.to_s.tr('_','-')
|
|
142
|
+
}
|
|
145
143
|
},
|
|
146
144
|
desc: 'SSL verification mode'
|
|
147
145
|
|
|
@@ -301,16 +299,15 @@ module Ronin
|
|
|
301
299
|
# The client event loop.
|
|
302
300
|
#
|
|
303
301
|
def client_loop
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
302
|
+
finished = Async::Notification.new
|
|
303
|
+
endpoint = async_endpoint
|
|
304
|
+
stdin = async_stdin
|
|
308
305
|
buffer_size = options[:buffer_size]
|
|
309
306
|
|
|
310
307
|
Async do |task|
|
|
311
308
|
socket = begin
|
|
312
309
|
endpoint.connect
|
|
313
|
-
rescue => error
|
|
310
|
+
rescue StandardError => error
|
|
314
311
|
print_error(error.message)
|
|
315
312
|
exit(1)
|
|
316
313
|
end
|
|
@@ -319,25 +316,23 @@ module Ronin
|
|
|
319
316
|
|
|
320
317
|
begin
|
|
321
318
|
client = task.async do
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
print_data(data)
|
|
325
|
-
end
|
|
326
|
-
rescue EOFError
|
|
327
|
-
ensure
|
|
328
|
-
finished.signal
|
|
319
|
+
while (data = stream.read_partial(buffer_size))
|
|
320
|
+
print_data(data)
|
|
329
321
|
end
|
|
322
|
+
rescue EOFError
|
|
323
|
+
# ignore EOFError
|
|
324
|
+
ensure
|
|
325
|
+
finished.signal
|
|
330
326
|
end
|
|
331
327
|
|
|
332
328
|
user = task.async do
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
socket.write(data)
|
|
336
|
-
end
|
|
337
|
-
rescue EOFError
|
|
338
|
-
ensure
|
|
339
|
-
finished.signal
|
|
329
|
+
while (data = stdin.read_partial(buffer_size))
|
|
330
|
+
socket.write(data)
|
|
340
331
|
end
|
|
332
|
+
rescue EOFError
|
|
333
|
+
# ignore EOFError
|
|
334
|
+
ensure
|
|
335
|
+
finished.signal
|
|
341
336
|
end
|
|
342
337
|
|
|
343
338
|
finished.wait
|
|
@@ -353,12 +348,11 @@ module Ronin
|
|
|
353
348
|
# The server event loop.
|
|
354
349
|
#
|
|
355
350
|
def server_loop
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
351
|
+
finished = Async::Notification.new
|
|
352
|
+
endpoint = async_endpoint
|
|
353
|
+
stdin = async_stdin
|
|
354
|
+
clients = []
|
|
360
355
|
buffer_size = options[:buffer_size]
|
|
361
|
-
clients = []
|
|
362
356
|
|
|
363
357
|
Async do |task|
|
|
364
358
|
endpoint.accept do |socket|
|
|
@@ -374,6 +368,7 @@ module Ronin
|
|
|
374
368
|
print_data(data)
|
|
375
369
|
end
|
|
376
370
|
rescue EOFError
|
|
371
|
+
# ignore EOFError
|
|
377
372
|
end
|
|
378
373
|
|
|
379
374
|
clients.delete(socket)
|
|
@@ -384,18 +379,17 @@ module Ronin
|
|
|
384
379
|
end
|
|
385
380
|
|
|
386
381
|
task.async do
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
clients.each { |client| client.write(data) }
|
|
390
|
-
end
|
|
391
|
-
rescue EOFError
|
|
392
|
-
ensure
|
|
393
|
-
finished.signal
|
|
382
|
+
while (data = stdin.read_partial(buffer_size))
|
|
383
|
+
clients.each { |client| client.write(data) }
|
|
394
384
|
end
|
|
385
|
+
rescue EOFError
|
|
386
|
+
# ignore EOFError
|
|
387
|
+
ensure
|
|
388
|
+
finished.signal
|
|
395
389
|
end
|
|
396
390
|
|
|
397
391
|
finished.wait
|
|
398
|
-
rescue => error
|
|
392
|
+
rescue StandardError => error
|
|
399
393
|
print_error(error.message)
|
|
400
394
|
exit(1)
|
|
401
395
|
ensure
|
|
@@ -23,26 +23,26 @@ require 'ronin/root'
|
|
|
23
23
|
module Ronin
|
|
24
24
|
class CLI
|
|
25
25
|
module Commands
|
|
26
|
-
#
|
|
27
|
-
# Creates new Ruby project directory.
|
|
28
|
-
#
|
|
29
|
-
# ## Usage
|
|
30
|
-
#
|
|
31
|
-
# ronin new project [options] DIR
|
|
32
|
-
#
|
|
33
|
-
# ## Options
|
|
34
|
-
#
|
|
35
|
-
# --git Initializes a git repo
|
|
36
|
-
# --ruby-version VERSION The desired ruby version for the project
|
|
37
|
-
# --rakefile Creates a Rakefile
|
|
38
|
-
# -D, --dockerfile Adds a Dockerfile to the new project
|
|
39
|
-
# -h, --help Print help information
|
|
40
|
-
#
|
|
41
|
-
# ## Arguments
|
|
42
|
-
#
|
|
43
|
-
# PATH The directory to create
|
|
44
|
-
#
|
|
45
26
|
class New < Command
|
|
27
|
+
#
|
|
28
|
+
# Creates new Ruby project directory.
|
|
29
|
+
#
|
|
30
|
+
# ## Usage
|
|
31
|
+
#
|
|
32
|
+
# ronin new project [options] DIR
|
|
33
|
+
#
|
|
34
|
+
# ## Options
|
|
35
|
+
#
|
|
36
|
+
# --git Initializes a git repo
|
|
37
|
+
# --ruby-version VERSION The desired ruby version for the project
|
|
38
|
+
# --rakefile Creates a Rakefile
|
|
39
|
+
# -D, --dockerfile Adds a Dockerfile to the new project
|
|
40
|
+
# -h, --help Print help information
|
|
41
|
+
#
|
|
42
|
+
# ## Arguments
|
|
43
|
+
#
|
|
44
|
+
# PATH The directory to create
|
|
45
|
+
#
|
|
46
46
|
class Project < Command
|
|
47
47
|
|
|
48
48
|
include Core::CLI::Generator
|
|
@@ -23,25 +23,25 @@ require 'ronin/root'
|
|
|
23
23
|
module Ronin
|
|
24
24
|
class CLI
|
|
25
25
|
module Commands
|
|
26
|
-
#
|
|
27
|
-
# Creates a new standalone Ruby script.
|
|
28
|
-
#
|
|
29
|
-
# ## Usage
|
|
30
|
-
#
|
|
31
|
-
# ronin new script PATH
|
|
32
|
-
#
|
|
33
|
-
# ## Arguments
|
|
34
|
-
#
|
|
35
|
-
# PATH The script file to create
|
|
36
|
-
#
|
|
37
26
|
class New < Command
|
|
27
|
+
#
|
|
28
|
+
# Creates a new standalone Ruby script.
|
|
29
|
+
#
|
|
30
|
+
# ## Usage
|
|
31
|
+
#
|
|
32
|
+
# ronin new script PATH
|
|
33
|
+
#
|
|
34
|
+
# ## Arguments
|
|
35
|
+
#
|
|
36
|
+
# PATH The script file to create
|
|
37
|
+
#
|
|
38
38
|
class Script < Command
|
|
39
39
|
|
|
40
40
|
include Core::CLI::Generator
|
|
41
41
|
|
|
42
42
|
template_dir File.join(ROOT,'data','new')
|
|
43
43
|
|
|
44
|
-
usage'
|
|
44
|
+
usage 'PATH'
|
|
45
45
|
|
|
46
46
|
argument :path, required: true,
|
|
47
47
|
desc: 'The script file to create'
|