metasploit_data_models 0.23.1 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/mdm/host.rb +42 -33
  3. data/app/models/mdm/loot.rb +9 -0
  4. data/app/models/mdm/module/detail.rb +28 -7
  5. data/app/models/mdm/module/ref.rb +4 -4
  6. data/app/models/mdm/ref.rb +5 -5
  7. data/app/models/mdm/session.rb +18 -1
  8. data/app/models/mdm/user.rb +13 -0
  9. data/app/models/mdm/vuln.rb +16 -7
  10. data/app/models/mdm/workspace.rb +16 -8
  11. data/app/models/metasploit_data_models/automatic_exploitation.rb +5 -0
  12. data/app/models/metasploit_data_models/automatic_exploitation/match.rb +42 -0
  13. data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +40 -0
  14. data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +30 -0
  15. data/app/models/metasploit_data_models/automatic_exploitation/run.rb +27 -0
  16. data/app/models/metasploit_data_models/module_run.rb +213 -0
  17. data/app/validators/password_is_strong_validator.rb +5 -5
  18. data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +13 -0
  19. data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +12 -0
  20. data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +11 -0
  21. data/db/migrate/20131011184338_module_detail_on_automatic_exploitation_match.rb +10 -0
  22. data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +11 -0
  23. data/db/migrate/20131021185657_make_match_polymorphic.rb +11 -0
  24. data/db/migrate/20150219173821_create_module_runs.rb +23 -0
  25. data/db/migrate/20150219215039_add_module_run_to_session.rb +8 -0
  26. data/db/migrate/20150226151459_add_module_run_fk_to_loot.rb +8 -0
  27. data/db/migrate/20150312155312_add_module_full_name_to_match.rb +6 -0
  28. data/db/migrate/20150326183742_add_missing_ae_indices.rb +13 -0
  29. data/lib/metasploit_data_models/version.rb +1 -1
  30. data/spec/app/models/mdm/host_spec.rb +28 -27
  31. data/spec/app/models/mdm/loot_spec.rb +1 -0
  32. data/spec/app/models/mdm/module/detail_spec.rb +2 -2
  33. data/spec/app/models/mdm/session_spec.rb +21 -18
  34. data/spec/app/models/mdm/vuln_spec.rb +9 -10
  35. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +88 -0
  36. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +48 -0
  37. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +25 -0
  38. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +40 -0
  39. data/spec/app/models/metasploit_data_models/module_run_spec.rb +136 -0
  40. data/spec/dummy/db/structure.sql +369 -2
  41. data/spec/factories/mdm/module/details.rb +21 -21
  42. data/spec/factories/metasploit_data_models/automatic_exploitation/match_results.rb +7 -0
  43. data/spec/factories/metasploit_data_models/automatic_exploitation/match_sets.rb +8 -0
  44. data/spec/factories/metasploit_data_models/automatic_exploitation/matches.rb +6 -0
  45. data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +6 -0
  46. data/spec/factories/module_runs.rb +40 -0
  47. metadata +30 -172
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetasploitDataModels::AutomaticExploitation::Match do
4
+ it_should_behave_like 'Metasploit::Concern.run'
5
+
6
+ describe "associations" do
7
+ describe "connecting to a Mdm::Module::Detail" do
8
+ let(:vuln){ FactoryGirl.create(:mdm_vuln) }
9
+ let(:module_detail){FactoryGirl.create(:mdm_module_detail)}
10
+
11
+ subject(:automatic_exploitation_match){ described_class.new }
12
+
13
+ before(:each ) do
14
+ automatic_exploitation_match.matchable = vuln
15
+ automatic_exploitation_match.module_fullname = module_detail.fullname
16
+ automatic_exploitation_match.save!
17
+ end
18
+
19
+ it 'should point to the Mdm::Module::Detail with a fullname corresponding to #module_fullname' do
20
+ expect(automatic_exploitation_match.module_detail).to eq(module_detail)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetasploitDataModels::AutomaticExploitation::Run do
4
+ subject(:run) { FactoryGirl.create(:automatic_exploitation_run) }
5
+
6
+
7
+ describe "database" do
8
+ describe "columns" do
9
+ it { is_expected.to have_db_column(:workspace_id).of_type(:integer) }
10
+ it { is_expected.to have_db_index(:workspace_id) }
11
+ it { is_expected.to have_db_column(:user_id).of_type(:integer) }
12
+ it { is_expected.to have_db_index(:user_id) }
13
+ end
14
+ end
15
+
16
+ describe "associations" do
17
+ it { is_expected.to belong_to(:match_set).class_name('MetasploitDataModels::AutomaticExploitation::MatchSet') }
18
+ it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
19
+ it { is_expected.to belong_to(:workspace).inverse_of(:automatic_exploitation_runs) }
20
+ it { is_expected.to belong_to(:user).class_name('Mdm::User') }
21
+ it { is_expected.to belong_to(:user).inverse_of(:automatic_exploitation_runs) }
22
+ it { is_expected.to have_many(:match_results) }
23
+ end
24
+
25
+ describe "destroying" do
26
+ describe "associated MatchResults" do
27
+ before(:each) do
28
+ match_set = FactoryGirl.create(:automatic_exploitation_match_set)
29
+ match = FactoryGirl.create(:automatic_exploitation_match, match_set: match_set)
30
+ run.match_set = match_set
31
+ FactoryGirl.create(:automatic_exploitation_match_result, match: match, run: run)
32
+ end
33
+
34
+ it 'should happen when you delete the Run' do
35
+ expect { run.destroy }.to change { MetasploitDataModels::AutomaticExploitation::MatchResult.count }.by(-1)
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,136 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetasploitDataModels::ModuleRun do
4
+
5
+ subject(:module_run){FactoryGirl.build(:metasploit_data_models_module_run)}
6
+
7
+ context "database columns" do
8
+ it { is_expected.to have_db_column(:attempted_at).of_type(:datetime) }
9
+ it { is_expected.to have_db_column(:fail_detail).of_type(:text) }
10
+ it { is_expected.to have_db_column(:fail_reason).of_type(:string) }
11
+ it { is_expected.to have_db_column(:module_fullname).of_type(:text) }
12
+ it { is_expected.to have_db_column(:port).of_type(:integer) }
13
+ it { is_expected.to have_db_column(:proto).of_type(:string) }
14
+ it { is_expected.to have_db_column(:session_id).of_type(:integer) }
15
+ it { is_expected.to have_db_column(:status).of_type(:string) }
16
+ it { is_expected.to have_db_column(:trackable_id).of_type(:integer) }
17
+ it { is_expected.to have_db_column(:trackable_type).of_type(:string) }
18
+ it { is_expected.to have_db_column(:user_id).of_type(:integer) }
19
+ it { is_expected.to have_db_column(:username).of_type(:string) }
20
+ end
21
+
22
+ context "associations" do
23
+ it { is_expected.to belong_to(:user).class_name('Mdm::User') }
24
+ it { is_expected.to belong_to(:user).inverse_of(:module_runs) }
25
+ it { is_expected.to belong_to(:target_session).class_name('Mdm::Session') }
26
+ it { is_expected.to belong_to(:target_session).inverse_of(:target_module_runs) }
27
+ it { is_expected.to belong_to(:trackable) }
28
+ it { is_expected.to belong_to(:module_detail).class_name('Mdm::Module::Detail') }
29
+ it { is_expected.to belong_to(:module_detail).inverse_of(:module_runs) }
30
+ it { is_expected.to have_many(:loots).class_name('Mdm::Loot') }
31
+ it { is_expected.to have_many(:loots).inverse_of(:module_run) }
32
+ it { is_expected.to have_one(:spawned_session).class_name('Mdm::Session') }
33
+ it { is_expected.to have_one(:spawned_session).inverse_of(:originating_module_run) }
34
+ end
35
+
36
+ context "validations" do
37
+ describe "when a target_session is set on the module run" do
38
+ before(:each) do
39
+ module_run.target_session = FactoryGirl.build(:mdm_session)
40
+ end
41
+
42
+ context "when the module is an exploit" do
43
+ context "and that exploit IS NOT local" do
44
+ before(:each) do
45
+ module_run.module_fullname = 'exploit/windows/mah-crazy-exploit'
46
+ end
47
+
48
+ it { is_expected.to_not be_valid }
49
+ end
50
+
51
+ context "and that exploit IS local" do
52
+ before(:each) do
53
+ module_run.module_fullname = 'exploit/windows/local/mah-crazy-exploit'
54
+ end
55
+
56
+ it { is_expected.to be_valid }
57
+ end
58
+ end
59
+ end
60
+
61
+ describe "when a spawned_session is set on the module run" do
62
+ before(:each) do
63
+ module_run.spawned_session = FactoryGirl.build(:mdm_session)
64
+ end
65
+
66
+ context "when the module is not an exploit" do
67
+
68
+ context "and it IS NOT a login scanner" do
69
+ before(:each) do
70
+ module_run.module_fullname = 'post/multi/gather/steal-minecraft-maps'
71
+ end
72
+
73
+ it { is_expected.to_not be_valid }
74
+ end
75
+
76
+ context "and it IS a login scanner" do
77
+ before(:each) do
78
+ module_run.module_fullname = 'auxiliary/scanner/ssh/ssh_login'
79
+ end
80
+
81
+ it { is_expected.to be_valid }
82
+ end
83
+ end
84
+ end
85
+
86
+ describe "attempted_at" do
87
+ before(:each){ module_run.attempted_at = nil }
88
+
89
+ it { is_expected.to_not be_valid }
90
+ end
91
+
92
+ describe "content information" do
93
+ context "when there is no module_name" do
94
+ before(:each) do
95
+ module_run.module_fullname = nil
96
+ end
97
+
98
+ it { is_expected.to_not be_valid }
99
+ end
100
+ end
101
+
102
+
103
+ describe "status" do
104
+ describe "invalidity" do
105
+ before(:each) do
106
+ module_run.status = "invalid nonsense"
107
+ end
108
+
109
+ it { expect(module_run).to_not be_valid}
110
+ end
111
+
112
+ describe "validity" do
113
+ context "when the module run succeeded" do
114
+ before(:each){ module_run.status = MetasploitDataModels::ModuleRun::SUCCEED}
115
+
116
+ it{ expect(module_run).to be_valid }
117
+ end
118
+
119
+ context "when the module run went normally but failed" do
120
+ before(:each){ module_run.status = MetasploitDataModels::ModuleRun::FAIL}
121
+
122
+ it{ expect(module_run).to be_valid }
123
+ end
124
+
125
+ context "when the module run errored out" do
126
+ before(:each){ module_run.status = MetasploitDataModels::ModuleRun::ERROR}
127
+
128
+ it{ expect(module_run).to be_valid }
129
+ end
130
+
131
+ end
132
+
133
+ end
134
+ end
135
+ end
136
+
@@ -60,6 +60,141 @@ CREATE SEQUENCE api_keys_id_seq
60
60
  ALTER SEQUENCE api_keys_id_seq OWNED BY api_keys.id;
