Skip to content

Commit

Permalink
Switch to Ruby 1.9 Hash syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Jan 23, 2013
1 parent f405124 commit 7ad0b2d
Show file tree
Hide file tree
Showing 77 changed files with 476 additions and 476 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Define a remote TCP exploit:
self.status = :potential
self.released = true

author :name => 'Postmodern', :organization => 'SophSec'
author name: 'Postmodern', organization: 'SophSec'

targeting do |t|
t.targets_arch :x86
Expand Down
2 changes: 1 addition & 1 deletion data/ronin/gen/exploits/_cache.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
self.reported = <%= @reported.inspect %>
<%- @authors.each do |author| -%>
author :name => <%= author.inspect %>
author name: <%= author.inspect %>
<%- end -%>

targeting do |t|
Expand Down
2 changes: 1 addition & 1 deletion data/ronin/gen/payloads/_cache.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

<% @authors.each do |author| %>
author :name => <%= author.inspect %>
author name: <%= author.inspect %>
<% end %>
<%- if arch? -%>
Expand Down
30 changes: 15 additions & 15 deletions lib/ronin/advisory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ class Advisory
property :id, Serial

# The publisher of the advisory
property :publisher, String, :required => true,
:format => /^[A-Z][A-Z0-9]+$/,
:unique_index => :publisher_version_number
property :publisher, String, required: true,
format: /^[A-Z][A-Z0-9]+$/,
unique_index: :publisher_version_number

# The year the advisory was published in
property :year, Integer, :unique_index => :publisher_version_number
property :year, Integer, unique_index: :publisher_version_number

# The number for the advisory
property :number, Integer, :required => true,
:unique_index => :publisher_version_number
property :number, Integer, required: true,
unique_index: :publisher_version_number

# The references to the advisory
has 0..n, :references, :model => 'Ronin::Exploits::Reference'
has 0..n, :references, model: 'Ronin::Exploits::Reference'

# The exploits for the advisory
has 0..n, :exploits, :through => :references,
:model => 'Ronin::Exploits::Exploit'
has 0..n, :exploits, through: :references,
model: 'Ronin::Exploits::Exploit'

#
# Splits an Advisory identifier String.
Expand Down Expand Up @@ -114,9 +114,9 @@ def self.parse(identifier)
publisher, year, number = split(identifier)

return first_or_new(
:publisher => publisher,
:year => year,
:number => number
publisher: publisher,
year: year,
number: number
)
end

Expand All @@ -139,9 +139,9 @@ def self.[](identifier)
publisher, year, number = split(identifier)

return first(
:publisher => publisher,
:year => year,
:number => number
publisher: publisher,
year: year,
number: number
)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/ronin/database/migrations/advisory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ module Migrations
create_table :ronin_advisories do
column :id, Serial

column :publisher, String, :not_null => true
column :publisher, String, not_null: true
column :year, Integer
column :number, Integer, :not_null => true
column :number, Integer, not_null: true
end

create_index :ronin_advisories, :publisher, :year, :number,
:name => :unique_index_ronin_advisories,
:unique => true
name: :unique_index_ronin_advisories,
unique: true
end

down do
Expand Down
10 changes: 5 additions & 5 deletions lib/ronin/database/migrations/encoders/encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ module Ronin
module Database
module Migrations
migration :create_encoders_table,
:needs => :create_script_paths_table do
needs: :create_script_paths_table do
up do
create_table :ronin_encoders_encoders do
column :id, Serial
column :type, String, :not_null => true
column :name, String, :not_null => true
column :type, String, not_null: true
column :name, String, not_null: true
column :description, Ronin::Model::Types::Description
column :arch_id, Integer
column :os_id, Integer
Expand All @@ -40,8 +40,8 @@ module Migrations

