ronin 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +11 -0
  2. data/ChangeLog.md +28 -10
  3. data/Gemfile +1 -1
  4. data/README.md +14 -41
  5. data/Rakefile +3 -0
  6. data/gemspec.yml +14 -15
  7. data/lib/bond/completions/ronin.rb +0 -5
  8. data/lib/ronin/address.rb +17 -0
  9. data/lib/ronin/author.rb +1 -1
  10. data/lib/ronin/database/database.rb +11 -3
  11. data/lib/ronin/email_address.rb +33 -0
  12. data/lib/ronin/host_name.rb +57 -6
  13. data/lib/ronin/ip_address.rb +49 -5
  14. data/lib/ronin/license.rb +1 -1
  15. data/lib/ronin/mac_address.rb +39 -1
  16. data/lib/ronin/model/has_license.rb +12 -3
  17. data/lib/ronin/model/importable.rb +65 -0
  18. data/lib/ronin/repository.rb +12 -4
  19. data/lib/ronin/spec/database.rb +1 -1
  20. data/lib/ronin/tcp_port.rb +3 -12
  21. data/lib/ronin/udp_port.rb +2 -11
  22. data/lib/ronin/ui/cli/commands/emails.rb +0 -45
  23. data/lib/ronin/ui/cli/commands/hosts.rb +4 -31
  24. data/lib/ronin/ui/cli/commands/ips.rb +4 -30
  25. data/lib/ronin/ui/cli/commands/urls.rb +5 -45
  26. data/lib/ronin/ui/cli/model_command.rb +17 -27
  27. data/lib/ronin/ui/cli/resources_command.rb +25 -1
  28. data/lib/ronin/ui/cli/script_command.rb +1 -1
  29. data/lib/ronin/ui/console/context.rb +1 -1
  30. data/lib/ronin/url.rb +43 -1
  31. data/lib/ronin/version.rb +1 -1
  32. data/ronin.gemspec +1 -1
  33. data/spec/email_address_spec.rb +20 -0
  34. data/spec/host_name_spec.rb +20 -0
  35. data/spec/ip_address_spec.rb +104 -0
  36. data/spec/mac_address_spec.rb +20 -0
  37. data/spec/url_spec.rb +24 -0
  38. metadata +118 -155
  39. data/lib/ronin/network/mixins.rb +0 -27
  40. data/lib/ronin/network/mixins/esmtp.rb +0 -165
  41. data/lib/ronin/network/mixins/http.rb +0 -723
  42. data/lib/ronin/network/mixins/imap.rb +0 -151
  43. data/lib/ronin/network/mixins/pop3.rb +0 -141
  44. data/lib/ronin/network/mixins/smtp.rb +0 -159
  45. data/lib/ronin/network/mixins/tcp.rb +0 -331
  46. data/lib/ronin/network/mixins/telnet.rb +0 -199
  47. data/lib/ronin/network/mixins/udp.rb +0 -227
  48. data/lib/ronin/spec/ui/output.rb +0 -28
  49. data/lib/ronin/ui/output.rb +0 -21
  50. data/lib/ronin/ui/output/helpers.rb +0 -248
  51. data/lib/ronin/ui/output/output.rb +0 -146
  52. data/lib/ronin/ui/output/terminal.rb +0 -21
  53. data/lib/ronin/ui/output/terminal/color.rb +0 -118
  54. data/lib/ronin/ui/output/terminal/raw.rb +0 -103
  55. data/lib/ronin/ui/shell.rb +0 -92
  56. data/spec/ip_address.rb +0 -84
  57. data/spec/ui/output_spec.rb +0 -32