61
61
 
62
62
 
63
+ --
64
+ -- Name: automatic_exploitation_match_results; Type: TABLE; Schema: public; Owner: -; Tablespace:
65
+ --
66
+
67
+ CREATE TABLE automatic_exploitation_match_results (
68
+ id integer NOT NULL,
69
+ match_id integer,
70
+ run_id integer,
71
+ state character varying(255) NOT NULL,
72
+ created_at timestamp without time zone NOT NULL,
73
+ updated_at timestamp without time zone NOT NULL
74
+ );
75
+
76
+
77
+ --
78
+ -- Name: automatic_exploitation_match_results_id_seq; Type: SEQUENCE; Schema: public; Owner: -
79
+ --
80
+
81
+ CREATE SEQUENCE automatic_exploitation_match_results_id_seq
82
+ START WITH 1
83
+ INCREMENT BY 1
84
+ NO MINVALUE
85
+ NO MAXVALUE
86
+ CACHE 1;
87
+
88
+
89
+ --
90
+ -- Name: automatic_exploitation_match_results_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
91
+ --
92
+
93
+ ALTER SEQUENCE automatic_exploitation_match_results_id_seq OWNED BY automatic_exploitation_match_results.id;
94
+
95
+
96
+ --
97
+ -- Name: automatic_exploitation_match_sets; Type: TABLE; Schema: public; Owner: -; Tablespace:
98
+ --
99
+
100
+ CREATE TABLE automatic_exploitation_match_sets (
101
+ id integer NOT NULL,
102
+ workspace_id integer,
103
+ user_id integer,
104
+ created_at timestamp without time zone NOT NULL,
105
+ updated_at timestamp without time zone NOT NULL
106
+ );
107
+
108
+
109
+ --
110
+ -- Name: automatic_exploitation_match_sets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
111
+ --
112
+
113
+ CREATE SEQUENCE automatic_exploitation_match_sets_id_seq
114
+ START WITH 1
115
+ INCREMENT BY 1
116
+ NO MINVALUE
117
+ NO MAXVALUE
118
+ CACHE 1;
119
+
120
+
121
+ --
122
+ -- Name: automatic_exploitation_match_sets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
123
+ --
124
+
125
+ ALTER SEQUENCE automatic_exploitation_match_sets_id_seq OWNED BY automatic_exploitation_match_sets.id;
126
+
127
+
128
+ --
129
+ -- Name: automatic_exploitation_matches; Type: TABLE; Schema: public; Owner: -; Tablespace:
130
+ --
131
+
132
+ CREATE TABLE automatic_exploitation_matches (
133
+ id integer NOT NULL,
134
+ module_detail_id integer,
135
+ state character varying(255),
136
+ nexpose_data_vulnerability_definition_id integer,
137
+ created_at timestamp without time zone NOT NULL,
138
+ updated_at timestamp without time zone NOT NULL,
139
+ match_set_id integer,
140
+ matchable_type character varying(255),
141
+ matchable_id integer,
142
+ module_fullname text
143
+ );
144
+
145
+
146
+ --
147
+ -- Name: automatic_exploitation_matches_id_seq; Type: SEQUENCE; Schema: public; Owner: -
148
+ --
149
+
150
+ CREATE SEQUENCE automatic_exploitation_matches_id_seq
151
+ START WITH 1
152
+ INCREMENT BY 1
153
+ NO MINVALUE
154
+ NO MAXVALUE
155
+ CACHE 1;
156
+
157
+
158
+ --
159
+ -- Name: automatic_exploitation_matches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
160
+ --
161
+
162
+ ALTER SEQUENCE automatic_exploitation_matches_id_seq OWNED BY automatic_exploitation_matches.id;
163
+
164
+
165
+ --
166
+ -- Name: automatic_exploitation_runs; Type: TABLE; Schema: public; Owner: -; Tablespace:
167
+ --
168
+
169
+ CREATE TABLE automatic_exploitation_runs (
170
+ id integer NOT NULL,
171
+ workspace_id integer,
172
+ user_id integer,
173
+ match_set_id integer,
174
+ created_at timestamp without time zone NOT NULL,
175
+ updated_at timestamp without time zone NOT NULL
176
+ );
177
+
178
+
179
+ --
180
+ -- Name: automatic_exploitation_runs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
181
+ --
182
+
183
+ CREATE SEQUENCE automatic_exploitation_runs_id_seq
184
+ START WITH 1
185
+ INCREMENT BY 1
186
+ NO MINVALUE
187
+ NO MAXVALUE
188
+ CACHE 1;
189
+
190
+
191
+ --
192
+ -- Name: automatic_exploitation_runs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
193
+ --
194
+
195
+ ALTER SEQUENCE automatic_exploitation_runs_id_seq OWNED BY automatic_exploitation_runs.id;
196
+
197
+
63
198
  --
