· 6 years ago · Aug 02, 2019, 06:42 PM
1create table if not exists schema_migrations
2(
3 version varchar not null
4);
5
6alter table schema_migrations owner to msf;
7
8create unique index if not exists unique_schema_migrations
9 on schema_migrations (version);
10
11create table if not exists hosts
12(
13 id serial not null
14 constraint hosts_pkey
15 primary key,
16 created_at timestamp,
17 address inet not null,
18 mac varchar,
19 comm varchar,
20 name varchar,
21 state varchar,
22 os_name varchar,
23 os_flavor varchar,
24 os_sp varchar,
25 os_lang varchar,
26 arch varchar,
27 workspace_id integer not null,
28 updated_at timestamp,
29 purpose text,
30 info varchar(65536),
31 comments text,
32 scope text,
33 virtual_host text,
34 note_count integer default 0,
35 vuln_count integer default 0,
36 service_count integer default 0,
37 host_detail_count integer default 0,
38 exploit_attempt_count integer default 0,
39 cred_count integer default 0,
40 detected_arch varchar,
41 os_family varchar
42);
43
44alter table hosts owner to msf;
45
46create index if not exists index_hosts_on_name
47 on hosts (name);
48
49create index if not exists index_hosts_on_state
50 on hosts (state);
51
52create index if not exists index_hosts_on_os_name
53 on hosts (os_name);
54
55create index if not exists index_hosts_on_os_flavor
56 on hosts (os_flavor);
57
58create index if not exists index_hosts_on_purpose
59 on hosts (purpose);
60
61create unique index if not exists index_hosts_on_workspace_id_and_address
62 on hosts (workspace_id, address);
63
64create table if not exists clients
65(
66 id serial not null
67 constraint clients_pkey
68 primary key,
69 host_id integer,
70 created_at timestamp,
71 ua_string varchar(1024) not null,
72 ua_name varchar(64),
73 ua_ver varchar(32),
74 updated_at timestamp
75);
76
77alter table clients owner to msf;
78
79create table if not exists services
80(
81 id serial not null
82 constraint services_pkey
83 primary key,
84 host_id integer,
85 created_at timestamp,
86 port integer not null,
87 proto varchar(16) not null,
88 state varchar,
89 name varchar,
90 updated_at timestamp,
91 info text
92);
93
94alter table services owner to msf;
95
96create index if not exists index_services_on_port
97 on services (port);
98
99create index if not exists index_services_on_proto
100 on services (proto);
101
102create index if not exists index_services_on_state
103 on services (state);
104
105create index if not exists index_services_on_name
106 on services (name);
107
108create unique index if not exists index_services_on_host_id_and_port_and_proto
109 on services (host_id, port, proto);
110
111create table if not exists vulns
112(
113 id serial not null
114 constraint vulns_pkey
115 primary key,
116 host_id integer,
117 service_id integer,
118 created_at timestamp,
119 name varchar,
120 updated_at timestamp,
121 info varchar(65536),
122 exploited_at timestamp,
123 vuln_detail_count integer default 0,
124 vuln_attempt_count integer default 0,
125 origin_id integer,
126 origin_type varchar
127);
128
129alter table vulns owner to msf;
130
131create index if not exists index_vulns_on_name
132 on vulns (name);
133
134create index if not exists index_vulns_on_origin_id
135 on vulns (origin_id);
136
137create table if not exists refs
138(
139 id serial not null
140 constraint refs_pkey
141 primary key,
142 ref_id integer,
143 created_at timestamp,
144 name varchar(512),
145 updated_at timestamp
146);
147
148alter table refs owner to msf;
149
150create index if not exists index_refs_on_name
151 on refs (name);
152
153create table if not exists vulns_refs
154(
155 ref_id integer,
156 vuln_id integer,
157 id serial not null
158 constraint vulns_refs_pkey
159 primary key
160);
161
162alter table vulns_refs owner to msf;
163
164create table if not exists notes
165(
166 id serial not null
167 constraint notes_pkey
168 primary key,
169 created_at timestamp,
170 ntype varchar(512),
171 workspace_id integer default 1 not null,
172 service_id integer,
173 host_id integer,
174 updated_at timestamp,
175 critical boolean,
176 seen boolean,
177 data text,
178 vuln_id integer
179);
180
181alter table notes owner to msf;
182
183create index if not exists index_notes_on_ntype
184 on notes (ntype);
185
186create index if not exists index_notes_on_vuln_id
187 on notes (vuln_id);
188
189create table if not exists wmap_targets
190(
191 id serial not null
192 constraint wmap_targets_pkey
193 primary key,
194 host varchar,
195 address inet,
196 port integer,
197 ssl integer,
198 selected integer,
199 created_at timestamp,
200 updated_at timestamp
201);
202
203alter table wmap_targets owner to msf;
204
205create table if not exists wmap_requests
206(
207 id serial not null
208 constraint wmap_requests_pkey
209 primary key,
210 host varchar,
211 address inet,
212 port integer,
213 ssl integer,
214 meth varchar(32),
215 path text,
216 headers text,
217 query text,
218 body text,
219 respcode varchar(16),
220 resphead text,
221 response text,
222 created_at timestamp,
223 updated_at timestamp
224);
225
226alter table wmap_requests owner to msf;
227
228create table if not exists workspaces
229(
230 id serial not null
231 constraint workspaces_pkey
232 primary key,
233 name varchar,
234 created_at timestamp not null,
235 updated_at timestamp not null,
236 boundary varchar(4096),
237 description varchar(4096),
238 owner_id integer,
239 limit_to_network boolean default false not null,
240 import_fingerprint boolean default false
241);
242
243alter table workspaces owner to msf;
244
245create table if not exists events
246(
247 id serial not null
248 constraint events_pkey
249 primary key,
250 workspace_id integer,
251 host_id integer,
252 created_at timestamp,
253 name varchar,
254 updated_at timestamp,
255 critical boolean,
256 seen boolean,
257 username varchar,
258 info text
259);
260
261alter table events owner to msf;
262
263create table if not exists loots
264(
265 id serial not null
266 constraint loots_pkey
267 primary key,
268 workspace_id integer default 1 not null,
269 host_id integer,
270 service_id integer,
271 ltype varchar(512),
272 path varchar(1024),
273 data text,
274 created_at timestamp not null,
275 updated_at timestamp not null,
276 content_type varchar,
277 name text,
278 info text,
279 module_run_id integer
280);
281
282alter table loots owner to msf;
283
284create index if not exists index_loots_on_module_run_id
285 on loots (module_run_id);
286
287create table if not exists users
288(
289 id serial not null
290 constraint users_pkey
291 primary key,
292 username varchar,
293 crypted_password varchar,
294 password_salt varchar,
295 persistence_token varchar,
296 created_at timestamp not null,
297 updated_at timestamp not null,
298 fullname varchar,
299 email varchar,
300 phone varchar,
301 company varchar,
302 prefs varchar(524288),
303 admin boolean default true not null
304);
305
306alter table users owner to msf;
307
308create table if not exists reports
309(
310 id serial not null
311 constraint reports_pkey
312 primary key,
313 workspace_id integer default 1 not null,
314 created_by varchar,
315 rtype varchar,
316 path varchar(1024),
317 options text,
318 created_at timestamp not null,
319 updated_at timestamp not null,
320 downloaded_at timestamp,
321 task_id integer,
322 name varchar(63)
323);
324
325alter table reports owner to msf;
326
327create table if not exists tasks
328(
329 id serial not null
330 constraint tasks_pkey
331 primary key,
332 workspace_id integer default 1 not null,
333 created_by varchar,
334 module varchar,
335 completed_at timestamp,
336 path varchar(1024),
337 info varchar,
338 description varchar,
339 progress integer,
340 options text,
341 error text,
342 created_at timestamp not null,
343 updated_at timestamp not null,
344 result text,
345 module_uuid varchar(8),
346 settings bytea
347);
348
349alter table tasks owner to msf;
350
351create table if not exists workspace_members
352(
353 workspace_id integer not null,
354 user_id integer not null
355);
356
357alter table workspace_members owner to msf;
358
359create table if not exists creds
360(
361 id serial not null
362 constraint creds_pkey
363 primary key,
364 service_id integer not null,
365 created_at timestamp not null,
366 updated_at timestamp not null,
367 "user" varchar(2048),
368 pass varchar(4096),
369 active boolean default true,
370 proof varchar(4096),
371 ptype varchar(256),
372 source_id integer,
373 source_type varchar
374);
375
376alter table creds owner to msf;
377
378create table if not exists exploited_hosts
379(
380 id serial not null
381 constraint exploited_hosts_pkey
382 primary key,
383 host_id integer not null,
384 service_id integer,
385 session_uuid varchar(8),
386 name varchar(2048),
387 payload varchar(2048),
388 created_at timestamp not null,
389 updated_at timestamp not null
390);
391
392alter table exploited_hosts owner to msf;
393
394create table if not exists report_templates
395(
396 id serial not null
397 constraint report_templates_pkey
398 primary key,
399 workspace_id integer default 1 not null,
400 created_by varchar,
401 path varchar(1024),
402 name text,
403 created_at timestamp not null,
404 updated_at timestamp not null
405);
406
407alter table report_templates owner to msf;
408
409create table if not exists web_sites
410(
411 id serial not null
412 constraint web_sites_pkey
413 primary key,
414 service_id integer not null,
415 created_at timestamp not null,
416 updated_at timestamp not null,
417 vhost varchar(2048),
418 comments text,
419 options text
420);
421
422alter table web_sites owner to msf;
423
424create index if not exists index_web_sites_on_vhost
425 on web_sites (vhost);
426
427create index if not exists index_web_sites_on_comments
428 on web_sites (comments);
429
430create index if not exists index_web_sites_on_options
431 on web_sites (options);
432
433create table if not exists web_pages
434(
435 id serial not null
436 constraint web_pages_pkey
437 primary key,
438 web_site_id integer not null,
439 created_at timestamp not null,
440 updated_at timestamp not null,
441 path text,
442 query text,
443 code integer not null,
444 cookie text,
445 auth text,
446 ctype text,
447 mtime timestamp,
448 location text,
449 headers text,
450 body bytea,
451 request bytea
452);
453
454alter table web_pages owner to msf;
455
456create index if not exists index_web_pages_on_path
457 on web_pages (path);
458
459create index if not exists index_web_pages_on_query
460 on web_pages (query);
461
462create table if not exists web_forms
463(
464 id serial not null
465 constraint web_forms_pkey
466 primary key,
467 web_site_id integer not null,
468 created_at timestamp not null,
469 updated_at timestamp not null,
470 path text,
471 method varchar(1024),
472 params text,
473 query text
474);
475
476alter table web_forms owner to msf;
477
478create index if not exists index_web_forms_on_path
479 on web_forms (path);
480
481create table if not exists web_vulns
482(
483 id serial not null
484 constraint web_vulns_pkey
485 primary key,
486 web_site_id integer not null,
487 created_at timestamp not null,
488 updated_at timestamp not null,
489 path text not null,
490 method varchar(1024) not null,
491 params text,
492 pname text,
493 risk integer not null,
494 name varchar(1024) not null,
495 query text,
496 category text not null,
497 confidence integer not null,
498 description text,
499 blame text,
500 request bytea,
501 proof bytea not null,
502 owner varchar,
503 payload text
504);
505
506alter table web_vulns owner to msf;
507
508create index if not exists index_web_vulns_on_path
509 on web_vulns (path);
510
511create index if not exists index_web_vulns_on_method
512 on web_vulns (method);
513
514create index if not exists index_web_vulns_on_name
515 on web_vulns (name);
516
517create table if not exists tags
518(
519 id serial not null
520 constraint tags_pkey
521 primary key,
522 user_id integer,
523 name varchar(1024),
524 "desc" text,
525 report_summary boolean default false not null,
526 report_detail boolean default false not null,
527 critical boolean default false not null,
528 created_at timestamp not null,
529 updated_at timestamp not null
530);
531
532alter table tags owner to msf;
533
534create table if not exists hosts_tags
535(
536 host_id integer,
537 tag_id integer,
538 id serial not null
539 constraint hosts_tags_pkey
540 primary key
541);
542
543alter table hosts_tags owner to msf;
544
545create table if not exists sessions
546(
547 id serial not null
548 constraint sessions_pkey
549 primary key,
550 host_id integer,
551 stype varchar,
552 via_exploit varchar,
553 via_payload varchar,
554 "desc" varchar,
555 port integer,
556 platform varchar,
557 datastore text,
558 opened_at timestamp not null,
559 closed_at timestamp,
560 close_reason varchar,
561 local_id integer,
562 last_seen timestamp,
563 module_run_id integer
564);
565
566alter table sessions owner to msf;
567
568create index if not exists index_sessions_on_module_run_id
569 on sessions (module_run_id);
570
571create table if not exists session_events
572(
573 id serial not null
574 constraint session_events_pkey
575 primary key,
576 session_id integer,
577 etype varchar,
578 command bytea,
579 output bytea,
580 remote_path varchar,
581 local_path varchar,
582 created_at timestamp
583);
584
585alter table session_events owner to msf;
586
587create table if not exists routes
588(
589 id serial not null
590 constraint routes_pkey
591 primary key,
592 session_id integer,
593 subnet varchar,
594 netmask varchar
595);
596
597alter table routes owner to msf;
598
599create table if not exists api_keys
600(
601 id serial not null
602 constraint api_keys_pkey
603 primary key,
604 token text,
605 created_at timestamp not null,
606 updated_at timestamp not null
607);
608
609alter table api_keys owner to msf;
610
611create table if not exists macros
612(
613 id serial not null
614 constraint macros_pkey
615 primary key,
616 created_at timestamp not null,
617 updated_at timestamp not null,
618 owner text,
619 name text,
620 description text,
621 actions bytea,
622 prefs bytea
623);
624
625alter table macros owner to msf;
626
627create table if not exists listeners
628(
629 id serial not null
630 constraint listeners_pkey
631 primary key,
632 created_at timestamp not null,
633 updated_at timestamp not null,
634 workspace_id integer default 1 not null,
635 task_id integer,
636 enabled boolean default true,
637 owner text,
638 payload text,
639 address text,
640 port integer,
641 options bytea,
642 macro text
643);
644
645alter table listeners owner to msf;
646
647create table if not exists nexpose_consoles
648(
649 id serial not null
650 constraint nexpose_consoles_pkey
651 primary key,
652 created_at timestamp not null,
653 updated_at timestamp not null,
654 enabled boolean default true,
655 owner text,
656 address text,
657 port integer default 3780,
658 username text,
659 password text,
660 status text,
661 version text,
662 cert text,
663 cached_sites bytea,
664 name text
665);
666
667alter table nexpose_consoles owner to msf;
668
669create table if not exists profiles
670(
671 id serial not null
672 constraint profiles_pkey
673 primary key,
674 created_at timestamp not null,
675 updated_at timestamp not null,
676 active boolean default true,
677 name text,
678 owner text,
679 settings bytea
680);
681
682alter table profiles owner to msf;
683
684create table if not exists mod_refs
685(
686 id serial not null
687 constraint mod_refs_pkey
688 primary key,
689 module varchar(1024),
690 mtype varchar(128),
691 ref text
692);
693
694alter table mod_refs owner to msf;
695
696create table if not exists vuln_details
697(
698 id serial not null
699 constraint vuln_details_pkey
700 primary key,
701 vuln_id integer,
702 cvss_score double precision,
703 cvss_vector varchar,
704 title varchar,
705 description text,
706 solution text,
707 proof bytea,
708 nx_console_id integer,
709 nx_device_id integer,
710 nx_vuln_id varchar,
711 nx_severity double precision,
712 nx_pci_severity double precision,
713 nx_published timestamp,
714 nx_added timestamp,
715 nx_modified timestamp,
716 nx_tags text,
717 nx_vuln_status text,
718 nx_proof_key text,
719 src varchar,
720 nx_scan_id integer,
721 nx_vulnerable_since timestamp,
722 nx_pci_compliance_status varchar
723);
724
725alter table vuln_details owner to msf;
726
727create table if not exists host_details
728(
729 id serial not null
730 constraint host_details_pkey
731 primary key,
732 host_id integer,
733 nx_console_id integer,
734 nx_device_id integer,
735 src varchar,
736 nx_site_name varchar,
737 nx_site_importance varchar,
738 nx_scan_template varchar,
739 nx_risk_score double precision
740);
741
742alter table host_details owner to msf;
743
744create table if not exists vuln_attempts
745(
746 id serial not null
747 constraint vuln_attempts_pkey
748 primary key,
749 vuln_id integer,
750 attempted_at timestamp,
751 exploited boolean,
752 fail_reason varchar,
753 username varchar,
754 module text,
755 session_id integer,
756 loot_id integer,
757 fail_detail text
758);
759
760alter table vuln_attempts owner to msf;
761
762create table if not exists module_details
763(
764 id serial not null
765 constraint module_details_pkey
766 primary key,
767 mtime timestamp,
768 file text,
769 mtype varchar,
770 refname text,
771 fullname text,
772 name text,
773 rank integer,
774 description text,
775 license varchar,
776 privileged boolean,
777 disclosure_date timestamp,
778 default_target integer,
779 default_action text,
780 stance varchar,
781 ready boolean
782);
783
784alter table module_details owner to msf;
785
786create index if not exists index_module_details_on_refname
787 on module_details (refname);
788
789create index if not exists index_module_details_on_name
790 on module_details (name);
791
792create index if not exists index_module_details_on_description
793 on module_details (description);
794
795create index if not exists index_module_details_on_mtype
796 on module_details (mtype);
797
798create table if not exists module_authors
799(
800 id serial not null
801 constraint module_authors_pkey
802 primary key,
803 detail_id integer,
804 name text,
805 email text
806);
807
808alter table module_authors owner to msf;
809
810create index if not exists index_module_authors_on_detail_id
811 on module_authors (detail_id);
812
813create table if not exists module_mixins
814(
815 id serial not null
816 constraint module_mixins_pkey
817 primary key,
818 detail_id integer,
819 name text
820);
821
822alter table module_mixins owner to msf;
823
824create index if not exists index_module_mixins_on_detail_id
825 on module_mixins (detail_id);
826
827create table if not exists module_targets
828(
829 id serial not null
830 constraint module_targets_pkey
831 primary key,
832 detail_id integer,
833 index integer,
834 name text
835);
836
837alter table module_targets owner to msf;
838
839create index if not exists index_module_targets_on_detail_id
840 on module_targets (detail_id);
841
842create table if not exists module_actions
843(
844 id serial not null
845 constraint module_actions_pkey
846 primary key,
847 detail_id integer,
848 name text
849);
850
851alter table module_actions owner to msf;
852
853create index if not exists index_module_actions_on_detail_id
854 on module_actions (detail_id);
855
856create table if not exists module_refs
857(
858 id serial not null
859 constraint module_refs_pkey
860 primary key,
861 detail_id integer,
862 name text
863);
864
865alter table module_refs owner to msf;
866
867create index if not exists index_module_refs_on_detail_id
868 on module_refs (detail_id);
869
870create index if not exists index_module_refs_on_name
871 on module_refs (name);
872
873create table if not exists module_archs
874(
875 id serial not null
876 constraint module_archs_pkey
877 primary key,
878 detail_id integer,
879 name text
880);
881
882alter table module_archs owner to msf;
883
884create index if not exists index_module_archs_on_detail_id
885 on module_archs (detail_id);
886
887create table if not exists module_platforms
888(
889 id serial not null
890 constraint module_platforms_pkey
891 primary key,
892 detail_id integer,
893 name text
894);
895
896alter table module_platforms owner to msf;
897
898create index if not exists index_module_platforms_on_detail_id
899 on module_platforms (detail_id);
900
901create table if not exists exploit_attempts
902(
903 id serial not null
904 constraint exploit_attempts_pkey
905 primary key,
906 host_id integer,
907 service_id integer,
908 vuln_id integer,
909 attempted_at timestamp,
910 exploited boolean,
911 fail_reason varchar,
912 username varchar,
913 module text,
914 session_id integer,
915 loot_id integer,
916 port integer,
917 proto varchar,
918 fail_detail text
919);
920
921alter table exploit_attempts owner to msf;
922
923create table if not exists task_creds
924(
925 id serial not null
926 constraint task_creds_pkey
927 primary key,
928 task_id integer not null,
929 cred_id integer not null,
930 created_at timestamp not null,
931 updated_at timestamp not null
932);
933
934alter table task_creds owner to msf;
935
936create table if not exists task_hosts
937(
938 id serial not null
939 constraint task_hosts_pkey
940 primary key,
941 task_id integer not null,
942 host_id integer not null,
943 created_at timestamp not null,
944 updated_at timestamp not null
945);
946
947alter table task_hosts owner to msf;
948
949create table if not exists task_services
950(
951 id serial not null
952 constraint task_services_pkey
953 primary key,
954 task_id integer not null,
955 service_id integer not null,
956 created_at timestamp not null,
957 updated_at timestamp not null
958);
959
960alter table task_services owner to msf;
961
962create table if not exists task_sessions
963(
964 id serial not null
965 constraint task_sessions_pkey
966 primary key,
967 task_id integer not null,
968 session_id integer not null,
969 created_at timestamp not null,
970 updated_at timestamp not null
971);
972
973alter table task_sessions owner to msf;
974
975create table if not exists automatic_exploitation_matches
976(
977 id serial not null
978 constraint automatic_exploitation_matches_pkey
979 primary key,
980 module_detail_id integer,
981 state varchar,
982 nexpose_data_vulnerability_definition_id integer,
983 created_at timestamp not null,
984 updated_at timestamp not null,
985 match_set_id integer,
986 matchable_type varchar,
987 matchable_id integer,
988 module_fullname text
989);
990
991alter table automatic_exploitation_matches owner to msf;
992
993create index if not exists index_automatic_exploitation_matches_on_module_detail_id
994 on automatic_exploitation_matches (module_detail_id);
995
996create index if not exists index_automatic_exploitation_matches_on_module_fullname
997 on automatic_exploitation_matches (module_fullname);
998
999create table if not exists automatic_exploitation_match_sets
1000(
1001 id serial not null
1002 constraint automatic_exploitation_match_sets_pkey
1003 primary key,
1004 workspace_id integer,
1005 user_id integer,
1006 created_at timestamp not null,
1007 updated_at timestamp not null
1008);
1009
1010alter table automatic_exploitation_match_sets owner to msf;
1011
1012create index if not exists index_automatic_exploitation_match_sets_on_user_id
1013 on automatic_exploitation_match_sets (user_id);
1014
1015create index if not exists index_automatic_exploitation_match_sets_on_workspace_id
1016 on automatic_exploitation_match_sets (workspace_id);
1017
1018create table if not exists automatic_exploitation_runs
1019(
1020 id serial not null
1021 constraint automatic_exploitation_runs_pkey
1022 primary key,
1023 workspace_id integer,
1024 user_id integer,
1025 match_set_id integer,
1026 created_at timestamp not null,
1027 updated_at timestamp not null
1028);
1029
1030alter table automatic_exploitation_runs owner to msf;
1031
1032create index if not exists index_automatic_exploitation_runs_on_match_set_id
1033 on automatic_exploitation_runs (match_set_id);
1034
1035create index if not exists index_automatic_exploitation_runs_on_user_id
1036 on automatic_exploitation_runs (user_id);
1037
1038create index if not exists index_automatic_exploitation_runs_on_workspace_id
1039 on automatic_exploitation_runs (workspace_id);
1040
1041create table if not exists automatic_exploitation_match_results
1042(
1043 id serial not null
1044 constraint automatic_exploitation_match_results_pkey
1045 primary key,
1046 match_id integer,
1047 run_id integer,
1048 state varchar not null,
1049 created_at timestamp not null,
1050 updated_at timestamp not null
1051);
1052
1053alter table automatic_exploitation_match_results owner to msf;
1054
1055create index if not exists index_automatic_exploitation_match_results_on_match_id
1056 on automatic_exploitation_match_results (match_id);
1057
1058create index if not exists index_automatic_exploitation_match_results_on_run_id
1059 on automatic_exploitation_match_results (run_id);
1060
1061create table if not exists metasploit_credential_publics
1062(
1063 id serial not null
1064 constraint metasploit_credential_publics_pkey
1065 primary key,
1066 username varchar not null,
1067 created_at timestamp not null,
1068 updated_at timestamp not null,
1069 type varchar not null
1070);
1071
1072alter table metasploit_credential_publics owner to msf;
1073
1074create unique index if not exists index_metasploit_credential_publics_on_username
1075 on metasploit_credential_publics (username);
1076
1077create table if not exists metasploit_credential_privates
1078(
1079 id serial not null
1080 constraint metasploit_credential_privates_pkey
1081 primary key,
1082 type varchar not null,
1083 data text not null,
1084 created_at timestamp not null,
1085 updated_at timestamp not null,
1086 jtr_format varchar
1087);
1088
1089alter table metasploit_credential_privates owner to msf;
1090
1091create unique index if not exists index_metasploit_credential_privates_on_type_and_data
1092 on metasploit_credential_privates (type, data)
1093 where (NOT ((type)::text = 'Metasploit::Credential::SSHKey'::text));
1094
1095create unique index if not exists index_metasploit_credential_privates_on_type_and_data_sshkey
1096 on metasploit_credential_privates (type, decode(md5(data), 'hex'::text))
1097 where ((type)::text = 'Metasploit::Credential::SSHKey'::text);
1098
1099create table if not exists metasploit_credential_realms
1100(
1101 id serial not null
1102 constraint metasploit_credential_realms_pkey
1103 primary key,
1104 key varchar not null,
1105 value varchar not null,
1106 created_at timestamp not null,
1107 updated_at timestamp not null
1108);
1109
1110alter table metasploit_credential_realms owner to msf;
1111
1112create unique index if not exists index_metasploit_credential_realms_on_key_and_value
1113 on metasploit_credential_realms (key, value);
1114
1115create table if not exists metasploit_credential_origin_manuals
1116(
1117 id serial not null
1118 constraint metasploit_credential_origin_manuals_pkey
1119 primary key,
1120 user_id integer not null,
1121 created_at timestamp not null,
1122 updated_at timestamp not null
1123);
1124
1125alter table metasploit_credential_origin_manuals owner to msf;
1126
1127create index if not exists index_metasploit_credential_origin_manuals_on_user_id
1128 on metasploit_credential_origin_manuals (user_id);
1129
1130create table if not exists metasploit_credential_origin_imports
1131(
1132 id serial not null
1133 constraint metasploit_credential_origin_imports_pkey
1134 primary key,
1135 filename text not null,
1136 task_id integer,
1137 created_at timestamp not null,
1138 updated_at timestamp not null
1139);
1140
1141alter table metasploit_credential_origin_imports owner to msf;
1142
1143create index if not exists index_metasploit_credential_origin_imports_on_task_id
1144 on metasploit_credential_origin_imports (task_id);
1145
1146create table if not exists metasploit_credential_origin_sessions
1147(
1148 id serial not null
1149 constraint metasploit_credential_origin_sessions_pkey
1150 primary key,
1151 post_reference_name text not null,
1152 session_id integer not null,
1153 created_at timestamp not null,
1154 updated_at timestamp not null
1155);
1156
1157alter table metasploit_credential_origin_sessions owner to msf;
1158
1159create unique index if not exists unique_metasploit_credential_origin_sessions
1160 on metasploit_credential_origin_sessions (session_id, post_reference_name);
1161
1162create table if not exists metasploit_credential_origin_services
1163(
1164 id serial not null
1165 constraint metasploit_credential_origin_services_pkey
1166 primary key,
1167 service_id integer not null,
1168 module_full_name text not null,
1169 created_at timestamp not null,
1170 updated_at timestamp not null
1171);
1172
1173alter table metasploit_credential_origin_services owner to msf;
1174
1175create unique index if not exists unique_metasploit_credential_origin_services
1176 on metasploit_credential_origin_services (service_id, module_full_name);
1177
1178create table if not exists metasploit_credential_cores
1179(
1180 id serial not null
1181 constraint metasploit_credential_cores_pkey
1182 primary key,
1183 origin_id integer not null,
1184 origin_type varchar not null,
1185 private_id integer,
1186 public_id integer,
1187 realm_id integer,
1188 workspace_id integer not null,
1189 created_at timestamp not null,
1190 updated_at timestamp not null,
1191 logins_count integer default 0
1192);
1193
1194alter table metasploit_credential_cores owner to msf;
1195
1196create index if not exists index_metasploit_credential_cores_on_origin_type_and_origin_id
1197 on metasploit_credential_cores (origin_type, origin_id);
1198
1199create index if not exists index_metasploit_credential_cores_on_private_id
1200 on metasploit_credential_cores (private_id);
1201
1202create index if not exists index_metasploit_credential_cores_on_public_id
1203 on metasploit_credential_cores (public_id);
1204
1205create index if not exists index_metasploit_credential_cores_on_realm_id
1206 on metasploit_credential_cores (realm_id);
1207
1208create index if not exists index_metasploit_credential_cores_on_workspace_id
1209 on metasploit_credential_cores (workspace_id);
1210
1211create unique index if not exists unique_private_metasploit_credential_cores
1212 on metasploit_credential_cores (workspace_id, private_id)
1213 where ((realm_id IS NULL) AND (public_id IS NULL) AND (private_id IS NOT NULL));
1214
1215create unique index if not exists unique_public_metasploit_credential_cores
1216 on metasploit_credential_cores (workspace_id, public_id)
1217 where ((realm_id IS NULL) AND (public_id IS NOT NULL) AND (private_id IS NULL));
1218
1219create unique index if not exists unique_realmless_metasploit_credential_cores
1220 on metasploit_credential_cores (workspace_id, public_id, private_id)
1221 where ((realm_id IS NULL) AND (public_id IS NOT NULL) AND (private_id IS NOT NULL));
1222
1223create unique index if not exists unique_publicless_metasploit_credential_cores
1224 on metasploit_credential_cores (workspace_id, realm_id, private_id)
1225 where ((realm_id IS NOT NULL) AND (public_id IS NULL) AND (private_id IS NOT NULL));
1226
1227create unique index if not exists unique_privateless_metasploit_credential_cores
1228 on metasploit_credential_cores (workspace_id, realm_id, public_id)
1229 where ((realm_id IS NOT NULL) AND (public_id IS NOT NULL) AND (private_id IS NULL));
1230
1231create unique index if not exists unique_complete_metasploit_credential_cores
1232 on metasploit_credential_cores (workspace_id, realm_id, public_id, private_id)
1233 where ((realm_id IS NOT NULL) AND (public_id IS NOT NULL) AND (private_id IS NOT NULL));
1234
1235create table if not exists metasploit_credential_logins
1236(
1237 id serial not null
1238 constraint metasploit_credential_logins_pkey
1239 primary key,
1240 core_id integer not null,
1241 service_id integer not null,
1242 access_level varchar,
1243 status varchar not null,
1244 last_attempted_at timestamp,
1245 created_at timestamp not null,
1246 updated_at timestamp not null
1247);
1248
1249alter table metasploit_credential_logins owner to msf;
1250
1251create unique index if not exists index_metasploit_credential_logins_on_core_id_and_service_id
1252 on metasploit_credential_logins (core_id, service_id);
1253
1254create unique index if not exists index_metasploit_credential_logins_on_service_id_and_core_id
1255 on metasploit_credential_logins (service_id, core_id);
1256
1257create table if not exists metasploit_credential_origin_cracked_passwords
1258(
1259 id serial not null
1260 constraint metasploit_credential_origin_cracked_passwords_pkey
1261 primary key,
1262 metasploit_credential_core_id integer not null,
1263 created_at timestamp not null,
1264 updated_at timestamp not null
1265);
1266
1267alter table metasploit_credential_origin_cracked_passwords owner to msf;
1268
1269create index if not exists originating_credential_cores
1270 on metasploit_credential_origin_cracked_passwords (metasploit_credential_core_id);
1271
1272create table if not exists credential_cores_tasks
1273(
1274 core_id integer,
1275 task_id integer
1276);
1277
1278alter table credential_cores_tasks owner to msf;
1279
1280create table if not exists credential_logins_tasks
1281(
1282 login_id integer,
1283 task_id integer
1284);
1285
1286alter table credential_logins_tasks owner to msf;
1287
1288create table if not exists module_runs
1289(
1290 id serial not null
1291 constraint module_runs_pkey
1292 primary key,
1293 attempted_at timestamp,
1294 fail_detail text,
1295 fail_reason varchar,
1296 module_fullname text,
1297 port integer,
1298 proto varchar,
1299 session_id integer,
1300 status varchar,
1301 trackable_id integer,
1302 trackable_type varchar,
1303 user_id integer,
1304 username varchar,
1305 created_at timestamp not null,
1306 updated_at timestamp not null
1307);
1308
1309alter table module_runs owner to msf;
1310
1311create index if not exists index_module_runs_on_session_id
1312 on module_runs (session_id);
1313
1314create index if not exists index_module_runs_on_user_id
1315 on module_runs (user_id);
1316
1317create table if not exists payloads
1318(
1319 id serial not null
1320 constraint payloads_pkey
1321 primary key,
1322 name varchar,
1323 uuid varchar,
1324 uuid_mask integer,
1325 timestamp integer,
1326 arch varchar,
1327 platform varchar,
1328 urls varchar,
1329 description varchar,
1330 raw_payload varchar,
1331 raw_payload_hash varchar,
1332 build_status varchar,
1333 build_opts varchar,
1334 created_at timestamp not null,
1335 updated_at timestamp not null
1336);
1337
1338alter table payloads owner to msf;
1339
1340create table if not exists async_callbacks
1341(
1342 id serial not null
1343 constraint async_callbacks_pkey
1344 primary key,
1345 uuid varchar not null,
1346 timestamp integer not null,
1347 listener_uri varchar,
1348 target_host varchar,
1349 target_port varchar,
1350 created_at timestamp not null,
1351 updated_at timestamp not null,
1352 "{:null=>false}" uuid
1353);
1354
1355alter table async_callbacks owner to msf;