@@ -1,151 +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/network/imap'
21
- require 'ronin/ui/output/helpers'
22
- require 'ronin/mixin'
23
-
24
- require 'parameters'
25
-
26
- module Ronin
27
- module Network
28
- module Mixins
29
- #
30
- # Adds IMAP convenience methods and connection parameters to a class.
31
- #
32
- # Defines the following parameters:
33
- #
34
- # * `host` (`String`) - IMAP host.
35
- # * `port` (`Integer`) - IMAP port.
36
- # * `imap_auth` (`String`) - IMAP authentication method.
37
- # * `imap_user` (`String`) - IMAP user to login as.
38
- # * `imap_password` (`String`) - IMAP password to login with.
39
- #
40
- module IMAP
41
- include Mixin
42
-
43
- mixin UI::Output::Helpers, Parameters
44
-
45
- mixin do
46
- # IMAP host
47
- parameter :host, :type => String,
48
- :description => 'IMAP host'
49
-
50
- # IMAP port
51
- parameter :port, :type => Integer,
52
- :description => 'IMAP port'
53
-
54
- # IMAP auth
55
- parameter :imap_auth, :type => String,
56
- :description => 'IMAP authentication method'
57
-
58
- # IMAP user to login as
59
- parameter :imap_user, :type => String,
60
- :description => 'IMAP user to login as'
61
-
62
- # IMAP password to login with
63
- parameter :imap_password, :type => String,
64
- :description => 'IMAP password to login with'
65
- end
66
-
67
- protected
68
-
69
- #
70
- # Creates a connection to the IMAP server. The `host`, `port`,
71
- # `imap_auth`, `imap_user` and `imap_password` parameters
72
- # will also be used to make the connection.
73
- #
74
- # @param [Hash] options
75
- # Additional options.
76
- #
77
- # @option options [Integer] :port (IMAP.default_port)
78
- # The port the IMAP server is running on.
79
- #
80
- # @option options [String] :certs
81
- # The path to the file containing CA certs of the server.
82
- #
83
- # @option options [Symbol] :auth
84
- # The type of authentication to perform when connecting to the
85
- # server. May be either `:login` or `:cram_md5`.
86
- #
87
- # @option options [String] :user
88
- # The user to authenticate as when connecting to the server.
89
- #
90
- # @option options [String] :password
91
- # The password to authenticate with when connecting to the
92
- # server.
93
- #
94
- # @option options [Boolean]
95
- # Indicates wether or not to use SSL when connecting to the
96
- # server.
97
- #
98
- # @api public
99
- #
100
- def imap_connect(options={},&block)
101
- options[:port] ||= self.port
102
- options[:auth] ||= self.imap_auth
103
- options[:user] ||= self.imap_user
104
- options[:password] ||= self.imap_password
105
-
106
- if self.port
107
- print_info "Connecting to #{self.host}:#{self.port} ..."
108
- else
109
- print_info "Connecting to #{self.host} ..."
110
- end
111
-
112
- return ::Net.imap_connect(self.host,options,&block)
113
- end
114
-
115
- #
116
- # Starts a session with the IMAP server. The `host`, `port`,
117
- # `imap_auth`, `imap_user` and `imap_password` parameters
118
- # will also be used to make the connection.
119
- #
120
- # @yield [session]
121
- # If a block is given, it will be passed the newly created
122
- # IMAP session. After the block has returned, the session will
123
- # be closed.
124
- #
125
- # @yieldparam [Net::IMAP] session
126
- # The newly created IMAP session object.
127
- #
128
- # @see imap_connect
129
- #
130
- # @api public
131
- #
132
- def imap_session(options={})
133
- imap_connect(options) do |sess|
134
- yield sess if block_given?
135
-
136
- print_info "Logging out ..."
137
-
138
- sess.close
139
- sess.logout
140
-
141
- if self.port
142
- print_info "Disconnecting from #{self.host}:#{self.port}"
143
- else
144
- print_info "Disconnecting from #{self.host}"
145
- end
146
- end
147
- end
148
- end
149
- end
150
- end
151
- end
@@ -1,141 +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/network/pop3'
21
- require 'ronin/ui/output/helpers'
22
- require 'ronin/mixin'
23
-
24
- require 'parameters'
25
-
26
- module Ronin
27
- module Network
28
- module Mixins
29
- #
30
- # Adds POP3 convenience methods and connection parameters to a class.
31
- #
32
- # Defines the following parameters:
33
- #
34
- # * `host` (`String`) - POP3 host.
35
- # * `port` (`Integer`) - POP3 port.
36
- # * `pop3_user` (`String`) - POP3 user to login as.
37
- # * `pop3_password` (`String`) - POP3 password to login with.
38
- #
39
- module POP3
40
- include Mixin
41
-
42
- mixin UI::Output::Helpers, Parameters
43
-
44
- mixin do
45
- # POP3 host
46
- parameter :host, :type => String,
47
- :description => 'POP3 host'
48
-
49
- # POP3 port
50
- parameter :port, :type => Integer,
51
- :description => 'POP3 port'
52
-
53
- # POP3 user
54
- parameter :pop3_user, :type => String,
55
- :description => 'POP3 user to login as'
56
-
57
- # POP3 password
58
- parameter :pop3_password, :type => String,
59
- :description => 'POP3 password to login with'
60
- end
61
-
62
- protected
63
-
64
- #
65
- # Creates a connection to the POP3 server. The `host}, `port`,
66
- # `pop3_user` and `pop3_password` parameters will also be used
67
- # to connect to the server.
68
- #
69
- # @param [Hash] options
70
- # Additional options.
71
- #
72
- # @option options [Integer] :port (Ronin::Network::POP3.default_port)
73
- # The port the POP3 server is running on.
74
- #
75
- # @option options [String] :user
76
- # The user to authenticate with when connecting to the POP3
77
- # server.
78
- #
79
- # @option options [String] :password
80
- # The password to authenticate with when connecting to the POP3
81
- # server.
82
- #
83
- # @yield [session]
84
- # If a block is given, it will be passed the newly created
85
- # POP3 session.
86
- #
87
- # @yieldparam [Net::POP3] session
88
- # The newly created POP3 session.
89
- #
90
- # @return [Net::POP3]
91
- # The newly created POP3 session.
92
- #
93
- # @api public
94
- #
95
- def pop3_connect(options={},&block)
96
- options[:port] ||= self.port
97
- options[:user] ||= self.pop3_user
98
- options[:password] ||= self.pop3_password
99
-
100
- if self.port
101
- print_info "Connecting to #{self.host}:#{self.port} ..."
102
- else
103
- print_info "Connecting to #{self.host} ..."
104
- end
105
-
106
- return ::Net.pop3_connect(self.host,options,&block)
107
- end
108
-
109
- #
110
- # Starts a session with the POP3 server. The `host`, `port`,
111
- # `pop3_user` and `pop3_password` parameters will also be used
112
- # to connect to the server.
113
- #
114
- # @yield [session]
115
- # If a block is given, it will be passed the newly created
116
- # POP3 session. After the block has returned, the session
117
- # will be closed.
118
- #
119
- # @yieldparam [Net::POP3] session
120
- # The newly created POP3 session.
121
- #
122
- # @see pop3_connect
123
- #
124
- # @api public
125
- #
126
- def pop3_session(options={})
127
- pop3_connect(options) do |sess|
128
- yield sess if block_given?
129
- sess.finish
130
-
131
- if @port
132
- print_info "Disconnecting to #{self.host}:#{self.port}"
133
- else
134
- print_info "Disconnecting to #{self.host}"
135
- end
136
- end
137
- end
138
- end
139
- end
140
- end
141
- end
@@ -1,159 +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/network/smtp'
21
- require 'ronin/ui/output/helpers'
22
- require 'ronin/mixin'
23
-
24
- require 'parameters'
25
-
26
- module Ronin
27
- module Network
28
- module Mixins
29
- #
30
- # Adds SMTP convenience methods and connection parameters to a class.
31
- #
32
- # Defines the following parameters:
33
- #
34
- # * `host` (`String`) - SMTP host.
35
- # * `port` (`Integer`) - SMTP port.
36
- # * `smtp_login` (`String`) - SMTP authentication method.
37
- # * `smtp_user` (`String`) - SMTP user to login as.
38
- # * `smtp_password` (`String`) - SMTP password to login with.
39
- #
40
- module SMTP
41
- include Mixin
42
-
43
- mixin UI::Output::Helpers, Parameters
44
-
45
- mixin do
46
- # SMTP host
47
- parameter :host, :type => String,
48
- :description => 'SMTP host'
49
-
50
- # SMTP port
51
- parameter :port, :type => Integer,
52
- :description => 'SMTP port'
53
-
54
- # SMTP authentication method
55
- parameter :smtp_login, :type => String,
56
- :description => 'SMTP authentication method'
57
-
58
- # SMTP user to login as
59
- parameter :smtp_user, :type => String,
60
- :description => 'SMTP user to login as'
61
-
62
- # SMTP user to login with
63
- parameter :smtp_password, :type => String,
64
- :description => 'SMTP password to login with'
65
- end
66
-
67
- protected
68
-
69
- #
70
- # @see Ronin::Network::SMTP.message
71
- #
72
- # @api public
73
- #
74
- def smtp_message(options={},&block)
75
- Network::SMTP.message(options,&block)
76
- end
77
-
78
- #
79
- # Creates a connection to the SMTP server. The `host`, `port`,
80
- # `smtp_login`, `smtp_user` and `smtp_password` parameters
81
- # will also be used to connect to the server.
82
- #
83
- # @param [Hash] options
84
- # Additional options.
85
- #
86
- # @option options [Integer] :port (Ronin::Network::SMTP.default_port)
87
- # The port to connect to.
88
- #
89
- # @option options [String] :helo
90
- # The HELO domain.
91
- #
92
- # @option options [Symbol] :auth
93
- # The type of authentication to use. Can be either `:login`,
94
- # `:plain` or `:cram_md5`.
95
- #
96
- # @option options [String] :user
97
- # The user-name to authenticate with.
98
- #
99
- # @option options [String] :password
100
- # The password to authenticate with.
101
- #
102
- # @yield [session]
103
- # If a block is given, it will be passed an SMTP session object.
104
- #
105
- # @yieldparam [Net::SMTP] session
106
- # The SMTP session.
107
- #
108
- # @return [Net::SMTP]
109
- # The SMTP session.
110
- #
111
- # @api public
112
- #
113
- def smtp_connect(options={},&block)
114
- options[:port] ||= self.port
115
- options[:login] ||= self.smtp_login
116
- options[:user] ||= self.smtp_user
117
- options[:password] ||= self.smtp_password
118
-
119
- if self.port
120
- print_info "Connecting to #{self.host}:#{self.port} ..."
121
- else
122
- print_info "Connecting to #{self.host} ..."
123
- end
124
-
125
- return ::Net.smtp_connect(self.host,options,&block)
126
- end
127
-
128
- #
129
- # Starts a session with the SMTP server. The `host`, `port`,
130
- # `smtp_login`, `smtp_user` and `smtp_password` parameters
131
- # will also be used to connect to the server.
132
- #
133
- # @yield [session]
134
- # If a block is given, it will be passed an SMTP session object.
135
- # After the block has returned, the session will be closed.
136
- #
137
- # @yieldparam [Net::SMTP] session
138
- # The SMTP session.
139
- #
140
- # @see smtp_connect
141
- #
142
- # @api public
143
- #
144
- def smtp_session(options={},&block)
145
- smtp_connect(options) do |sess|
146
- yield sess if block_given?
147
- sess.close
148
-
149
- if self.port
150
- print_info "Disconnecting to #{self.host}:#{self.port}"
151
- else
152
- print_info "Disconnecting to #{self.host}"
153
- end
154
- end
155
- end
156
- end
157
- end
158
- end
159
- end