64
199
  -- Name: clients; Type: TABLE; Schema: public; Owner: -; Tablespace:
65
200
  --
@@ -419,7 +554,8 @@ CREATE TABLE loots (
419
554
  updated_at timestamp without time zone NOT NULL,
420
555
  content_type character varying(255),
421
556
  name text,
422
- info text
557
+ info text,
558
+ module_run_id integer
423
559
  );
424
560
 
425
561
 
@@ -732,6 +868,48 @@ CREATE SEQUENCE module_refs_id_seq
732
868
  ALTER SEQUENCE module_refs_id_seq OWNED BY module_refs.id;
733
869
 
734
870
 
871
+ --
872
+ -- Name: module_runs; Type: TABLE; Schema: public; Owner: -; Tablespace:
873
+ --
874
+
875
+ CREATE TABLE module_runs (
876
+ id integer NOT NULL,
877
+ attempted_at timestamp without time zone,
878
+ fail_detail text,
879
+ fail_reason character varying(255),
880
+ module_fullname text,
881
+ port integer,
882
+ proto character varying(255),
883
+ session_id integer,
884
+ status character varying(255),
885
+ trackable_id integer,
886
+ trackable_type character varying(255),
887
+ user_id integer,
888
+ username character varying(255),
889
+ created_at timestamp without time zone NOT NULL,
890
+ updated_at timestamp without time zone NOT NULL
891
+ );
892
+
893
+
894
+ --
895
+ -- Name: module_runs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
896
+ --
897
+
898
+ CREATE SEQUENCE module_runs_id_seq
899
+ START WITH 1
900
+ INCREMENT BY 1
901
+ NO MINVALUE
902
+ NO MAXVALUE
903
+ CACHE 1;
904
+
905
+
906
+ --
907
+ -- Name: module_runs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
908
+ --
909
+
910
+ ALTER SEQUENCE module_runs_id_seq OWNED BY module_runs.id;
911
+
912
+
735
913
  --
