ronin 1.1.0.rc3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +10 -5
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +4 -4
- data/bin/ronin +2 -2
- data/bin/ronin-campaigns +2 -2
- data/bin/ronin-console +2 -2
- data/bin/ronin-creds +2 -2
- data/bin/ronin-database +2 -2
- data/bin/ronin-emails +2 -2
- data/bin/ronin-exec +2 -2
- data/bin/ronin-help +2 -2
- data/bin/ronin-hosts +2 -2
- data/bin/ronin-ips +2 -2
- data/bin/ronin-repos +2 -2
- data/bin/ronin-urls +2 -2
- data/gemspec.yml +2 -4
- data/lib/ronin/database/database.rb +12 -13
- data/lib/ronin/database/migrations.rb +2 -29
- data/lib/ronin/database/migrations/1.0.0.rb +568 -0
- data/lib/ronin/database/migrations/1.1.0.rb +125 -0
- data/lib/ronin/spec/database.rb +1 -4
- data/lib/ronin/target.rb +0 -19
- data/lib/ronin/ui/cli/cli.rb +1 -1
- data/lib/ronin/ui/cli/commands/database.rb +15 -22
- data/lib/ronin/ui/output/output.rb +1 -1
- data/lib/ronin/url.rb +23 -24
- data/lib/ronin/url_query_param.rb +4 -6
- data/lib/ronin/url_query_param_name.rb +89 -0
- data/lib/ronin/user_name.rb +0 -2
- data/lib/ronin/version.rb +1 -1
- data/ronin.gemspec +129 -13
- data/spec/host_name_spec.rb +9 -10
- data/spec/ip_address.rb +3 -3
- data/spec/url_query_param_spec.rb +5 -3
- data/spec/url_spec.rb +14 -9
- metadata +9 -35
- data/lib/ronin/database/migrations/add_created_at_column_to_targets_table.rb +0 -48
- data/lib/ronin/database/migrations/add_updated_at_column_to_campaigns_table.rb +0 -47
- data/lib/ronin/database/migrations/create_addresses_table.rb +0 -49
- data/lib/ronin/database/migrations/create_arches_table.rb +0 -43
- data/lib/ronin/database/migrations/create_authors_table.rb +0 -46
- data/lib/ronin/database/migrations/create_campaigns_table.rb +0 -43
- data/lib/ronin/database/migrations/create_countries_table.rb +0 -43
- data/lib/ronin/database/migrations/create_credentials_table.rb +0 -64
- data/lib/ronin/database/migrations/create_email_addresses_table.rb +0 -50
- data/lib/ronin/database/migrations/create_host_name_ip_addresses_table.rb +0 -50
- data/lib/ronin/database/migrations/create_ip_address_mac_addresses_table.rb +0 -50
- data/lib/ronin/database/migrations/create_licenses_table.rb +0 -43
- data/lib/ronin/database/migrations/create_open_ports_table.rb +0 -56
- data/lib/ronin/database/migrations/create_organizations_table.rb +0 -43
- data/lib/ronin/database/migrations/create_os_guesses_table.rb +0 -49
- data/lib/ronin/database/migrations/create_os_table.rb +0 -42
- data/lib/ronin/database/migrations/create_passwords_table.rb +0 -41
- data/lib/ronin/database/migrations/create_ports_table.rb +0 -47
- data/lib/ronin/database/migrations/create_proxies_table.rb +0 -54
- data/lib/ronin/database/migrations/create_repositories_table.rb +0 -60
- data/lib/ronin/database/migrations/create_script_paths_table.rb +0 -46
- data/lib/ronin/database/migrations/create_services_table.rb +0 -46
- data/lib/ronin/database/migrations/create_softwares_table.rb +0 -45
- data/lib/ronin/database/migrations/create_targets_table.rb +0 -49
- data/lib/ronin/database/migrations/create_url_query_params_table.rb +0 -41
- data/lib/ronin/database/migrations/create_url_schemes_table.rb +0 -39
- data/lib/ronin/database/migrations/create_urls_table.rb +0 -65
- data/lib/ronin/database/migrations/create_user_names_table.rb +0 -42
- data/lib/ronin/database/migrations/create_vendors_table.rb +0 -41
data/lib/ronin/user_name.rb
CHANGED
data/lib/ronin/version.rb
CHANGED
data/ronin.gemspec
CHANGED
@@ -1,15 +1,131 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gemspec|
|
6
|
+
root = File.dirname(__FILE__)
|
7
|
+
lib_dir = File.join(root,'lib')
|
8
|
+
files = if File.directory?('.git')
|
9
|
+
`git ls-files`.split($/)
|
10
|
+
elsif File.directory?('.hg')
|
11
|
+
`hg manifest`.split($/)
|
12
|
+
elsif File.directory?('.svn')
|
13
|
+
`svn ls -R`.split($/).select { |path| File.file?(path) }
|
14
|
+
else
|
15
|
+
Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
|
16
|
+
end
|
17
|
+
|
18
|
+
filter_files = lambda { |paths|
|
19
|
+
case paths
|
20
|
+
when Array
|
21
|
+
(files & paths)
|
22
|
+
when String
|
23
|
+
(files & Dir[paths])
|
24
|
+
end
|
25
|
+
}
|
26
|
+
|
27
|
+
version = {
|
28
|
+
:file => 'ronin/version',
|
29
|
+
:constant => 'Ronin::VERSION'
|
30
|
+
}
|
31
|
+
|
32
|
+
defaults = {
|
33
|
+
'name' => File.basename(root),
|
34
|
+
'files' => files,
|
35
|
+
'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
|
36
|
+
'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
|
37
|
+
'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
|
38
|
+
}
|
39
|
+
|
40
|
+
metadata = defaults.merge(YAML.load_file('gemspec.yml'))
|
41
|
+
|
42
|
+
gemspec.name = metadata.fetch('name',defaults[:name])
|
43
|
+
gemspec.version = if metadata['version']
|
44
|
+
metadata['version']
|
45
|
+
else
|
46
|
+
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
|
47
|
+
|
48
|
+
require version[:file]
|
49
|
+
eval(version[:constant])
|
50
|
+
end
|
51
|
+
|
52
|
+
gemspec.summary = metadata.fetch('summary',metadata['description'])
|
53
|
+
gemspec.description = metadata.fetch('description',metadata['summary'])
|
54
|
+
|
55
|
+
case metadata['license']
|
56
|
+
when Array
|
57
|
+
gemspec.licenses = metadata['license']
|
58
|
+
when String
|
59
|
+
gemspec.license = metadata['license']
|
60
|
+
end
|
61
|
+
|
62
|
+
case metadata['authors']
|
63
|
+
when Array
|
64
|
+
gemspec.authors = metadata['authors']
|
65
|
+
when String
|
66
|
+
gemspec.author = metadata['authors']
|
67
|
+
end
|
68
|
+
|
69
|
+
gemspec.email = metadata['email']
|
70
|
+
gemspec.homepage = metadata['homepage']
|
71
|
+
|
72
|
+
case metadata['require_paths']
|
73
|
+
when Array
|
74
|
+
gemspec.require_paths = metadata['require_paths']
|
75
|
+
when String
|
76
|
+
gemspec.require_path = metadata['require_paths']
|
77
|
+
end
|
78
|
+
|
79
|
+
gemspec.files = filter_files[metadata['files']]
|
80
|
+
|
81
|
+
gemspec.executables = metadata['executables']
|
82
|
+
gemspec.extensions = metadata['extensions']
|
83
|
+
|
84
|
+
if Gem::VERSION < '1.7.'
|
85
|
+
gemspec.default_executable = gemspec.executables.first
|
86
|
+
end
|
87
|
+
|
88
|
+
gemspec.test_files = filter_files[metadata['test_files']]
|
89
|
+
|
90
|
+
unless gemspec.files.include?('.document')
|
91
|
+
gemspec.extra_rdoc_files = metadata['extra_doc_files']
|
92
|
+
end
|
93
|
+
|
94
|
+
gemspec.post_install_message = metadata['post_install_message']
|
95
|
+
gemspec.requirements = metadata['requirements']
|
96
|
+
|
97
|
+
if gemspec.respond_to?(:required_ruby_version=)
|
98
|
+
gemspec.required_ruby_version = metadata['required_ruby_version']
|
99
|
+
end
|
100
|
+
|
101
|
+
if gemspec.respond_to?(:required_rubygems_version=)
|
102
|
+
gemspec.required_rubygems_version = metadata['required_ruby_version']
|
103
|
+
end
|
104
|
+
|
105
|
+
parse_versions = lambda { |versions|
|
106
|
+
case versions
|
107
|
+
when Array
|
108
|
+
versions.map { |v| v.to_s }
|
109
|
+
when String
|
110
|
+
versions.split(/,\s*/)
|
111
|
+
end
|
112
|
+
}
|
113
|
+
|
114
|
+
if metadata['dependencies']
|
115
|
+
metadata['dependencies'].each do |name,versions|
|
116
|
+
gemspec.add_dependency(name,parse_versions[versions])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
if metadata['runtime_dependencies']
|
121
|
+
metadata['runtime_dependencies'].each do |name,versions|
|
122
|
+
gemspec.add_runtime_dependency(name,parse_versions[versions])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
if metadata['development_dependencies']
|
127
|
+
metadata['development_dependencies'].each do |name,versions|
|
128
|
+
gemspec.add_development_dependency(name,parse_versions[versions])
|
129
|
+
end
|
14
130
|
end
|
15
131
|
end
|
data/spec/host_name_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
require 'ronin/host_name'
|
3
3
|
|
4
4
|
describe HostName do
|
5
|
-
let(:
|
6
|
-
let(:
|
5
|
+
let(:domain) { 'localhost' }
|
6
|
+
let(:ip) { '127.0.0.1' }
|
7
7
|
|
8
|
-
subject { HostName.new(:address =>
|
8
|
+
subject { HostName.new(:address => domain) }
|
9
9
|
|
10
10
|
it "should require an address" do
|
11
11
|
host_name = HostName.new
|
@@ -23,17 +23,16 @@ describe HostName do
|
|
23
23
|
let(:bad_ip) { '0.0.0.0' }
|
24
24
|
|
25
25
|
it "should look up the host names for an IP Address" do
|
26
|
-
host_names = subject.lookup(
|
26
|
+
host_names = subject.lookup(ip).map { |name| name.address }
|
27
27
|
|
28
|
-
host_names.
|
29
|
-
host_names[0].address.should == example_domain
|
28
|
+
host_names.should include(domain)
|
30
29
|
end
|
31
30
|
|
32
31
|
it "should associate the host names with the original IP address" do
|
33
|
-
host_names = subject.lookup(
|
32
|
+
host_names = subject.lookup(ip)
|
34
33
|
|
35
34
|
host_names.each do |host|
|
36
|
-
host.ip_addresses[0].address.should ==
|
35
|
+
host.ip_addresses[0].address.should == ip
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
@@ -51,14 +50,14 @@ describe HostName do
|
|
51
50
|
ips = subject.lookup!
|
52
51
|
|
53
52
|
ips.should_not be_empty
|
54
|
-
ips[0].address.should ==
|
53
|
+
ips[0].address.should == ip
|
55
54
|
end
|
56
55
|
|
57
56
|
it "should associate the IP addresses with the original host name" do
|
58
57
|
ips = subject.lookup!
|
59
58
|
|
60
59
|
ips.each do |ip|
|
61
|
-
ip.host_names[0].address.should ==
|
60
|
+
ip.host_names[0].address.should == domain
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
data/spec/ip_address.rb
CHANGED
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
2
2
|
require 'ronin/ip_address'
|
3
3
|
|
4
4
|
describe IPAddress do
|
5
|
-
let(:example_domain) { '
|
6
|
-
let(:example_ip) { '
|
5
|
+
let(:example_domain) { 'localhost' }
|
6
|
+
let(:example_ip) { '127.0.0.1' }
|
7
7
|
|
8
8
|
subject { IPAddress.new(:address => example_ip) }
|
9
9
|
|
@@ -67,7 +67,7 @@ describe IPAddress do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "#version" do
|
70
|
-
let(:ipv4) { IPAddress.new(:address => '
|
70
|
+
let(:ipv4) { IPAddress.new(:address => '127.0.0.1') }
|
71
71
|
let(:ipv6) { IPAddress.new(:address => '::1') }
|
72
72
|
|
73
73
|
it "should only accept 4 or 6" do
|
@@ -9,20 +9,22 @@ describe URLQueryParam do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#to_s" do
|
12
|
+
let(:name) { URLQueryParamName.new(:name => 'foo') }
|
13
|
+
|
12
14
|
it "should dump a name and a value into a String" do
|
13
|
-
param = URLQueryParam.new(:name =>
|
15
|
+
param = URLQueryParam.new(:name => name, :value => 'bar')
|
14
16
|
|
15
17
|
param.to_s.should == "foo=bar"
|
16
18
|
end
|
17
19
|
|
18
20
|
it "should ignore empty or nil values" do
|
19
|
-
param = URLQueryParam.new(:name =>
|
21
|
+
param = URLQueryParam.new(:name => name)
|
20
22
|
|
21
23
|
param.to_s.should == "foo="
|
22
24
|
end
|
23
25
|
|
24
26
|
it "should escape special characters" do
|
25
|
-
param = URLQueryParam.new(:name =>
|
27
|
+
param = URLQueryParam.new(:name => name, :value => 'bar baz')
|
26
28
|
|
27
29
|
param.to_s.should == "foo=bar%20baz"
|
28
30
|
end
|
data/spec/url_spec.rb
CHANGED
@@ -21,17 +21,22 @@ describe URL do
|
|
21
21
|
:fragment => fragment
|
22
22
|
)
|
23
23
|
|
24
|
-
@url = URL.
|
25
|
-
:scheme =>
|
26
|
-
:host_name =>
|
27
|
-
:port =>
|
24
|
+
@url = URL.new(
|
25
|
+
:scheme => URLScheme.first_or_create(:name => scheme),
|
26
|
+
:host_name => HostName.first_or_create(:address => host_name),
|
27
|
+
:port => TCPPort.first_or_create(:number => port),
|
28
28
|
:path => path,
|
29
|
-
:fragment => fragment
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
:fragment => fragment
|
30
|
+
)
|
31
|
+
|
32
|
+
@url.query_params.new(
|
33
|
+
:name => URLQueryParamName.first_or_create(
|
34
|
+
:name => query_params.keys[0]
|
35
|
+
),
|
36
|
+
:value => query_params.values[0]
|
34
37
|
)
|
38
|
+
|
39
|
+
@url.save
|
35
40
|
end
|
36
41
|
|
37
42
|
it "should have a host String" do
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 1.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: dm-sqlite-adapter
|
@@ -171,7 +171,7 @@ dependencies:
|
|
171
171
|
requirements:
|
172
172
|
- - ~>
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version: 0.3
|
174
|
+
version: "0.3"
|
175
175
|
type: :runtime
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: *id014
|
@@ -284,7 +284,7 @@ dependencies:
|
|
284
284
|
requirements:
|
285
285
|
- - ~>
|
286
286
|
- !ruby/object:Gem::Version
|
287
|
-
version: 0.2
|
287
|
+
version: "0.2"
|
288
288
|
type: :runtime
|
289
289
|
prerelease: false
|
290
290
|
version_requirements: *id024
|
@@ -393,35 +393,8 @@ files:
|
|
393
393
|
- lib/ronin/database/exceptions/invalid_config.rb
|
394
394
|
- lib/ronin/database/exceptions/unknown_repository.rb
|
395
395
|
- lib/ronin/database/migrations.rb
|
396
|
-
- lib/ronin/database/migrations/
|
397
|
-
- lib/ronin/database/migrations/
|
398
|
-
- lib/ronin/database/migrations/create_addresses_table.rb
|
399
|
-
- lib/ronin/database/migrations/create_arches_table.rb
|
400
|
-
- lib/ronin/database/migrations/create_authors_table.rb
|
401
|
-
- lib/ronin/database/migrations/create_campaigns_table.rb
|
402
|
-
- lib/ronin/database/migrations/create_countries_table.rb
|
403
|
-
- lib/ronin/database/migrations/create_credentials_table.rb
|
404
|
-
- lib/ronin/database/migrations/create_email_addresses_table.rb
|
405
|
-
- lib/ronin/database/migrations/create_host_name_ip_addresses_table.rb
|
406
|
-
- lib/ronin/database/migrations/create_ip_address_mac_addresses_table.rb
|
407
|
-
- lib/ronin/database/migrations/create_licenses_table.rb
|
408
|
-
- lib/ronin/database/migrations/create_open_ports_table.rb
|
409
|
-
- lib/ronin/database/migrations/create_organizations_table.rb
|
410
|
-
- lib/ronin/database/migrations/create_os_guesses_table.rb
|
411
|
-
- lib/ronin/database/migrations/create_os_table.rb
|
412
|
-
- lib/ronin/database/migrations/create_passwords_table.rb
|
413
|
-
- lib/ronin/database/migrations/create_ports_table.rb
|
414
|
-
- lib/ronin/database/migrations/create_proxies_table.rb
|
415
|
-
- lib/ronin/database/migrations/create_repositories_table.rb
|
416
|
-
- lib/ronin/database/migrations/create_script_paths_table.rb
|
417
|
-
- lib/ronin/database/migrations/create_services_table.rb
|
418
|
-
- lib/ronin/database/migrations/create_softwares_table.rb
|
419
|
-
- lib/ronin/database/migrations/create_targets_table.rb
|
420
|
-
- lib/ronin/database/migrations/create_url_query_params_table.rb
|
421
|
-
- lib/ronin/database/migrations/create_url_schemes_table.rb
|
422
|
-
- lib/ronin/database/migrations/create_urls_table.rb
|
423
|
-
- lib/ronin/database/migrations/create_user_names_table.rb
|
424
|
-
- lib/ronin/database/migrations/create_vendors_table.rb
|
396
|
+
- lib/ronin/database/migrations/1.0.0.rb
|
397
|
+
- lib/ronin/database/migrations/1.1.0.rb
|
425
398
|
- lib/ronin/database/migrations/exceptions.rb
|
426
399
|
- lib/ronin/database/migrations/exceptions/duplicate_migration.rb
|
427
400
|
- lib/ronin/database/migrations/exceptions/unknown_migration.rb
|
@@ -536,6 +509,7 @@ files:
|
|
536
509
|
- lib/ronin/ui/shell.rb
|
537
510
|
- lib/ronin/url.rb
|
538
511
|
- lib/ronin/url_query_param.rb
|
512
|
+
- lib/ronin/url_query_param_name.rb
|
539
513
|
- lib/ronin/url_scheme.rb
|
540
514
|
- lib/ronin/user_name.rb
|
541
515
|
- lib/ronin/vendor.rb
|
@@ -660,7 +634,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
660
634
|
requirements: []
|
661
635
|
|
662
636
|
rubyforge_project: ronin
|
663
|
-
rubygems_version: 1.8.
|
637
|
+
rubygems_version: 1.8.5
|
664
638
|
signing_key:
|
665
639
|
specification_version: 3
|
666
640
|
summary: A Ruby platform for exploit development and security research.
|
@@ -1,48 +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/database/migrations/create_targets_table'
|
21
|
-
require 'ronin/database/migrations/migrations'
|
22
|
-
require 'ronin/campaign'
|
23
|
-
require 'ronin/target'
|
24
|
-
|
25
|
-
module Ronin
|
26
|
-
module Database
|
27
|
-
module Migrations
|
28
|
-
migration(
|
29
|
-
:add_created_at_column_to_targets_table,
|
30
|
-
:needs => :create_targets_table
|
31
|
-
) do
|
32
|
-
up do
|
33
|
-
modify_table :ronin_targets do
|
34
|
-
add_column :created_at, Time
|
35
|
-
end
|
36
|
-
|
37
|
-
# set the updated_at column to the created_at of the Campaign
|
38
|
-
Target.each do |target|
|
39
|
-
target.update(:created_at => target.campaign.created_at)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
down do
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,47 +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/database/migrations/create_campaigns_table'
|
21
|
-
require 'ronin/database/migrations/migrations'
|
22
|
-
require 'ronin/campaign'
|
23
|
-
|
24
|
-
module Ronin
|
25
|
-
module Database
|
26
|
-
module Migrations
|
27
|
-
migration(
|
28
|
-
:add_updated_at_column_to_campaigns_table,
|
29
|
-
:needs => :create_campaigns_table
|
30
|
-
) do
|
31
|
-
up do
|
32
|
-
modify_table :ronin_campaigns do
|
33
|
-
add_column :updated_at, Time
|
34
|
-
end
|
35
|
-
|
36
|
-
# set the updated_at column to created_at
|
37
|
-
Campaign.each do |campaign|
|
38
|
-
campaign.update(:updated_at => campaign.created_at)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
down do
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|