ronin 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/ChangeLog.md +28 -10
- data/Gemfile +1 -1
- data/README.md +14 -41
- data/Rakefile +3 -0
- data/gemspec.yml +14 -15
- data/lib/bond/completions/ronin.rb +0 -5
- data/lib/ronin/address.rb +17 -0
- data/lib/ronin/author.rb +1 -1
- data/lib/ronin/database/database.rb +11 -3
- data/lib/ronin/email_address.rb +33 -0
- data/lib/ronin/host_name.rb +57 -6
- data/lib/ronin/ip_address.rb +49 -5
- data/lib/ronin/license.rb +1 -1
- data/lib/ronin/mac_address.rb +39 -1
- data/lib/ronin/model/has_license.rb +12 -3
- data/lib/ronin/model/importable.rb +65 -0
- data/lib/ronin/repository.rb +12 -4
- data/lib/ronin/spec/database.rb +1 -1
- data/lib/ronin/tcp_port.rb +3 -12
- data/lib/ronin/udp_port.rb +2 -11
- data/lib/ronin/ui/cli/commands/emails.rb +0 -45
- data/lib/ronin/ui/cli/commands/hosts.rb +4 -31
- data/lib/ronin/ui/cli/commands/ips.rb +4 -30
- data/lib/ronin/ui/cli/commands/urls.rb +5 -45
- data/lib/ronin/ui/cli/model_command.rb +17 -27
- data/lib/ronin/ui/cli/resources_command.rb +25 -1
- data/lib/ronin/ui/cli/script_command.rb +1 -1
- data/lib/ronin/ui/console/context.rb +1 -1
- data/lib/ronin/url.rb +43 -1
- data/lib/ronin/version.rb +1 -1
- data/ronin.gemspec +1 -1
- data/spec/email_address_spec.rb +20 -0
- data/spec/host_name_spec.rb +20 -0
- data/spec/ip_address_spec.rb +104 -0
- data/spec/mac_address_spec.rb +20 -0
- data/spec/url_spec.rb +24 -0
- metadata +118 -155
- data/lib/ronin/network/mixins.rb +0 -27
- data/lib/ronin/network/mixins/esmtp.rb +0 -165
- data/lib/ronin/network/mixins/http.rb +0 -723
- data/lib/ronin/network/mixins/imap.rb +0 -151
- data/lib/ronin/network/mixins/pop3.rb +0 -141
- data/lib/ronin/network/mixins/smtp.rb +0 -159
- data/lib/ronin/network/mixins/tcp.rb +0 -331
- data/lib/ronin/network/mixins/telnet.rb +0 -199
- data/lib/ronin/network/mixins/udp.rb +0 -227
- data/lib/ronin/spec/ui/output.rb +0 -28
- data/lib/ronin/ui/output.rb +0 -21
- data/lib/ronin/ui/output/helpers.rb +0 -248
- data/lib/ronin/ui/output/output.rb +0 -146
- data/lib/ronin/ui/output/terminal.rb +0 -21
- data/lib/ronin/ui/output/terminal/color.rb +0 -118
- data/lib/ronin/ui/output/terminal/raw.rb +0 -103
- data/lib/ronin/ui/shell.rb +0 -92
- data/spec/ip_address.rb +0 -84
- data/spec/ui/output_spec.rb +0 -32
@@ -1,146 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
require 'ronin/ui/output/terminal/raw'
|
21
|
-
require 'ronin/ui/output/terminal/color'
|
22
|
-
|
23
|
-
module Ronin
|
24
|
-
module UI
|
25
|
-
#
|
26
|
-
# Controls {Output} from Ronin.
|
27
|
-
#
|
28
|
-
module Output
|
29
|
-
@mode = if ($VERBOSE || $DEBUG || ENV['VERBOSE'])
|
30
|
-
:verbose
|
31
|
-
else
|
32
|
-
:quiet
|
33
|
-
end
|
34
|
-
|
35
|
-
@handler = if STDOUT.tty?
|
36
|
-
Terminal::Color
|
37
|
-
else
|
38
|
-
Terminal::Raw
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# @return [Boolean]
|
43
|
-
# Specifies whether verbose output is enabled.
|
44
|
-
#
|
45
|
-
# @since 0.3.0
|
46
|
-
#
|
47
|
-
# @api semipublic
|
48
|
-
#
|
49
|
-
def Output.verbose?
|
50
|
-
@mode == :verbose
|
51
|
-
end
|
52
|
-
|
53
|
-
#
|
54
|
-
# @return [Boolean]
|
55
|
-
# Specifies whether quiet output is enabled.
|
56
|
-
#
|
57
|
-
# @since 0.3.0
|
58
|
-
#
|
59
|
-
# @api semipublic
|
60
|
-
#
|
61
|
-
def Output.quiet?
|
62
|
-
@mode == :quiet
|
63
|
-
end
|
64
|
-
|
65
|
-
#
|
66
|
-
# @return [Boolean]
|
67
|
-
# Specifies whether silent output is enabled.
|
68
|
-
#
|
69
|
-
# @since 0.3.0
|
70
|
-
#
|
71
|
-
# @api semipublic
|
72
|
-
#
|
73
|
-
def Output.silent?
|
74
|
-
@mode == :silent
|
75
|
-
end
|
76
|
-
|
77
|
-
#
|
78
|
-
# Enables verbose output.
|
79
|
-
#
|
80
|
-
# @return [Output]
|
81
|
-
#
|
82
|
-
# @since 1.0.0
|
83
|
-
#
|
84
|
-
# @api semipublic
|
85
|
-
#
|
86
|
-
def Output.verbose!
|
87
|
-
@mode = :verbose
|
88
|
-
return self
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# Disables verbose output.
|
93
|
-
#
|
94
|
-
# @return [Output]
|
95
|
-
#
|
96
|
-
# @since 1.0.0
|
97
|
-
#
|
98
|
-
# @api semipublic
|
99
|
-
#
|
100
|
-
def Output.quiet!
|
101
|
-
@mode = :quiet
|
102
|
-
return self
|
103
|
-
end
|
104
|
-
|
105
|
-
#
|
106
|
-
# Disables all output.
|
107
|
-
#
|
108
|
-
# @return [Output]
|
109
|
-
#
|
110
|
-
# @since 1.0.0
|
111
|
-
#
|
112
|
-
def Output.silent!
|
113
|
-
@mode = :silent
|
114
|
-
return self
|
115
|
-
end
|
116
|
-
|
117
|
-
#
|
118
|
-
# @return [Ronin::UI::Output::Handler]
|
119
|
-
# The current Output handler.
|
120
|
-
#
|
121
|
-
# @since 0.3.0
|
122
|
-
#
|
123
|
-
# @api semipublic
|
124
|
-
#
|
125
|
-
def Output.handler
|
126
|
-
@handler
|
127
|
-
end
|
128
|
-
|
129
|
-
#
|
130
|
-
# Sets the current Output handler.
|
131
|
-
#
|
132
|
-
# @param [Handler] new_handler
|
133
|
-
# The new output handler to use. Must provide the `puts`,
|
134
|
-
# `print_info`, `print_debug`, `print_warning` and `print_error`
|
135
|
-
# class methods.
|
136
|
-
#
|
137
|
-
# @since 0.3.0
|
138
|
-
#
|
139
|
-
# @api semipublic
|
140
|
-
#
|
141
|
-
def Output.handler=(new_handler)
|
142
|
-
@handler = new_handler
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
require 'ronin/ui/output/terminal/raw'
|
21
|
-
require 'ronin/ui/output/terminal/color'
|
@@ -1,118 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Ronin
|
21
|
-
module UI
|
22
|
-
module Output
|
23
|
-
module Terminal
|
24
|
-
#
|
25
|
-
# The handler for color output to the terminal.
|
26
|
-
#
|
27
|
-
class Color
|
28
|
-
|
29
|
-
# ANSI Green code
|
30
|
-
GREEN = "\e[32m"
|
31
|
-
|
32
|
-
# ANSI Cyan code
|
33
|
-
CYAN = "\e[36m"
|
34
|
-
|
35
|
-
# ANSI Yellow code
|
36
|
-
YELLOW = "\e[33m"
|
37
|
-
|
38
|
-
# ANSI Red code
|
39
|
-
RED = "\e[31m"
|
40
|
-
|
41
|
-
# ANSI Clear code
|
42
|
-
CLEAR = "\e[0m"
|
43
|
-
|
44
|
-
#
|
45
|
-
# Writes data to `STDOUT`.
|
46
|
-
#
|
47
|
-
# @param [String] data
|
48
|
-
# The data to write.
|
49
|
-
#
|
50
|
-
# @since 1.0.0
|
51
|
-
#
|
52
|
-
# @api private
|
53
|
-
#
|
54
|
-
def self.write(data)
|
55
|
-
STDOUT.write(data)
|
56
|
-
end
|
57
|
-
|
58
|
-
#
|
59
|
-
# Prints an `info` message.
|
60
|
-
#
|
61
|
-
# @param [String] message
|
62
|
-
# The message to print.
|
63
|
-
#
|
64
|
-
# @since 1.0.0
|
65
|
-
#
|
66
|
-
# @api private
|
67
|
-
#
|
68
|
-
def self.print_info(message)
|
69
|
-
puts "#{GREEN}[-] #{message}#{CLEAR}"
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Prints a `debug` message.
|
74
|
-
#
|
75
|
-
# @param [String] message
|
76
|
-
# The message to print.
|
77
|
-
#
|
78
|
-
# @since 1.0.0
|
79
|
-
#
|
80
|
-
# @api private
|
81
|
-
#
|
82
|
-
def self.print_debug(message)
|
83
|
-
puts "#{CYAN}[=] #{message}#{CLEAR}"
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Prints a `warning` message.
|
88
|
-
#
|
89
|
-
# @param [String] message
|
90
|
-
# The message to print.
|
91
|
-
#
|
92
|
-
# @since 1.0.0
|
93
|
-
#
|
94
|
-
# @api private
|
95
|
-
#
|
96
|
-
def self.print_warning(message)
|
97
|
-
puts "#{YELLOW}[*] #{message}#{CLEAR}"
|
98
|
-
end
|
99
|
-
|
100
|
-
#
|
101
|
-
# Prints an `error` message.
|
102
|
-
#
|
103
|
-
# @param [String] message
|
104
|
-
# The message to print.
|
105
|
-
#
|
106
|
-
# @since 1.0.0
|
107
|
-
#
|
108
|
-
# @api private
|
109
|
-
#
|
110
|
-
def self.print_error(message)
|
111
|
-
puts "#{RED}[!] #{message}#{CLEAR}"
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Ronin
|
21
|
-
module UI
|
22
|
-
module Output
|
23
|
-
module Terminal
|
24
|
-
#
|
25
|
-
# The handler for raw output to the terminal.
|
26
|
-
#
|
27
|
-
class Raw
|
28
|
-
|
29
|
-
#
|
30
|
-
# Writes data to `STDOUT`.
|
31
|
-
#
|
32
|
-
# @param [String] data
|
33
|
-
# The data to write.
|
34
|
-
#
|
35
|
-
# @since 1.0.0
|
36
|
-
#
|
37
|
-
# @api private
|
38
|
-
#
|
39
|
-
def self.write(data)
|
40
|
-
STDOUT.write(data)
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Prints an `info` message.
|
45
|
-
#
|
46
|
-
# @param [String] message
|
47
|
-
# The message to print.
|
48
|
-
#
|
49
|
-
# @since 1.0.0
|
50
|
-
#
|
51
|
-
# @api private
|
52
|
-
#
|
53
|
-
def self.print_info(message)
|
54
|
-
puts "[-] #{message}"
|
55
|
-
end
|
56
|
-
|
57
|
-
#
|
58
|
-
# Prints a `debug` message.
|
59
|
-
#
|
60
|
-
# @param [String] message
|
61
|
-
# The message to print.
|
62
|
-
#
|
63
|
-
# @since 1.0.0
|
64
|
-
#
|
65
|
-
# @api private
|
66
|
-
#
|
67
|
-
def self.print_debug(message)
|
68
|
-
puts "[=] #{message}"
|
69
|
-
end
|
70
|
-
|
71
|
-
#
|
72
|
-
# Prints a `warning` message.
|
73
|
-
#
|
74
|
-
# @param [String] message
|
75
|
-
# The message to print.
|
76
|
-
#
|
77
|
-
# @since 1.0.0
|
78
|
-
#
|
79
|
-
# @api private
|
80
|
-
#
|
81
|
-
def self.print_warning(message)
|
82
|
-
puts "[*] #{message}"
|
83
|
-
end
|
84
|
-
|
85
|
-
#
|
86
|
-
# Prints an `error` messages.
|
87
|
-
#
|
88
|
-
# @param [String] message
|
89
|
-
# The message to print.
|
90
|
-
#
|
91
|
-
# @since 1.0.0
|
92
|
-
#
|
93
|
-
# @api private
|
94
|
-
#
|
95
|
-
def self.print_error(message)
|
96
|
-
puts "[!] #{message}"
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
data/lib/ronin/ui/shell.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
require 'ronin/ui/output/helpers'
|
21
|
-
|
22
|
-
module Ronin
|
23
|
-
module UI
|
24
|
-
#
|
25
|
-
# Spawns a ReadLine powered interactive Shell.
|
26
|
-
#
|
27
|
-
module Shell
|
28
|
-
|
29
|
-
extend Output::Helpers
|
30
|
-
|
31
|
-
# Default shell prompt
|
32
|
-
DEFAULT_PROMPT = '>'
|
33
|
-
|
34
|
-
#
|
35
|
-
# Creates a new Shell object and starts it.
|
36
|
-
#
|
37
|
-
# @param [Hash] options
|
38
|
-
# Additional options.
|
39
|
-
#
|
40
|
-
# @option options [String] :name ('')
|
41
|
-
# The shell-name to use before the prompt.
|
42
|
-
#
|
43
|
-
# @option options [String] :prompt (DEFAULT_PROMPT)
|
44
|
-
# The prompt to use for the shell.
|
45
|
-
#
|
46
|
-
# @yield [shell, line]
|
47
|
-
# The block that will be passed every command entered.
|
48
|
-
#
|
49
|
-
# @yieldparam [Shell] shell
|
50
|
-
# The shell to use for output.
|
51
|
-
#
|
52
|
-
# @yieldparam [String] line
|
53
|
-
# The command entered into the shell.
|
54
|
-
#
|
55
|
-
# @return [nil]
|
56
|
-
#
|
57
|
-
# @example
|
58
|
-
# Shell.start(:prompt => '$') { |shell,line| system(line) }
|
59
|
-
#
|
60
|
-
# @api semipublic
|
61
|
-
#
|
62
|
-
def Shell.start(options={},&block)
|
63
|
-
name = (options[:name] || '')
|
64
|
-
prompt = (options[:prompt] || DEFAULT_PROMPT)
|
65
|
-
|
66
|
-
history_rollback = 0
|
67
|
-
|
68
|
-
loop do
|
69
|
-
raw_line = Readline.readline("#{name}#{prompt} ")
|
70
|
-
line = raw_line.strip
|
71
|
-
|
72
|
-
if line =~ /^(exit|quit)$/
|
73
|
-
break
|
74
|
-
elsif !(line.empty?)
|
75
|
-
Readline::HISTORY << raw_line
|
76
|
-
history_rollback += 1
|
77
|
-
|
78
|
-
begin
|
79
|
-
yield self, line
|
80
|
-
rescue => e
|
81
|
-
puts "#{e.class.name}: #{e.message}"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
history_rollback.times { Readline::HISTORY.pop }
|
87
|
-
return nil
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|