736
914
  -- Name: module_targets; Type: TABLE; Schema: public; Owner: -; Tablespace:
737
915
  --
@@ -1109,7 +1287,8 @@ CREATE TABLE sessions (
1109
1287
  closed_at timestamp without time zone,
1110
1288
  close_reason character varying(255),
1111
1289
  local_id integer,
1112
- last_seen timestamp without time zone
1290
+ last_seen timestamp without time zone,
1291
+ module_run_id integer
1113
1292
  );
1114
1293
 
1115
1294
 
@@ -1819,6 +1998,34 @@ ALTER SEQUENCE workspaces_id_seq OWNED BY workspaces.id;
1819
1998
  ALTER TABLE ONLY api_keys ALTER COLUMN id SET DEFAULT nextval('api_keys_id_seq'::regclass);
1820
1999
 
1821
2000
 
2001
+ --
2002
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
2003
+ --
2004
+
2005
+ ALTER TABLE ONLY automatic_exploitation_match_results ALTER COLUMN id SET DEFAULT nextval('automatic_exploitation_match_results_id_seq'::regclass);
2006
+
2007
+
2008
+ --
2009
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
2010
+ --
2011
+
2012
+ ALTER TABLE ONLY automatic_exploitation_match_sets ALTER COLUMN id SET DEFAULT nextval('automatic_exploitation_match_sets_id_seq'::regclass);
2013
+
2014
+
2015
+ --
2016
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
2017
+ --
2018
+
2019
+ ALTER TABLE ONLY automatic_exploitation_matches ALTER COLUMN id SET DEFAULT nextval('automatic_exploitation_matches_id_seq'::regclass);
2020
+
2021
+
2022
+ --
2023
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
2024
+ --
2025
+
2026
+ ALTER TABLE ONLY automatic_exploitation_runs ALTER COLUMN id SET DEFAULT nextval('automatic_exploitation_runs_id_seq'::regclass);
2027
+
2028
+
1822
2029
  --
