metasploit_data_models 0.7.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -0
- data/.rspec +3 -0
- data/.simplecov +38 -0
- data/.travis.yml +6 -0
- data/.yardopts +4 -0
- data/Gemfile +27 -0
- data/LICENSE +27 -0
- data/README.md +72 -0
- data/Rakefile +53 -0
- data/app/models/mdm/api_key.rb +20 -0
- data/app/models/mdm/client.rb +9 -0
- data/app/models/mdm/cred.rb +93 -0
- data/app/models/mdm/event.rb +30 -0
- data/app/models/mdm/exploit_attempt.rb +14 -0
- data/app/models/mdm/exploited_host.rb +11 -0
- data/app/models/mdm/host.rb +134 -0
- data/app/models/mdm/host_detail.rb +15 -0
- data/app/models/mdm/host_tag.rb +13 -0
- data/app/models/mdm/imported_cred.rb +10 -0
- data/app/models/mdm/listener.rb +24 -0
- data/app/models/mdm/loot.rb +63 -0
- data/app/models/mdm/macro.rb +20 -0
- data/app/models/mdm/mod_ref.rb +3 -0
- data/app/models/mdm/module_action.rb +24 -0
- data/app/models/mdm/module_arch.rb +24 -0
- data/app/models/mdm/module_author.rb +25 -0
- data/app/models/mdm/module_detail.rb +59 -0
- data/app/models/mdm/module_mixin.rb +24 -0
- data/app/models/mdm/module_platform.rb +24 -0
- data/app/models/mdm/module_ref.rb +24 -0
- data/app/models/mdm/module_target.rb +26 -0
- data/app/models/mdm/nexpose_console.rb +20 -0
- data/app/models/mdm/note.rb +49 -0
- data/app/models/mdm/profile.rb +9 -0
- data/app/models/mdm/ref.rb +14 -0
- data/app/models/mdm/report.rb +50 -0
- data/app/models/mdm/report_template.rb +27 -0
- data/app/models/mdm/route.rb +9 -0
- data/app/models/mdm/service.rb +56 -0
- data/app/models/mdm/session.rb +48 -0
- data/app/models/mdm/session_event.rb +9 -0
- data/app/models/mdm/tag.rb +46 -0
- data/app/models/mdm/task.rb +41 -0
- data/app/models/mdm/user.rb +25 -0
- data/app/models/mdm/vuln.rb +60 -0
- data/app/models/mdm/vuln_attempt.rb +15 -0
- data/app/models/mdm/vuln_detail.rb +14 -0
- data/app/models/mdm/vuln_ref.rb +13 -0
- data/app/models/mdm/web_form.rb +16 -0
- data/app/models/mdm/web_page.rb +16 -0
- data/app/models/mdm/web_site.rb +47 -0
- data/app/models/mdm/web_vuln.rb +190 -0
- data/app/models/mdm/wmap_request.rb +3 -0
- data/app/models/mdm/wmap_target.rb +3 -0
- data/app/models/mdm/workspace.rb +196 -0
- data/bin/mdm_console +68 -0
- data/console_db.yml +9 -0
- data/db/migrate/000_create_tables.rb +79 -0
- data/db/migrate/001_add_wmap_tables.rb +35 -0
- data/db/migrate/002_add_workspaces.rb +36 -0
- data/db/migrate/003_move_notes.rb +20 -0
- data/db/migrate/004_add_events_table.rb +16 -0
- data/db/migrate/005_expand_info.rb +58 -0
- data/db/migrate/006_add_timestamps.rb +26 -0
- data/db/migrate/007_add_loots.rb +20 -0
- data/db/migrate/008_create_users.rb +16 -0
- data/db/migrate/009_add_loots_ctype.rb +10 -0
- data/db/migrate/010_add_alert_fields.rb +16 -0
- data/db/migrate/011_add_reports.rb +19 -0
- data/db/migrate/012_add_tasks.rb +24 -0
- data/db/migrate/013_add_tasks_result.rb +10 -0
- data/db/migrate/014_add_loots_fields.rb +12 -0
- data/db/migrate/015_rename_user.rb +16 -0
- data/db/migrate/016_add_host_purpose.rb +10 -0
- data/db/migrate/017_expand_info2.rb +58 -0
- data/db/migrate/018_add_workspace_user_info.rb +29 -0
- data/db/migrate/019_add_workspace_desc.rb +23 -0
- data/db/migrate/020_add_user_preferences.rb +11 -0
- data/db/migrate/021_standardize_info_and_data.rb +18 -0
- data/db/migrate/022_enlarge_event_info.rb +10 -0
- data/db/migrate/023_add_report_downloaded_at.rb +10 -0
- data/db/migrate/024_convert_service_info_to_text.rb +12 -0
- data/db/migrate/025_add_user_admin.rb +19 -0
- data/db/migrate/026_add_creds_table.rb +19 -0
- data/db/migrate/20100819123300_migrate_cred_data.rb +154 -0
- data/db/migrate/20100824151500_add_exploited_table.rb +16 -0
- data/db/migrate/20100908001428_add_owner_to_workspaces.rb +9 -0
- data/db/migrate/20100911122000_add_report_templates.rb +18 -0
- data/db/migrate/20100916151530_require_admin_flag.rb +15 -0
- data/db/migrate/20100916175000_add_campaigns_and_templates.rb +61 -0
- data/db/migrate/20100920012100_add_generate_exe_column.rb +8 -0
- data/db/migrate/20100926214000_add_template_prefs.rb +11 -0
- data/db/migrate/20101001000000_add_web_tables.rb +57 -0
- data/db/migrate/20101002000000_add_query.rb +10 -0
- data/db/migrate/20101007000000_add_vuln_info.rb +15 -0
- data/db/migrate/20101008111800_add_clients_to_campaigns.rb +10 -0
- data/db/migrate/20101009023300_add_campaign_attachments.rb +15 -0
- data/db/migrate/20101104135100_add_imported_creds.rb +17 -0
- data/db/migrate/20101203000000_fix_web_tables.rb +34 -0
- data/db/migrate/20101203000001_expand_host_comment.rb +12 -0
- data/db/migrate/20101206212033_add_limit_to_network_to_workspaces.rb +9 -0
- data/db/migrate/20110112154300_add_module_uuid_to_tasks.rb +9 -0
- data/db/migrate/20110204112800_add_host_tags.rb +28 -0
- data/db/migrate/20110317144932_add_session_table.rb +110 -0
- data/db/migrate/20110414180600_add_local_id_to_session_table.rb +11 -0
- data/db/migrate/20110415175705_add_routes_table.rb +18 -0
- data/db/migrate/20110422000000_convert_binary.rb +73 -0
- data/db/migrate/20110425095900_add_last_seen_to_sessions.rb +8 -0
- data/db/migrate/20110513143900_track_successful_exploits.rb +31 -0
- data/db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb +26 -0
- data/db/migrate/20110527000000_add_task_id_to_reports_table.rb +11 -0
- data/db/migrate/20110527000001_add_api_keys_table.rb +12 -0
- data/db/migrate/20110606000001_add_macros_table.rb +16 -0
- data/db/migrate/20110622000000_add_settings_to_tasks_table.rb +12 -0
- data/db/migrate/20110624000001_add_listeners_table.rb +19 -0
- data/db/migrate/20110625000001_add_macro_to_listeners_table.rb +12 -0
- data/db/migrate/20110630000001_add_nexpose_consoles_table.rb +21 -0
- data/db/migrate/20110630000002_add_name_to_nexpose_consoles_table.rb +12 -0
- data/db/migrate/20110717000001_add_profiles_table.rb +15 -0
- data/db/migrate/20110727163801_expand_cred_ptype_column.rb +9 -0
- data/db/migrate/20110730000001_add_initial_indexes.rb +85 -0
- data/db/migrate/20110812000001_prune_indexes.rb +23 -0
- data/db/migrate/20110922000000_expand_notes.rb +9 -0
- data/db/migrate/20110928101300_add_mod_ref_table.rb +17 -0
- data/db/migrate/20111011110000_add_display_name_to_reports_table.rb +24 -0
- data/db/migrate/20111203000000_inet_columns.rb +13 -0
- data/db/migrate/20111204000000_more_inet_columns.rb +17 -0
- data/db/migrate/20111210000000_add_scope_to_hosts.rb +9 -0
- data/db/migrate/20120126110000_add_virtual_host_to_hosts.rb +9 -0
- data/db/migrate/20120411173220_rename_workspace_members.rb +9 -0
- data/db/migrate/20120601152442_add_counter_caches_to_hosts.rb +21 -0
- data/db/migrate/20120625000000_add_vuln_details.rb +34 -0
- data/db/migrate/20120625000001_add_host_details.rb +16 -0
- data/db/migrate/20120625000002_expand_details.rb +16 -0
- data/db/migrate/20120625000003_expand_details2.rb +24 -0
- data/db/migrate/20120625000004_add_vuln_attempts.rb +19 -0
- data/db/migrate/20120625000005_add_vuln_and_host_counter_caches.rb +14 -0
- data/db/migrate/20120625000006_add_module_details.rb +118 -0
- data/db/migrate/20120625000007_add_exploit_attempts.rb +26 -0
- data/db/migrate/20120625000008_add_fail_message.rb +12 -0
- data/db/migrate/20120718202805_add_owner_and_payload_to_web_vulns.rb +13 -0
- data/db/migrate/20130228214900_change_required_columns_to_null_false_in_web_vulns.rb +35 -0
- data/db/migrate/20130423211152_add_creds_counter_cache.rb +24 -0
- data/lib/mdm.rb +12 -0
- data/lib/mdm/host/operating_system_normalization.rb +984 -0
- data/lib/metasploit_data_models.rb +60 -0
- data/lib/metasploit_data_models/base64_serializer.rb +103 -0
- data/lib/metasploit_data_models/engine.rb +23 -0
- data/lib/metasploit_data_models/serialized_prefs.rb +23 -0
- data/lib/metasploit_data_models/validators/ip_format_validator.rb +13 -0
- data/lib/metasploit_data_models/validators/password_is_strong_validator.rb +70 -0
- data/lib/metasploit_data_models/version.rb +8 -0
- data/lib/tasks/yard.rake +26 -0
- data/metasploit_data_models.gemspec +54 -0
- data/script/rails +8 -0
- data/spec/app/models/mdm/module_action_spec.rb +38 -0
- data/spec/app/models/mdm/module_arch_spec.rb +38 -0
- data/spec/app/models/mdm/module_author_spec.rb +50 -0
- data/spec/app/models/mdm/module_detail_spec.rb +291 -0
- data/spec/app/models/mdm/module_mixin_spec.rb +38 -0
- data/spec/app/models/mdm/module_platform_spec.rb +38 -0
- data/spec/app/models/mdm/module_ref_spec.rb +38 -0
- data/spec/app/models/mdm/module_target_spec.rb +41 -0
- data/spec/app/models/mdm/web_vuln_spec.rb +126 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +61 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml.example +22 -0
- data/spec/dummy/config/database.yml.travis +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/db/schema.rb +639 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/mdm/addresses.rb +7 -0
- data/spec/factories/mdm/hosts.rb +18 -0
- data/spec/factories/mdm/module_actions.rb +14 -0
- data/spec/factories/mdm/module_archs.rb +14 -0
- data/spec/factories/mdm/module_authors.rb +22 -0
- data/spec/factories/mdm/module_details.rb +9 -0
- data/spec/factories/mdm/module_mixins.rb +14 -0
- data/spec/factories/mdm/module_platforms.rb +14 -0
- data/spec/factories/mdm/module_refs.rb +14 -0
- data/spec/factories/mdm/module_targets.rb +19 -0
- data/spec/factories/mdm/services.rb +35 -0
- data/spec/factories/mdm/users.rb +22 -0
- data/spec/factories/mdm/web_sites.rb +8 -0
- data/spec/factories/mdm/web_vulns.rb +64 -0
- data/spec/factories/mdm/workspaces.rb +23 -0
- data/spec/lib/base64_serializer_spec.rb +174 -0
- data/spec/spec_helper.rb +36 -0
- metadata +472 -0
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_host, :class => Mdm::Host do
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
association :workspace, :factory => :mdm_workspace
|
7
|
+
|
8
|
+
#
|
9
|
+
# Attributes
|
10
|
+
#
|
11
|
+
address { generate :mdm_ipv4_address }
|
12
|
+
name { generate :mdm_host_name }
|
13
|
+
end
|
14
|
+
|
15
|
+
sequence :mdm_host_name do |n|
|
16
|
+
"mdm_host_#{n}"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_action, :class => Mdm::ModuleAction do
|
3
|
+
name { generate :mdm_module_action_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence :mdm_module_action_name do |n|
|
12
|
+
"Mdm::ModuleAction#name #{n}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_arch, :class => Mdm::ModuleArch do
|
3
|
+
name { generate :mdm_module_arch_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence :mdm_module_arch_name do |n|
|
12
|
+
"Mdm::ModuleArch#name #{n}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_author, :class => Mdm::ModuleAuthor do
|
3
|
+
name { generate :mdm_module_author_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
|
10
|
+
factory :full_mdm_module_author do
|
11
|
+
email { generate :mdm_module_author_name }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
sequence :mdm_module_author_name do |n|
|
16
|
+
"Mdm::ModuleAuthor#name #{n}"
|
17
|
+
end
|
18
|
+
|
19
|
+
sequence :mdm_module_author_email do |n|
|
20
|
+
"Mdm::ModuleAuthor#email #{n}"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_mixin, :class => Mdm::ModuleMixin do
|
3
|
+
name { generate :mdm_module_mixin_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence :mdm_module_mixin_name do |n|
|
12
|
+
"Mdm::ModuleMixin#name #{n}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_platform, :class => Mdm::ModulePlatform do
|
3
|
+
name { generate :mdm_module_platform_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence :mdm_module_platform_name do |n|
|
12
|
+
"Mdm::ModulePlatform#name #{n}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_ref, :class => Mdm::ModuleRef do
|
3
|
+
name { generate :mdm_module_ref_name }
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
association :module_detail, :factory => :mdm_module_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence :mdm_module_ref_name do |n|
|
12
|
+
"Mdm::ModuleRef#name #{n}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_module_target, :class => Mdm::ModuleTarget do
|
3
|
+
index { generate :mdm_module_target_index }
|
4
|
+
name { generate :mdm_module_target_name }
|
5
|
+
|
6
|
+
#
|
7
|
+
# Associations
|
8
|
+
#
|
9
|
+
association :module_detail, :factory => :mdm_module_detail
|
10
|
+
end
|
11
|
+
|
12
|
+
sequence :mdm_module_target_index do |n|
|
13
|
+
n
|
14
|
+
end
|
15
|
+
|
16
|
+
sequence :mdm_module_target_name do |n|
|
17
|
+
"Mdm::ModuleTarget#name #{n}"
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_service, :class => Mdm::Service do
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
association :host, :factory => :mdm_host
|
7
|
+
|
8
|
+
#
|
9
|
+
# Attributes
|
10
|
+
#
|
11
|
+
port 4567
|
12
|
+
proto 'snmp'
|
13
|
+
state 'open'
|
14
|
+
|
15
|
+
factory :web_service do
|
16
|
+
proto 'tcp'
|
17
|
+
name { FactoryGirl.generate(:web_service_name) }
|
18
|
+
port { FactoryGirl.generate(:port) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
port_bits = 16
|
23
|
+
port_limit = 1 << port_bits
|
24
|
+
|
25
|
+
sequence :port do |n|
|
26
|
+
n % port_limit
|
27
|
+
end
|
28
|
+
|
29
|
+
web_service_names = ['http', 'https']
|
30
|
+
web_service_name_count = web_service_names.length
|
31
|
+
|
32
|
+
sequence :web_service_name do |n|
|
33
|
+
web_service_names[n % web_service_name_count]
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_user, :class => Mdm::User do
|
3
|
+
admin true
|
4
|
+
company "Interplanetary Teleportation, LTD"
|
5
|
+
email "rwillingham@itl.com"
|
6
|
+
fullname { generate :mdm_user_fullname }
|
7
|
+
phone "5123334444"
|
8
|
+
username { generate :mdm_user_username }
|
9
|
+
end
|
10
|
+
|
11
|
+
factory :non_admin_mdm_user, :parent => :mdm_user do
|
12
|
+
admin false
|
13
|
+
end
|
14
|
+
|
15
|
+
sequence :mdm_user_fullname do |n|
|
16
|
+
"Mdm User Fullname the #{n.ordinalize}"
|
17
|
+
end
|
18
|
+
|
19
|
+
sequence :mdm_user_username do |n|
|
20
|
+
"mdm_user_username#{n}"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_web_vuln, :class => Mdm::WebVuln do
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
association :web_site, :factory => :mdm_web_site
|
7
|
+
|
8
|
+
#
|
9
|
+
# Attributes
|
10
|
+
#
|
11
|
+
|
12
|
+
category { generate :mdm_web_vuln_category }
|
13
|
+
confidence { generate :mdm_web_vuln_confidence }
|
14
|
+
method { generate :mdm_web_vuln_method }
|
15
|
+
name { generate :mdm_web_vuln_name }
|
16
|
+
path { generate :mdm_web_vuln_path }
|
17
|
+
params { generate :mdm_web_vuln_params }
|
18
|
+
pname { params.first.first }
|
19
|
+
proof { generate :mdm_web_vuln_proof }
|
20
|
+
risk { generate :mdm_web_vuln_risk }
|
21
|
+
end
|
22
|
+
|
23
|
+
sequence :mdm_web_vuln_category do |n|
|
24
|
+
"mdm_web_vuln_category_#{n}"
|
25
|
+
end
|
26
|
+
|
27
|
+
sequence :mdm_web_vuln_confidence do |n|
|
28
|
+
# range is from 0 to 100
|
29
|
+
n % 101
|
30
|
+
end
|
31
|
+
|
32
|
+
method_count = Mdm::WebVuln::METHODS.length
|
33
|
+
|
34
|
+
sequence :mdm_web_vuln_method do |n|
|
35
|
+
Mdm::WebVuln::METHODS[n % method_count]
|
36
|
+
end
|
37
|
+
|
38
|
+
sequence :mdm_web_vuln_name do |n|
|
39
|
+
"Web Vulnerability #{n}"
|
40
|
+
end
|
41
|
+
|
42
|
+
sequence :mdm_web_vuln_path do |n|
|
43
|
+
"path/to/vulnerability/#{n}"
|
44
|
+
end
|
45
|
+
|
46
|
+
sequence :mdm_web_vuln_params do |n|
|
47
|
+
[
|
48
|
+
[
|
49
|
+
"param#{n}",
|
50
|
+
"value#{n}"
|
51
|
+
]
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
sequence :mdm_web_vuln_proof do |n|
|
56
|
+
"Mdm::WebVuln Proof #{n}"
|
57
|
+
end
|
58
|
+
|
59
|
+
sequence :mdm_web_vuln_risk do |n|
|
60
|
+
# range is 0 .. 5
|
61
|
+
n % 6
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :mdm_workspace, :class => Mdm::Workspace do
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
association :owner, :factory => :mdm_user
|
7
|
+
|
8
|
+
#
|
9
|
+
# Attributes
|
10
|
+
#
|
11
|
+
boundary { generate :mdm_ipv4_address }
|
12
|
+
description { generate :mdm_workspace_description }
|
13
|
+
name { generate :mdm_workspace_name }
|
14
|
+
end
|
15
|
+
|
16
|
+
sequence :mdm_workspace_description do |n|
|
17
|
+
"Mdm::Workspace description #{n}"
|
18
|
+
end
|
19
|
+
|
20
|
+
sequence :mdm_workspace_name do |n|
|
21
|
+
"Mdm::Workspace Name #{n}"
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe MetasploitDataModels::Base64Serializer do
|
4
|
+
let(:base64_marshaled) do
|
5
|
+
marshaled = Marshal.dump(unserialized)
|
6
|
+
|
7
|
+
[
|
8
|
+
marshaled
|
9
|
+
].pack('m')
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:default) do
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:unserialized) do
|
17
|
+
{
|
18
|
+
:foo => 'bar',
|
19
|
+
:baz => 'baz'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:yaml) do
|
24
|
+
unserialized.to_yaml
|
25
|
+
end
|
26
|
+
|
27
|
+
subject(:base64_serializer) do
|
28
|
+
described_class.new
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'CONSTANTS' do
|
32
|
+
it 'should define DEFAULT' do
|
33
|
+
described_class::DEFAULT.should == default
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'LOADERS' do
|
37
|
+
it 'should prefer base64 marshaled first' do
|
38
|
+
first = described_class::LOADERS[0]
|
39
|
+
deserialized = first.call(base64_marshaled)
|
40
|
+
|
41
|
+
deserialized.should == unserialized
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should fallback to the old YAML format second' do
|
45
|
+
second = described_class::LOADERS[1]
|
46
|
+
deserialized = second.call(yaml)
|
47
|
+
|
48
|
+
deserialized.should == unserialized
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should finally give up and just return the value' do
|
52
|
+
last = described_class::LOADERS.last
|
53
|
+
deserialized = last.call(unserialized)
|
54
|
+
|
55
|
+
deserialized.should == unserialized
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context '#default' do
|
61
|
+
it 'should default to {}' do
|
62
|
+
base64_serializer.default.should == {}
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should return a duplicate' do
|
66
|
+
duplicate = base64_serializer.default
|
67
|
+
value = mock('Value')
|
68
|
+
duplicate[:key] = value
|
69
|
+
|
70
|
+
duplicate.should_not == base64_serializer.default
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context '#dump' do
|
75
|
+
it 'should output Base64 encoded marshaled data' do
|
76
|
+
dumped = base64_serializer.dump(unserialized)
|
77
|
+
|
78
|
+
dumped.should == base64_marshaled
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context '#initialize' do
|
83
|
+
let(:attributes) do
|
84
|
+
{}
|
85
|
+
end
|
86
|
+
|
87
|
+
subject(:base64_serializer) do
|
88
|
+
described_class.new(attributes)
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'with :default' do
|
92
|
+
let(:attributes) do
|
93
|
+
{
|
94
|
+
:default => default
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
let(:default) do
|
99
|
+
[
|
100
|
+
[
|
101
|
+
'param',
|
102
|
+
'value'
|
103
|
+
]
|
104
|
+
]
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should have :default in attributes' do
|
108
|
+
attributes.should have_key(:default)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should set default to :default value' do
|
112
|
+
base64_serializer.default.should == attributes[:default]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'without :default' do
|
117
|
+
it 'should not have :default in attributes' do
|
118
|
+
attributes.should_not have_key(:default)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should default #default to DEFAULT' do
|
122
|
+
base64_serializer.default.should == default
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context '#load' do
|
128
|
+
context 'with nil' do
|
129
|
+
let(:serialized) do
|
130
|
+
nil
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'should return #default' do
|
134
|
+
default = mock('Default')
|
135
|
+
base64_serializer.stub(:default => default)
|
136
|
+
deserialized = base64_serializer.load(serialized)
|
137
|
+
|
138
|
+
deserialized.should == default
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'with Base64 encoded marshaled' do
|
143
|
+
it 'should return unserialized' do
|
144
|
+
deserialized = base64_serializer.load(base64_marshaled)
|
145
|
+
|
146
|
+
deserialized.should == unserialized
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'with YAML' do
|
152
|
+
it 'should return unserialized' do
|
153
|
+
deserialized = base64_serializer.load(yaml)
|
154
|
+
|
155
|
+
deserialized.should == unserialized
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'without Base64 encoded marshaled' do
|
160
|
+
context 'without YAML' do
|
161
|
+
let(:raw_value) do
|
162
|
+
"< a > b >"
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'should return raw value' do
|
166
|
+
deserialized = base64_serializer.load(raw_value)
|
167
|
+
|
168
|
+
deserialized.should == raw_value
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|