ronin 2.0.0.beta5 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -0
- data/.rubocop.yml +21 -0
- data/ChangeLog.md +18 -2
- data/Gemfile +6 -2
- data/Rakefile +9 -2
- data/bin/ronin +6 -7
- data/data/new/project/Gemfile.erb +9 -9
- data/gemspec.yml +12 -12
- 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/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 +53 -22
- data/lib/ronin/cli/commands/hmac.rb +1 -1
- data/lib/ronin/cli/commands/host.rb +2 -2
- data/lib/ronin/cli/commands/http.rb +48 -26
- data/lib/ronin/cli/commands/ip.rb +2 -2
- 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 +10 -10
- 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 +1 -1
- data/man/ronin-cert-gen.1.md +1 -1
- 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 +1 -1
- data/man/ronin-decrypt.1.md +1 -1
- data/man/ronin-dns.1 +1 -1
- data/man/ronin-dns.1.md +1 -1
- data/man/ronin-email-addr.1 +1 -1
- data/man/ronin-email-addr.1.md +1 -1
- data/man/ronin-encode.1 +1 -1
- data/man/ronin-encode.1.md +1 -1
- data/man/ronin-encrypt.1 +1 -1
- data/man/ronin-encrypt.1.md +1 -1
- data/man/ronin-entropy.1 +1 -1
- data/man/ronin-entropy.1.md +1 -1
- data/man/ronin-escape.1 +1 -1
- data/man/ronin-escape.1.md +1 -1
- 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 +2 -2
- data/man/ronin-host.1.md +2 -2
- 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 +1 -1
- data/man/ronin-proxy.1.md +1 -1
- data/man/ronin-public-suffix-list.1 +11 -1
- data/man/ronin-public-suffix-list.1.md +9 -1
- data/man/ronin-quote.1 +1 -1
- data/man/ronin-quote.1.md +1 -1
- data/man/ronin-rot.1 +4 -3
- data/man/ronin-rot.1.md +4 -3
- data/man/ronin-sha1.1 +1 -1
- data/man/ronin-sha1.1.md +1 -1
- data/man/ronin-sha256.1 +1 -1
- data/man/ronin-sha256.1.md +1 -1
- 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 +62 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42aeafda3468e4c0f5427a4f2323d40b96bb4aaafc042bb8380d569f5c8c5414
|
4
|
+
data.tar.gz: a150c7211fa93770dc9be47343f8f3d3391396996885263580c0185742476255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562df97d739aedfad72706c939d40697f8ab39136a3aab69e2d67e7aa29b3ea03bf1534695f259af8060c5e09f26e6e6c51ff62c57fa8d1ad73242c0c48e9c78
|
7
|
+
data.tar.gz: '018c73e255ed3b3468d84c054d8b79095cef777443536beac09e572d1bf183ce0d3a019a8e45560013c13a0b8df202a7402d1c4d4cd41ff884a0179f932e51bb'
|
data/.github/workflows/ruby.yml
CHANGED
@@ -30,3 +30,17 @@ jobs:
|
|
30
30
|
run: bundle install --jobs 4 --retry 3
|
31
31
|
- name: Run tests
|
32
32
|
run: bundle exec rake test
|
33
|
+
|
34
|
+
# rubocop linting
|
35
|
+
rubocop:
|
36
|
+
runs-on: ubuntu-latest
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v2
|
39
|
+
- name: Set up Ruby
|
40
|
+
uses: ruby/setup-ruby@v1
|
41
|
+
with:
|
42
|
+
ruby-version: 3.0
|
43
|
+
- name: Install dependencies
|
44
|
+
run: bundle install --jobs 4 --retry 3
|
45
|
+
- name: Run rubocop
|
46
|
+
run: bundle exec rubocop --parallel
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
SuggestExtensions: false
|
4
|
+
TargetRubyVersion: 3.1
|
5
|
+
|
6
|
+
inherit_gem:
|
7
|
+
rubocop-ronin: rubocop.yml
|
8
|
+
|
9
|
+
#
|
10
|
+
# ronin specific exceptions
|
11
|
+
#
|
12
|
+
|
13
|
+
# this rule does not take into account the spacing of commented out lines
|
14
|
+
Layout/ExtraSpacing:
|
15
|
+
Exclude:
|
16
|
+
- 'Gemfile'
|
17
|
+
|
18
|
+
# no need to add `frozen_string_literal: true` to new scripts/projects
|
19
|
+
Style/FrozenStringLiteralComment:
|
20
|
+
Exclude:
|
21
|
+
- 'data/new/**/*'
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,20 @@
|
|
1
|
-
### 2.0.
|
1
|
+
### 2.0.1 / 2023-03-01
|
2
|
+
|
3
|
+
* Require [ronin-support] ~> 1.0, >= 1.0.1.
|
4
|
+
* Require [ronin-core] ~> 0.1, >= 0.1.1.
|
5
|
+
* Require [ronin-web] ~> 1.0, >= 1.0.1.
|
6
|
+
* Require [ronin-payloads] ~> 0.1, >= 0.1.1.
|
7
|
+
* Require [ronin-vulns] ~> 0.1, >= 0.1.2.
|
8
|
+
* Require [ronin-exploits] ~> 1.0, >= 1.0.1.
|
9
|
+
* Added {Ronin::CLI::HostAndPort} for common `host:port` parsing logic.
|
10
|
+
* Minor bug fixes.
|
11
|
+
* Improved documentation.
|
12
|
+
|
13
|
+
#### CLI
|
14
|
+
|
15
|
+
* Ensure that the `ronin http` command works with IDN host-names.
|
16
|
+
|
17
|
+
### 2.0.0 / 2023-02-01
|
2
18
|
|
3
19
|
* Require `ruby` >= 3.0.0.
|
4
20
|
* Require [rouge] ~> 3.0
|
@@ -756,7 +772,7 @@
|
|
756
772
|
* Require Spidr >= 0.1.3.
|
757
773
|
* Moved Ronin::Parameters into the parameters 0.1.0 RubyGem.
|
758
774
|
* Added a Ronin::Hexdump module:
|
759
|
-
* Provides Ronin::Hexdump.dump and Kernel#hexdump, which can hexdump any
|
775
|
+
* Provides Ronin::Hexdump.dump and Kernel#hexdump, which can hexdump any
|
760
776
|
object that supports the #each_byte method.
|
761
777
|
* Refactored Ronin::Chars::CharSet:
|
762
778
|
* Now inherites the SortedSet class.
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
@@ -45,9 +47,9 @@ end
|
|
45
47
|
# branch: 'main'
|
46
48
|
# gem 'ronin-vulns', '~> 0.1', github: "ronin-rb/ronin-vulns",
|
47
49
|
# branch: 'main'
|
48
|
-
# gem 'ronin-web-server',
|
50
|
+
# gem 'ronin-web-server', '~> 0.1', github: "ronin-rb/ronin-web-server",
|
49
51
|
# branch: 'main'
|
50
|
-
# gem 'ronin-web-spider',
|
52
|
+
# gem 'ronin-web-spider', '~> 0.1', github: "ronin-rb/ronin-web-spider",
|
51
53
|
# branch: 'main'
|
52
54
|
# gem 'ronin-web-user_agents', '~> 0.1', github: "ronin-rb/ronin-web-user_agents",
|
53
55
|
# branch: 'main'
|
@@ -70,4 +72,6 @@ group :development do
|
|
70
72
|
gem 'dead_end', require: false
|
71
73
|
gem 'sord', require: false, platform: :mri
|
72
74
|
gem 'stackprof', require: false, platform: :mri
|
75
|
+
gem 'rubocop', require: false, platform: :mri
|
76
|
+
gem 'rubocop-ronin', require: false, platform: :mri
|
73
77
|
end
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'bundler'
|
5
5
|
rescue LoadError => e
|
6
6
|
warn e.message
|
7
7
|
warn "Run `gem install bundler` to install Bundler"
|
8
|
-
exit
|
8
|
+
exit(-1)
|
9
9
|
end
|
10
10
|
|
11
11
|
begin
|
@@ -23,6 +23,13 @@ Gem::Tasks.new(sign: {checksum: true, pgp: true})
|
|
23
23
|
|
24
24
|
require 'rspec/core/rake_task'
|
25
25
|
RSpec::Core::RakeTask.new
|
26
|
+
|
27
|
+
namespace :spec do
|
28
|
+
RSpec::Core::RakeTask.new(:integration) do |t|
|
29
|
+
t.rspec_opts = '--tag integration'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
task :test => :spec
|
27
34
|
task :default => :spec
|
28
35
|
|
data/bin/ronin
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rubygems'
|
4
5
|
|
5
6
|
root = File.expand_path(File.join(File.dirname(__FILE__),'..'))
|
6
7
|
if File.file?(File.join(root,'Gemfile.lock'))
|
7
8
|
Dir.chdir(root) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
exit -1
|
14
|
-
end
|
9
|
+
require 'bundler/setup'
|
10
|
+
rescue LoadError => e
|
11
|
+
warn e.message
|
12
|
+
warn "Run `gem install bundler` to install Bundler"
|
13
|
+
exit(-1)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
@@ -4,13 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
gem 'rake'
|
5
5
|
|
6
6
|
<%- end -%>
|
7
|
-
gem 'ronin-support', '~> 1.0'
|
7
|
+
gem 'ronin-support', '~> 1.0' # , github: 'ronin-rb/ronin-support'
|
8
8
|
|
9
|
-
# gem 'ronin-code-asm', '~> 0.3'
|
10
|
-
# gem 'ronin-code-sql', '~> 1.2'
|
11
|
-
# gem 'ronin-db', '~> 0.1'
|
12
|
-
# gem 'ronin-web-server', '~> 0.1'
|
13
|
-
# gem 'ronin-web-spider', '~> 0.1'
|
14
|
-
# gem 'ronin-web-user_agents', '~> 0.1'
|
15
|
-
# gem 'ronin-payloads', '~> 0.1'
|
16
|
-
# gem 'ronin-exploits', '~> 1.0'
|
9
|
+
# gem 'ronin-code-asm', '~> 0.3' # , github: 'ronin-rb/ronin-code-asm'
|
10
|
+
# gem 'ronin-code-sql', '~> 1.2' # , github: 'ronin-rb/ronin-code-sql'
|
11
|
+
# gem 'ronin-db', '~> 0.1' # , github: 'ronin-rb/ronin-db'
|
12
|
+
# gem 'ronin-web-server', '~> 0.1' # , github: 'ronin-rb/ronin-web-server'
|
13
|
+
# gem 'ronin-web-spider', '~> 0.1' # , github: 'ronin-rb/ronin-web-spider'
|
14
|
+
# gem 'ronin-web-user_agents', '~> 0.1' # , github: 'ronin-rb/ronin-web-user_agents'
|
15
|
+
# gem 'ronin-payloads', '~> 0.1' # , github: 'ronin-rb/ronin-payloads'
|
16
|
+
# gem 'ronin-exploits', '~> 1.0' # , github: 'ronin-rb/ronin-exploits'
|
data/gemspec.yml
CHANGED
@@ -2,7 +2,7 @@ name: ronin
|
|
2
2
|
summary: A Ruby toolkit for security research and development.
|
3
3
|
description:
|
4
4
|
Ronin is a free and Open Source Ruby toolkit for security research and
|
5
|
-
development.Ronin contains many different CLI commands and Ruby libraries for
|
5
|
+
development.Ronin contains many different CLI commands and Ruby libraries for
|
6
6
|
a variety of security tasks, such as encoding/decoding data, filter
|
7
7
|
IPs/hosts/URLs, querying ASNs, querying DNS, HTTP, scanning for web
|
8
8
|
vulnerabilities, spidering websites, install 3rd party repositories of
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
async-io: ~> 1.0
|
97
97
|
wordlist: ~> 1.0
|
98
98
|
# Ronin dependencies:
|
99
|
-
ronin-support: ~> 1.0.0.
|
100
|
-
ronin-core: ~> 0.1
|
101
|
-
ronin-repos: ~> 0.1
|
102
|
-
ronin-db: ~> 0.1
|
103
|
-
ronin-fuzzer: ~> 0.1
|
104
|
-
ronin-web: ~> 1.0.0.
|
105
|
-
ronin-code-asm: ~> 1.0
|
106
|
-
ronin-code-sql: ~> 2.0
|
107
|
-
ronin-payloads: ~> 0.1
|
108
|
-
ronin-exploits: ~> 1.0.0.
|
109
|
-
ronin-vulns: ~> 0.1
|
99
|
+
ronin-support: ~> 1.0, >= 1.0.1
|
100
|
+
ronin-core: ~> 0.1, >= 0.1.1
|
101
|
+
ronin-repos: ~> 0.1
|
102
|
+
ronin-db: ~> 0.1
|
103
|
+
ronin-fuzzer: ~> 0.1
|
104
|
+
ronin-web: ~> 1.0, >= 1.0.1
|
105
|
+
ronin-code-asm: ~> 1.0
|
106
|
+
ronin-code-sql: ~> 2.0
|
107
|
+
ronin-payloads: ~> 0.1, >= 0.1.1
|
108
|
+
ronin-exploits: ~> 1.0, >= 1.0.1
|
109
|
+
ronin-vulns: ~> 0.1, >= 0.1.2
|
110
110
|
|
111
111
|
development_dependencies:
|
112
112
|
bundler: ~> 2.0
|
@@ -24,6 +24,9 @@ require 'ronin/support/crypto/cipher'
|
|
24
24
|
module Ronin
|
25
25
|
class CLI
|
26
26
|
module Commands
|
27
|
+
#
|
28
|
+
# Base class for all commands which use ciphers.
|
29
|
+
#
|
27
30
|
class CipherCommand < FileProcessorCommand
|
28
31
|
|
29
32
|
include KeyOptions
|
@@ -142,7 +145,6 @@ module Ronin
|
|
142
145
|
cipher.stream(input, block_size: @block_size, output: stdout)
|
143
146
|
end
|
144
147
|
|
145
|
-
|
146
148
|
end
|
147
149
|
end
|
148
150
|
end
|
data/lib/ronin/cli/command.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'ronin/cli/value_processor_command'
|
20
|
+
require 'ronin/cli/host_and_port'
|
20
21
|
|
21
22
|
require 'ronin/support/network/tcp'
|
22
23
|
|
@@ -42,6 +43,8 @@ module Ronin
|
|
42
43
|
#
|
43
44
|
class BannerGrab < ValueProcessorCommand
|
44
45
|
|
46
|
+
include HostAndPort
|
47
|
+
|
45
48
|
usage '[options] {HOST:PORT} ...'
|
46
49
|
|
47
50
|
option :with_host_port, desc: 'Print the service with the banner'
|
@@ -62,8 +65,7 @@ module Ronin
|
|
62
65
|
# The `HOST:PORT` service pair.
|
63
66
|
#
|
64
67
|
def process_value(service)
|
65
|
-
host, port = service
|
66
|
-
port = port.to_i
|
68
|
+
host, port = host_and_port(service)
|
67
69
|
|
68
70
|
begin
|
69
71
|
banner = Support::Network::TCP.banner(host,port)
|
@@ -73,7 +75,7 @@ module Ronin
|
|
73
75
|
else
|
74
76
|
puts banner
|
75
77
|
end
|
76
|
-
rescue => error
|
78
|
+
rescue StandardError => error
|
77
79
|
print_error("#{service}: #{error.message}")
|
78
80
|
end
|
79
81
|
end
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'ronin/cli/value_processor_command'
|
20
|
+
require 'ronin/cli/host_and_port'
|
20
21
|
require 'ronin/support/crypto/cert'
|
21
22
|
require 'ronin/support/network/ssl/mixin'
|
22
23
|
|
@@ -62,6 +63,7 @@ module Ronin
|
|
62
63
|
include CommandKit::Printing::Indent
|
63
64
|
include CommandKit::Printing::Fields
|
64
65
|
include CommandKit::Printing::Lists
|
66
|
+
include HostAndPort
|
65
67
|
|
66
68
|
usage '[options] {HOST:PORT | URL | FILE} ...'
|
67
69
|
|
@@ -100,14 +102,11 @@ module Ronin
|
|
100
102
|
def process_value(value)
|
101
103
|
case value
|
102
104
|
when /\A[^:]+:\d+\z/
|
103
|
-
host, port = value
|
104
|
-
port = port.to_i
|
105
|
+
host, port = host_and_port(value)
|
105
106
|
|
106
107
|
print_cert(ssl_cert(host,port))
|
107
108
|
when /\Ahttps:/
|
108
|
-
|
109
|
-
host = uri.host
|
110
|
-
port = uri.port
|
109
|
+
host, port = host_and_port_from_url(value)
|
111
110
|
|
112
111
|
print_cert(ssl_cert(host,port))
|
113
112
|
else
|
@@ -180,8 +179,6 @@ module Ronin
|
|
180
179
|
|
181
180
|
puts
|
182
181
|
|
183
|
-
fields = {}
|
184
|
-
|
185
182
|
if options[:extensions]
|
186
183
|
puts "Extensions:"
|
187
184
|
indent do
|
@@ -103,8 +103,8 @@ module Ronin
|
|
103
103
|
|
104
104
|
option :subject_alt_name, short: '-A',
|
105
105
|
value: {
|
106
|
-
|
107
|
-
|
106
|
+
type: /[a-z0-9:\._-]+/,
|
107
|
+
usage: 'HOST|IP'
|
108
108
|
},
|
109
109
|
desc: 'Adds HOST or IP to subjectAltName' do |value|
|
110
110
|
@subject_alt_names << value
|
@@ -277,7 +277,7 @@ module Ronin
|
|
277
277
|
@not_after ||= if options[:not_after]
|
278
278
|
Time.parse(options[:not_after])
|
279
279
|
else
|
280
|
-
not_before+Support::Crypto::Cert::ONE_YEAR
|
280
|
+
not_before + Support::Crypto::Cert::ONE_YEAR
|
281
281
|
end
|
282
282
|
end
|
283
283
|
|
@@ -378,7 +378,7 @@ module Ronin
|
|
378
378
|
# @return [String, nil]
|
379
379
|
#
|
380
380
|
def subject_alt_name_ext
|
381
|
-
|
381
|
+
unless @subject_alt_names.empty?
|
382
382
|
@subject_alt_names.map { |name|
|
383
383
|
if name =~ IP_REGEXP
|
384
384
|
"IP: #{name}"
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'ronin/cli/value_processor_command'
|
20
|
+
require 'ronin/cli/host_and_port'
|
20
21
|
require 'ronin/support/network/ssl/mixin'
|
21
22
|
|
22
23
|
require 'uri'
|
@@ -49,6 +50,7 @@ module Ronin
|
|
49
50
|
#
|
50
51
|
class CertGrab < ValueProcessorCommand
|
51
52
|
|
53
|
+
include HostAndPort
|
52
54
|
include Support::Network::SSL::Mixin
|
53
55
|
|
54
56
|
usage '[options] {HOST:PORT | URL} ...'
|
@@ -63,7 +65,7 @@ module Ronin
|
|
63
65
|
examples [
|
64
66
|
'github.com:443',
|
65
67
|
'93.184.216.34:443',
|
66
|
-
'https://github.com/'
|
68
|
+
'https://github.com/'
|
67
69
|
]
|
68
70
|
|
69
71
|
man_page 'ronin-cert-grab.1'
|
@@ -77,14 +79,11 @@ module Ronin
|
|
77
79
|
def process_value(value)
|
78
80
|
case value
|
79
81
|
when /\A[^:]+:\d+\z/
|
80
|
-
host, port = value
|
81
|
-
port = port.to_i
|
82
|
+
host, port = host_and_port(value)
|
82
83
|
|
83
84
|
grab_cert(host,port)
|
84
85
|
when /\Ahttps:/
|
85
|
-
|
86
|
-
host = uri.host
|
87
|
-
port = uri.port
|
86
|
+
host, port = host_and_port_from_url(value)
|
88
87
|
|
89
88
|
grab_cert(host,port)
|
90
89
|
else
|
@@ -61,14 +61,14 @@ module Ronin
|
|
61
61
|
class Decode < StringMethodsCommand
|
62
62
|
|
63
63
|
option :base16, desc: 'Base16 decodes the data' do
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
require 'ronin/support/encoding/base16'
|
65
|
+
@method_calls << :base16_decode
|
66
|
+
end
|
67
67
|
|
68
68
|
option :base32, desc: 'Base32 decodes the data' do
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
require 'ronin/support/encoding/base32'
|
70
|
+
@method_calls << :base32_decode
|
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 decodes 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_decode, [mode]]
|
83
|
+
else
|
84
|
+
:base64_decode
|
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 decodes the data' do
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
require 'ronin/support/encoding/http'
|
126
|
+
@method_calls << :http_decode
|
127
|
+
end
|
128
128
|
|
129
129
|
option :js, short: '-j',
|
130
130
|
desc: 'JavaScript decodes the data' do
|
@@ -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
|