1823
2030
  -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1824
2031
  --
@@ -1952,6 +2159,13 @@ ALTER TABLE ONLY module_platforms ALTER COLUMN id SET DEFAULT nextval('module_pl
1952
2159
  ALTER TABLE ONLY module_refs ALTER COLUMN id SET DEFAULT nextval('module_refs_id_seq'::regclass);
1953
2160
 
1954
2161
 
2162
+ --
2163
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
2164
+ --
2165
+
2166
+ ALTER TABLE ONLY module_runs ALTER COLUMN id SET DEFAULT nextval('module_runs_id_seq'::regclass);
2167
+
2168
+
1955
2169
  --
1956
2170
  -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1957
2171
  --
@@ -2163,6 +2377,38 @@ ALTER TABLE ONLY api_keys
2163
2377
  ADD CONSTRAINT api_keys_pkey PRIMARY KEY (id);
2164
2378
 
2165
2379
 
2380
+ --
2381
+ -- Name: automatic_exploitation_match_results_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2382
+ --
2383
+
2384
+ ALTER TABLE ONLY automatic_exploitation_match_results
2385
+ ADD CONSTRAINT automatic_exploitation_match_results_pkey PRIMARY KEY (id);
2386
+
2387
+
2388
+ --
2389
+ -- Name: automatic_exploitation_match_sets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2390
+ --
2391
+
2392
+ ALTER TABLE ONLY automatic_exploitation_match_sets
2393
+ ADD CONSTRAINT automatic_exploitation_match_sets_pkey PRIMARY KEY (id);
2394
+
2395
+
2396
+ --
2397
+ -- Name: automatic_exploitation_matches_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2398
+ --
2399
+
2400
+ ALTER TABLE ONLY automatic_exploitation_matches
2401
+ ADD CONSTRAINT automatic_exploitation_matches_pkey PRIMARY KEY (id);
2402
+
2403
+
2404
+ --
2405
+ -- Name: automatic_exploitation_runs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2406
+ --
2407
+
2408
+ ALTER TABLE ONLY automatic_exploitation_runs
2409
+ ADD CONSTRAINT automatic_exploitation_runs_pkey PRIMARY KEY (id);
2410
+
2411
+
2166
2412
  --
2167
2413
  -- Name: clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2168
2414
  --
@@ -2315,6 +2561,14 @@ ALTER TABLE ONLY module_refs
2315
2561
  ADD CONSTRAINT module_refs_pkey PRIMARY KEY (id);
2316
2562
 
2317
2563
 
2564
+ --
2565
+ -- Name: module_runs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2566
+ --
2567
+
2568
+ ALTER TABLE ONLY module_runs
2569
+ ADD CONSTRAINT module_runs_pkey PRIMARY KEY (id);
2570
+
2571
+
2318
2572
  --
2319
2573
  -- Name: module_targets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2320
2574
  --
@@ -2547,6 +2801,69 @@ ALTER TABLE ONLY workspaces
2547
2801
  ADD CONSTRAINT workspaces_pkey PRIMARY KEY (id);
2548
2802
 
2549
2803
 
2804
+ --
2805
+ -- Name: index_automatic_exploitation_match_results_on_match_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2806
+ --
2807
+
2808
+ CREATE INDEX index_automatic_exploitation_match_results_on_match_id ON automatic_exploitation_match_results USING btree (match_id);
2809
+
2810
+
2811
+ --
2812
+ -- Name: index_automatic_exploitation_match_results_on_run_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2813
+ --
2814
+
2815
+ CREATE INDEX index_automatic_exploitation_match_results_on_run_id ON automatic_exploitation_match_results USING btree (run_id);
2816
+
2817
+
2818
+ --
2819
+ -- Name: index_automatic_exploitation_match_sets_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2820
+ --
2821
+
2822
+ CREATE INDEX index_automatic_exploitation_match_sets_on_user_id ON automatic_exploitation_match_sets USING btree (user_id);
2823
+
2824
+
2825
+ --
2826
+ -- Name: index_automatic_exploitation_match_sets_on_workspace_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2827
+ --
2828
+
2829
+ CREATE INDEX index_automatic_exploitation_match_sets_on_workspace_id ON automatic_exploitation_match_sets USING btree (workspace_id);
2830
+
2831
+
2832
+ --
2833
+ -- Name: index_automatic_exploitation_matches_on_module_fullname; Type: INDEX; Schema: public; Owner: -; Tablespace:
2834
+ --
2835
+
2836
+ CREATE INDEX index_automatic_exploitation_matches_on_module_fullname ON automatic_exploitation_matches USING btree (module_fullname);
2837
+
2838
+
2839
+ --
2840
+ -- Name: index_automatic_exploitation_matches_on_ref_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2841
+ --
2842
+
2843
+ CREATE INDEX index_automatic_exploitation_matches_on_ref_id ON automatic_exploitation_matches USING btree (module_detail_id);
2844
+
2845
+
2846
+ --
2847
+ -- Name: index_automatic_exploitation_runs_on_match_set_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2848
+ --
2849
+
2850
+ CREATE INDEX index_automatic_exploitation_runs_on_match_set_id ON automatic_exploitation_runs USING btree (match_set_id);
2851
+
2852
+
2853
+ --
2854
+ -- Name: index_automatic_exploitation_runs_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2855
+ --
2856
+
2857
+ CREATE INDEX index_automatic_exploitation_runs_on_user_id ON automatic_exploitation_runs USING btree (user_id);
2858
+
2859
+
2860
+ --
2861
+ -- Name: index_automatic_exploitation_runs_on_workspace_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2862
+ --
2863
+
2864
+ CREATE INDEX index_automatic_exploitation_runs_on_workspace_id ON automatic_exploitation_runs USING btree (workspace_id);
2865
+
2866
+
2550
2867
  --
2551
2868
  -- Name: index_hosts_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
2552
2869
  --
@@ -2589,6 +2906,13 @@ CREATE INDEX index_hosts_on_state ON hosts USING btree (state);
2589
2906
  CREATE UNIQUE INDEX index_hosts_on_workspace_id_and_address ON hosts USING btree (workspace_id, address);
2590
2907
 
2591
2908
 
2909
+ --
2910
+ -- Name: index_loots_on_module_run_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2911
+ --
2912
+
2913
+ CREATE INDEX index_loots_on_module_run_id ON loots USING btree (module_run_id);
2914
+
2915
+
2592
2916
  --
2593
2917
  -- Name: index_module_actions_on_module_detail_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2594
2918
  --
@@ -2666,6 +2990,20 @@ CREATE INDEX index_module_refs_on_module_detail_id ON module_refs USING btree (d
2666
2990
  CREATE INDEX index_module_refs_on_name ON module_refs USING btree (name);
2667
2991
 
2668
2992
 
2993
+ --
2994
+ -- Name: index_module_runs_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2995
+ --
2996
+
2997
+ CREATE INDEX index_module_runs_on_session_id ON module_runs USING btree (session_id);
2998
+
2999
+
3000
+ --
3001
+ -- Name: index_module_runs_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
3002
+ --
3003
+
3004
+ CREATE INDEX index_module_runs_on_user_id ON module_runs USING btree (user_id);
3005
+
3006
+
2669
3007
  --
2670
3008
  -- Name: index_module_targets_on_module_detail_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
2671
3009
  --
@@ -2729,6 +3067,13 @@ CREATE INDEX index_services_on_proto ON services USING btree (proto);
2729
3067
  CREATE INDEX index_services_on_state ON services USING btree (state);
2730
3068
 
2731
3069
 
3070
+ --
3071
+ -- Name: index_sessions_on_module_run_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
3072
+ --
3073
+
3074
+ CREATE INDEX index_sessions_on_module_run_id ON sessions USING btree (module_run_id);
3075
+
3076
+
2732
3077
  --
2733
3078
  -- Name: index_vulns_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
2734
3079
  --
@@ -3000,6 +3345,18 @@ INSERT INTO schema_migrations (version) VALUES ('20130604145732');
3000
3345
 
3001
3346
  INSERT INTO schema_migrations (version) VALUES ('20130717150737');
3002
3347
 
3348
+ INSERT INTO schema_migrations (version) VALUES ('20131002004641');
3349
+
3350
+ INSERT INTO schema_migrations (version) VALUES ('20131002164449');
3351
+
3352
+ INSERT INTO schema_migrations (version) VALUES ('20131008213344');
3353
+
3354
+ INSERT INTO schema_migrations (version) VALUES ('20131011184338');
3355
+
3356
+ INSERT INTO schema_migrations (version) VALUES ('20131017150735');
3357
+
3358
+ INSERT INTO schema_migrations (version) VALUES ('20131021185657');
3359
+
3003
3360
  INSERT INTO schema_migrations (version) VALUES ('20140905031549');
3004
3361
 
3005
3362
  INSERT INTO schema_migrations (version) VALUES ('20150112203945');
@@ -3010,6 +3367,16 @@ INSERT INTO schema_migrations (version) VALUES ('20150209195939');
3010
3367
 
3011
3368
  INSERT INTO schema_migrations (version) VALUES ('20150212214222');
3012
3369
 
3370
+ INSERT INTO schema_migrations (version) VALUES ('20150219173821');
3371
+
3372
+ INSERT INTO schema_migrations (version) VALUES ('20150219215039');
3373
+
3374
+ INSERT INTO schema_migrations (version) VALUES ('20150226151459');
3375
+
3376
+ INSERT INTO schema_migrations (version) VALUES ('20150312155312');
3377
+
3378
+ INSERT INTO schema_migrations (version) VALUES ('20150326183742');
3379
+
3013
3380
  INSERT INTO schema_migrations (version) VALUES ('21');
3014
3381
 
3015
3382
  INSERT INTO schema_migrations (version) VALUES ('22');