create_table :ronin_author_encoders_encoders do
column :id, Serial
column :author_id, Integer, :not_null => true
column :encoder_id, Integer, :not_null => true
column :author_id, Integer, not_null: true
column :encoder_id, Integer, not_null: true
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/ronin/database/migrations/exploits/author_exploit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ module Ronin
module Database
module Migrations
migration :create_author_exploits_table,
:needs => [
needs: [
:create_authors_table,
:create_exploits_table
] do
up do
create_table :ronin_author_exploits do
column :id, Serial
column :author_id, Integer, :not_null => true
column :exploit_id, Integer, :not_null => true
column :author_id, Integer, not_null: true
column :exploit_id, Integer, not_null: true
end
end

Expand Down
14 changes: 7 additions & 7 deletions lib/ronin/database/migrations/exploits/exploit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ module Ronin
module Database
module Migrations
migration :create_exploits_table,
:needs => [
needs: [
:create_licenses_table,
:create_script_paths_table
] do
up do
create_table :ronin_exploits_exploits do
column :id, Serial
column :type, String, :not_null => true
column :name, String, :not_null => true
column :type, String, not_null: true
column :name, String, not_null: true
column :description, Ronin::Model::Types::Description
column :version, String, :default => '0.1'
column :status, String, :default => 'potential'
column :released, Boolean, :default => false
column :reported, Boolean, :default => false
column :version, String, default: '0.1'
column :status, String, default: 'potential'
column :released, Boolean, default: false
column :reported, Boolean, default: false
column :license_id, Integer
column :script_path_id, Integer

Expand Down
6 changes: 3 additions & 3 deletions lib/ronin/database/migrations/exploits/reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ module Ronin
module Database
module Migrations
migration :create_exploits_references_table,
:needs => :create_exploits_table do
needs: :create_exploits_table do
up do
create_table :ronin_exploits_references do
column :id, Serial
column :advisory_id, Integer, :not_null => true
column :exploit_id, Integer, :not_null => true
column :advisory_id, Integer, not_null: true
column :exploit_id, Integer, not_null: true
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/ronin/database/migrations/exploits/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ module Ronin
module Database
module Migrations
migration :create_exploits_targets_table,
:needs => :create_exploits_table do
needs: :create_exploits_table do
up do
create_table :ronin_exploits_targets do
column :id, Serial
column :type, String, :not_null => true
column :type, String, not_null: true
column :description, Ronin::Model::Types::Description
column :params, Yaml
column :arch_id, Integer
column :os_id, Integer
column :software_id, Integer
column :exploit_id, Integer, :not_null => true
column :exploit_id, Integer, not_null: true

# needed by Exploits::Targets::BufferOverflow
column :buffer_length, Integer
Expand Down
6 changes: 3 additions & 3 deletions lib/ronin/database/migrations/payloads/author_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ module Ronin
module Database
module Migrations
migration :create_author_payloads_table,
:needs => [
needs: [
:create_authors_table,
:create_payloads_table
] do
up do
create_table :ronin_author_payloads do
column :id, Serial
column :author_id, Integer, :not_null => true
column :payload_id, Integer, :not_null => true
column :author_id, Integer, not_null: true
column :payload_id, Integer, not_null: true
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/ronin/database/migrations/payloads/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ module Ronin
module Database
module Migrations
migration :create_payloads_table,
:needs => [
needs: [
:create_licenses_table,
:create_script_paths_table
] do
up do
create_table :ronin_payloads_payloads do
column :id, Serial
column :type, String, :not_null => true
column :name, String, :not_null => true
column :type, String, not_null: true
column :name, String, not_null: true
column :description, Ronin::Model::Types::Description
column :version, String, :default => '0.1'
column :version, String, default: '0.1'
column :license_id, Integer
column :script_path_id, Integer
column :arch_id, Integer
Expand Down
2 changes: 1 addition & 1 deletion lib/ronin/database/migrations/vuln.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Ronin
module Database
module Migrations
migration :create_vulns_table,
:needs => [
needs: [
:create_addresses_table,
:create_open_ports_table,
:create_urls_table,
Expand Down
36 changes: 18 additions & 18 deletions lib/ronin/exploits/exploit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ module Exploits
# cache do
# # ...
#
# author :name => 'evoltech', :organization => 'HackBloc'
# author :name => 'postmodern', :organization => 'SophSec'
# author name: 'evoltech', organization: 'HackBloc'
# author name: 'postmodern', organization: 'SophSec'
# end
#
# ## Status
Expand Down Expand Up @@ -156,11 +156,11 @@ module Exploits
#
# targeting do |t|
# t.arch! :i686
# t.os! :name => 'Linux'
# t.software! :name => 'FailTTPd', :version => '0.2.6b'
# t.os! name: 'Linux'
# t.software! name: 'FailTTPd', version: '0.2.6b'
#
# # target specific data
# t.data = {:value1 => 0x03c1, :value2 => 0xa0}
# t.data = {value1: 0x03c1, value2: 0xa0}
# end
# end
#
Expand Down Expand Up @@ -191,7 +191,7 @@ module Exploits
# To use a cached payload, from the Ronin Database, simply use the
# {#use_payload!} method:
#
# exploit.use_payload!(:name.like => '%Bind Shell%')
# exploit.use_payload!(name.like: '%Bind Shell%')
#
# In order to use a payload, loaded directly from a file, call the
# {#use_payload_from!} method:
Expand Down Expand Up @@ -221,24 +221,24 @@ class Exploit

# The status of the exploit (either, 'potential', 'proven' or
# 'weaponized')
property :status, String, :set => [
property :status, String, set: [
'potential',
'proven',
'weaponized'
], :default => 'potential'
], default: 'potential'

# Specifies whether the exploit has been released
property :released, Boolean, :default => false
property :released, Boolean, default: false

# Specifies whether the exploit has been reported
property :reported, Boolean, :default => false
property :reported, Boolean, default: false

# Advisory References
has 0..n, :references

# Advisories for the vulnerability
has 0..n, :advisories, :through => :references,
:model => 'Ronin::Advisory'
has 0..n, :advisories, through: :references,
model: 'Ronin::Advisory'

# Targets for the exploit
has 0..n, :targets
Expand Down Expand Up @@ -385,7 +385,7 @@ def advisory(*identifiers)
# @example
# targeting do |t|
# t.arch! :i686
# t.os! :name => 'Linux'
# t.os! name: 'Linux'
# end
#
def targeting(attributes={},&block)
Expand Down Expand Up @@ -595,19 +595,19 @@ def targeting_software(software,version=nil)
# No matching target could be found.
#
# @example Targetting an Architecture
# use_target! :arch => :i686
# use_target! arch: :i686
#
# @example Targetting an Operating System
# use_target! :os => 'Linux'
# use_target! os: 'Linux'
#
# @example Targetting an Operating System and version
# use_target! :os => ['Linux', '2.6.24']
# use_target! os: ['Linux', '2.6.24']
#
# @example Targetting the Software
# use_target! :software => 'Lucene'
# use_target! software: 'Lucene'
#
# @example Targetting the Software name and version
# use_target! :software => ['Lucene', '1.8.0']
# use_target! software: ['Lucene', '1.8.0']
#
# @since 0.3.0
#
Expand Down
4 changes: 2 additions & 2 deletions lib/ronin/exploits/helpers/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ module Helpers
#
module Binary
UINTS = {
:little => {
little: {
1 => :uchar,
2 => :uint16_le,
4 => :uint32_le,
8 => :uint64_le
},

:big => {
big: {
1 => :uchar,
2 => :uint16_be,
4 => :uint32_be,
Expand Down
Loading

0 comments on commit 7ad0b2d

Please sign in to comment.