ronin 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +23 -0
- data/README.md +19 -13
- data/Rakefile +2 -1
- data/gemspec.yml +18 -17
- data/lib/bond/completions/ronin.rb +147 -0
- data/lib/ronin/auto_load.rb +30 -28
- data/lib/ronin/database/migrations/1.0.0.rb +1 -0
- data/lib/ronin/model/has_authors.rb +92 -2
- data/lib/ronin/model/has_description.rb +54 -2
- data/lib/ronin/model/has_license.rb +101 -2
- data/lib/ronin/model/has_name.rb +72 -2
- data/lib/ronin/model/has_title.rb +52 -2
- data/lib/ronin/model/has_unique_name.rb +93 -2
- data/lib/ronin/model/has_version.rb +58 -2
- data/lib/ronin/model/model.rb +91 -52
- data/lib/ronin/os.rb +30 -15
- data/lib/ronin/repository.rb +1 -1
- data/lib/ronin/ronin.rb +0 -15
- data/lib/ronin/script/script.rb +257 -2
- data/lib/ronin/ui/console.rb +2 -199
- data/lib/ronin/ui/console/commands.rb +164 -0
- data/lib/ronin/ui/console/console.rb +215 -0
- data/lib/ronin/ui/console/context.rb +95 -0
- data/lib/ronin/version.rb +1 -1
- data/spec/os_spec.rb +18 -13
- metadata +206 -239
- data/lib/ronin/class_methods.rb +0 -49
- data/lib/ronin/model/class_methods.rb +0 -58
- data/lib/ronin/model/has_authors/class_methods.rb +0 -60
- data/lib/ronin/model/has_authors/has_authors.rb +0 -70
- data/lib/ronin/model/has_description/class_methods.rb +0 -49
- data/lib/ronin/model/has_description/has_description.rb +0 -49
- data/lib/ronin/model/has_license/class_methods.rb +0 -68
- data/lib/ronin/model/has_license/has_license.rb +0 -71
- data/lib/ronin/model/has_name/class_methods.rb +0 -48
- data/lib/ronin/model/has_name/has_name.rb +0 -62
- data/lib/ronin/model/has_title/class_methods.rb +0 -48
- data/lib/ronin/model/has_title/has_title.rb +0 -48
- data/lib/ronin/model/has_unique_name/class_methods.rb +0 -51
- data/lib/ronin/model/has_unique_name/has_unique_name.rb +0 -78
- data/lib/ronin/model/has_version/class_methods.rb +0 -54
- data/lib/ronin/model/has_version/has_version.rb +0 -48
- data/lib/ronin/script/class_methods.rb +0 -84
- data/lib/ronin/script/instance_methods.rb +0 -217
data/lib/ronin/class_methods.rb
DELETED
@@ -1,49 +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
|
-
#
|
22
|
-
# Class methods that are included when {Ronin} is included.
|
23
|
-
#
|
24
|
-
module ClassMethods
|
25
|
-
#
|
26
|
-
# Catches missing constants and searches the {Ronin} namespace.
|
27
|
-
#
|
28
|
-
# @param [Symbol] name
|
29
|
-
# The constant name.
|
30
|
-
#
|
31
|
-
# @return [Object]
|
32
|
-
# The found constant.
|
33
|
-
#
|
34
|
-
# @raise [NameError]
|
35
|
-
# The constant could not be found within {Ronin}.
|
36
|
-
#
|
37
|
-
# @since 1.0.0
|
38
|
-
#
|
39
|
-
# @api semipublic
|
40
|
-
#
|
41
|
-
def const_missing(name)
|
42
|
-
begin
|
43
|
-
Ronin.send(:const_missing,name)
|
44
|
-
rescue NameError
|
45
|
-
super(name)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,58 +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/support/inflector'
|
21
|
-
|
22
|
-
module Ronin
|
23
|
-
module Model
|
24
|
-
#
|
25
|
-
# Class methods that are added when {Model} is included into a class.
|
26
|
-
#
|
27
|
-
module ClassMethods
|
28
|
-
#
|
29
|
-
# The default name to use when defining relationships with the
|
30
|
-
# model.
|
31
|
-
#
|
32
|
-
# @return [Symbol]
|
33
|
-
# The name to use in relationships.
|
34
|
-
#
|
35
|
-
# @since 1.0.0
|
36
|
-
#
|
37
|
-
# @api semipublic
|
38
|
-
#
|
39
|
-
def relationship_name
|
40
|
-
name = Support::Inflector.underscore(self.name.split('::').last)
|
41
|
-
|
42
|
-
return Support::Inflector.pluralize(name).to_sym
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Loads and initialize the resources.
|
47
|
-
#
|
48
|
-
# @api private
|
49
|
-
#
|
50
|
-
def load(records,query)
|
51
|
-
resources = super(records,query)
|
52
|
-
resources.each { |resource| resource.send :initialize }
|
53
|
-
|
54
|
-
return resources
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,60 +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 Model
|
22
|
-
module HasAuthors
|
23
|
-
#
|
24
|
-
# Class methods that are added when {HasAuthors} is included into a
|
25
|
-
# model.
|
26
|
-
#
|
27
|
-
module ClassMethods
|
28
|
-
#
|
29
|
-
# Finds all resources associated with a given author.
|
30
|
-
#
|
31
|
-
# @param [String] name
|
32
|
-
# The name of the author.
|
33
|
-
#
|
34
|
-
# @return [Array<Model>]
|
35
|
-
# The resources written by the author.
|
36
|
-
#
|
37
|
-
# @api public
|
38
|
-
#
|
39
|
-
def written_by(name)
|
40
|
-
all('authors.name.like' => "%#{name}%")
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Finds all resources associated with a given organization.
|
45
|
-
#
|
46
|
-
# @param [String] name
|
47
|
-
# The name of the organization.
|
48
|
-
#
|
49
|
-
# @return [Array<Model>]
|
50
|
-
# The resources associated with the organization.
|
51
|
-
#
|
52
|
-
# @api public
|
53
|
-
#
|
54
|
-
def written_for(name)
|
55
|
-
all('authors.organization.like' => "%#{name}%")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,70 +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/model/has_authors/class_methods'
|
21
|
-
require 'ronin/model/model'
|
22
|
-
require 'ronin/author'
|
23
|
-
|
24
|
-
module Ronin
|
25
|
-
module Model
|
26
|
-
#
|
27
|
-
# Adds an `authors` relationship between a model and the {Author} model.
|
28
|
-
#
|
29
|
-
module HasAuthors
|
30
|
-
#
|
31
|
-
# Adds the `authors` relationship and {ClassMethods} to the model.
|
32
|
-
#
|
33
|
-
# @param [Class] base
|
34
|
-
# The model.
|
35
|
-
#
|
36
|
-
# @api semipublic
|
37
|
-
#
|
38
|
-
def self.included(base)
|
39
|
-
base.send :include, Model
|
40
|
-
base.send :extend, ClassMethods
|
41
|
-
|
42
|
-
base.module_eval do
|
43
|
-
# The authors associated with the model.
|
44
|
-
has 0..n, :authors, Ronin::Author, :through => DataMapper::Resource
|
45
|
-
|
46
|
-
Ronin::Author.has 0..n, self.relationship_name,
|
47
|
-
:through => DataMapper::Resource,
|
48
|
-
:model => self
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
#
|
53
|
-
# Adds a new author to the resource.
|
54
|
-
#
|
55
|
-
# @param [Hash] attributes
|
56
|
-
# Additional attributes to create the new author.
|
57
|
-
#
|
58
|
-
# @example
|
59
|
-
# author :name => 'Anonymous',
|
60
|
-
# :email => 'anon@example.com',
|
61
|
-
# :organization => 'Anonymous LLC'
|
62
|
-
#
|
63
|
-
# @api public
|
64
|
-
#
|
65
|
-
def author(attributes)
|
66
|
-
self.authors.new(attributes)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,49 +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 Model
|
22
|
-
module HasDescription
|
23
|
-
#
|
24
|
-
# Class methods that are added when {HasDescription} is included into
|
25
|
-
# a model.
|
26
|
-
#
|
27
|
-
module ClassMethods
|
28
|
-
#
|
29
|
-
# Finds models with descriptions containing a given fragment of
|
30
|
-
# text.
|
31
|
-
#
|
32
|
-
# @param [String] fragment
|
33
|
-
# The fragment of text to match descriptions with.
|
34
|
-
#
|
35
|
-
# @return [Array<Model>]
|
36
|
-
# The found models.
|
37
|
-
#
|
38
|
-
# @example
|
39
|
-
# Exploit.describing 'bypass'
|
40
|
-
#
|
41
|
-
# @api public
|
42
|
-
#
|
43
|
-
def describing(fragment)
|
44
|
-
all(:description.like => "%#{fragment}%")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,49 +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/model/has_description/class_methods'
|
21
|
-
require 'ronin/model/types/description'
|
22
|
-
require 'ronin/model/model'
|
23
|
-
|
24
|
-
module Ronin
|
25
|
-
module Model
|
26
|
-
#
|
27
|
-
# Adds a `description` property to a model.
|
28
|
-
#
|
29
|
-
module HasDescription
|
30
|
-
#
|
31
|
-
# Adds the `description` property and {ClassMethods} to the model.
|
32
|
-
#
|
33
|
-
# @param [Class] base
|
34
|
-
# The model.
|
35
|
-
#
|
36
|
-
# @api semipublic
|
37
|
-
#
|
38
|
-
def self.included(base)
|
39
|
-
base.send :include, Model
|
40
|
-
base.send :extend, ClassMethods
|
41
|
-
|
42
|
-
base.module_eval do
|
43
|
-
# The description of the model
|
44
|
-
property :description, Model::Types::Description
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,68 +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 Model
|
22
|
-
module HasLicense
|
23
|
-
#
|
24
|
-
# Class methods that are added when {HasLicense} is included into a
|
25
|
-
# model.
|
26
|
-
#
|
27
|
-
module ClassMethods
|
28
|
-
#
|
29
|
-
# Finds all models associated with a given license.
|
30
|
-
#
|
31
|
-
# @param [License, Symbol, String] license
|
32
|
-
# The license which models are associated with.
|
33
|
-
#
|
34
|
-
# @return [Array<Model>]
|
35
|
-
# The models associated with a given license.
|
36
|
-
#
|
37
|
-
# @example Query using a predefined {License} resource.
|
38
|
-
# LicensedModel.licensed_under(License.mit)
|
39
|
-
# # => [#<Ronin::LicensedModel: ...>, ...]
|
40
|
-
#
|
41
|
-
# @example Query using the name of a predefined {License}.
|
42
|
-
# LicensedModel.licensed_under(:cc_by_nc)
|
43
|
-
# # => [#<Ronin::LicensedModel: ...>, ...]
|
44
|
-
#
|
45
|
-
# @example Query using the name of a {License}.
|
46
|
-
# LicensedModel.licensed_under('GPL-2')
|
47
|
-
# # => [#<Ronin::LicensedModel: ...>, ...]
|
48
|
-
#
|
49
|
-
# @since 1.0.0
|
50
|
-
#
|
51
|
-
# @api public
|
52
|
-
#
|
53
|
-
def licensed_under(license)
|
54
|
-
query = case license
|
55
|
-
when License
|
56
|
-
{:license => license}
|
57
|
-
when Symbol
|
58
|
-
{:license => License.predefined_resource(license)}
|
59
|
-
else
|
60
|
-
{'license.name' => license.to_s}
|
61
|
-
end
|
62
|
-
|
63
|
-
all(query)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,71 +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/model/has_license/class_methods'
|
21
|
-
require 'ronin/model/model'
|
22
|
-
require 'ronin/license'
|
23
|
-
|
24
|
-
module Ronin
|
25
|
-
module Model
|
26
|
-
#
|
27
|
-
# Adds a `license` relationship between a model and the {License} model.
|
28
|
-
#
|
29
|
-
module HasLicense
|
30
|
-
#
|
31
|
-
# Adds the `license` relationship and {ClassMethods} to the model.
|
32
|
-
#
|
33
|
-
# @param [Class] base
|
34
|
-
# The model.
|
35
|
-
#
|
36
|
-
# @api semipublic
|
37
|
-
#
|
38
|
-
def self.included(base)
|
39
|
-
base.send :include, Model
|
40
|
-
base.send :extend, ClassMethods
|
41
|
-
|
42
|
-
base.module_eval do
|
43
|
-
# The license
|
44
|
-
belongs_to :license, Ronin::License, :required => false
|
45
|
-
|
46
|
-
Ronin::License.has 0..n, self.relationship_name, :model => self
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
#
|
51
|
-
# Sets the license of the model.
|
52
|
-
#
|
53
|
-
# @param [Symbol, String] name
|
54
|
-
# The name of the license to use.
|
55
|
-
#
|
56
|
-
# @return [License]
|
57
|
-
# The new license of the model.
|
58
|
-
#
|
59
|
-
# @example
|
60
|
-
# license! :mit
|
61
|
-
#
|
62
|
-
# @since 1.0.0
|
63
|
-
#
|
64
|
-
# @api public
|
65
|
-
#
|
66
|
-
def license!(name)
|
67
|
-
self.license = Ronin::License.predefined_resource(name)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|