ronin-db-activerecord 0.1.0.beta1

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 (135) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.github/workflows/ruby.yml +31 -0
  4. data/.gitignore +13 -0
  5. data/.rspec +1 -0
  6. data/.ruby-version +1 -0
  7. data/.yardopts +1 -0
  8. data/COPYING.txt +165 -0
  9. data/ChangeLog.md +39 -0
  10. data/Gemfile +27 -0
  11. data/README.md +143 -0
  12. data/Rakefile +72 -0
  13. data/db/migrate/0001_create_ronin_ip_address_mac_addresses_table.rb +43 -0
  14. data/db/migrate/0002_create_ronin_vulnerabilities_table.rb +61 -0
  15. data/db/migrate/0003_create_ronin_url_schemes_table.rb +32 -0
  16. data/db/migrate/0004_create_ronin_url_query_param_names_table.rb +32 -0
  17. data/db/migrate/0005_create_ronin_user_names_table.rb +33 -0
  18. data/db/migrate/0006_create_ronin_software_vendors_table.rb +32 -0
  19. data/db/migrate/0007_create_ronin_advisories_table.rb +42 -0
  20. data/db/migrate/0008_create_ronin_host_name_ip_addresses_table.rb +43 -0
  21. data/db/migrate/0009_create_ronin_host_names_table.rb +34 -0
  22. data/db/migrate/0010_create_ronin_arches_table.rb +37 -0
  23. data/db/migrate/0011_create_ronin_email_addresses_table.rb +44 -0
  24. data/db/migrate/0012_create_ronin_oses_table.rb +36 -0
  25. data/db/migrate/0013_create_ronin_organizations_table.rb +31 -0
  26. data/db/migrate/0014_create_ronin_ip_addresses_table.rb +35 -0
  27. data/db/migrate/0015_create_ronin_os_guesses_table.rb +40 -0
  28. data/db/migrate/0016_create_ronin_url_query_params_table.rb +42 -0
  29. data/db/migrate/0017_create_ronin_passwords_table.rb +32 -0
  30. data/db/migrate/0018_create_ronin_open_ports_table.rb +46 -0
  31. data/db/migrate/0019_create_ronin_urls_table.rb +50 -0
  32. data/db/migrate/0020_create_ronin_softwares_table.rb +39 -0
  33. data/db/migrate/0021_create_ronin_mac_addresses_table.rb +33 -0
  34. data/db/migrate/0022_create_ronin_countries_table.rb +34 -0
  35. data/db/migrate/0023_create_ronin_services_table.rb +32 -0
  36. data/db/migrate/0024_create_ronin_credentials_table.rb +44 -0
  37. data/db/migrate/0025_create_ronin_ports_table.rb +33 -0
  38. data/db/migrate/0026_create_ronin_asns_table.rb +44 -0
  39. data/db/migrate/0027_create_ronin_http_query_param_names_table.rb +32 -0
  40. data/db/migrate/0028_create_ronin_http_query_params_table.rb +42 -0
  41. data/db/migrate/0029_create_ronin_http_header_names_table.rb +31 -0
  42. data/db/migrate/0030_create_ronin_http_request_headers_table.rb +41 -0
  43. data/db/migrate/0031_create_ronin_http_response_headers_table.rb +41 -0
  44. data/db/migrate/0032_create_ronin_http_requests_table.rb +41 -0
  45. data/db/migrate/0033_create_ronin_http_responses_table.rb +36 -0
  46. data/db/migrate/0034_create_ronin_service_credentials_table.rb +41 -0
  47. data/db/migrate/0035_create_ronin_web_credentials_table.rb +41 -0
  48. data/gemspec.yml +28 -0
  49. data/lib/ronin/db/address.rb +105 -0
  50. data/lib/ronin/db/advisory.rb +169 -0
  51. data/lib/ronin/db/arch.rb +160 -0
  52. data/lib/ronin/db/asn.rb +212 -0
  53. data/lib/ronin/db/credential.rb +248 -0
  54. data/lib/ronin/db/email_address.rb +225 -0
  55. data/lib/ronin/db/host_name.rb +224 -0
  56. data/lib/ronin/db/host_name_ip_address.rb +65 -0
  57. data/lib/ronin/db/http_header_name.rb +75 -0
  58. data/lib/ronin/db/http_query_param.rb +79 -0
  59. data/lib/ronin/db/http_query_param_name.rb +76 -0
  60. data/lib/ronin/db/http_request.rb +120 -0
  61. data/lib/ronin/db/http_request_header.rb +78 -0
  62. data/lib/ronin/db/http_response.rb +91 -0
  63. data/lib/ronin/db/http_response_header.rb +78 -0
  64. data/lib/ronin/db/ip_address.rb +351 -0
  65. data/lib/ronin/db/ip_address_mac_address.rb +62 -0
  66. data/lib/ronin/db/mac_address.rb +91 -0
  67. data/lib/ronin/db/migrations.rb +137 -0
  68. data/lib/ronin/db/model/has_name.rb +102 -0
  69. data/lib/ronin/db/model/has_unique_name.rb +82 -0
  70. data/lib/ronin/db/model/importable.rb +85 -0
  71. data/lib/ronin/db/model/last_scanned_at.rb +48 -0
  72. data/lib/ronin/db/model.rb +37 -0
  73. data/lib/ronin/db/models.rb +108 -0
  74. data/lib/ronin/db/open_port.rb +148 -0
  75. data/lib/ronin/db/organization.rb +50 -0
  76. data/lib/ronin/db/os.rb +183 -0
  77. data/lib/ronin/db/os_guess.rb +67 -0
  78. data/lib/ronin/db/password.rb +167 -0
  79. data/lib/ronin/db/port.rb +123 -0
  80. data/lib/ronin/db/root.rb +28 -0
  81. data/lib/ronin/db/schema_migration.rb +34 -0
  82. data/lib/ronin/db/service.rb +48 -0
  83. data/lib/ronin/db/service_credential.rb +66 -0
  84. data/lib/ronin/db/software.rb +85 -0
  85. data/lib/ronin/db/software_vendor.rb +42 -0
  86. data/lib/ronin/db/url.rb +497 -0
  87. data/lib/ronin/db/url_query_param.rb +79 -0
  88. data/lib/ronin/db/url_query_param_name.rb +76 -0
  89. data/lib/ronin/db/url_scheme.rb +80 -0
  90. data/lib/ronin/db/user_name.rb +96 -0
  91. data/lib/ronin/db/vulnerability.rb +81 -0
  92. data/lib/ronin/db/web_credential.rb +69 -0
  93. data/ronin-db-activerecord.gemspec +61 -0
  94. data/spec/advisory_spec.rb +277 -0
  95. data/spec/arch_spec.rb +228 -0
  96. data/spec/asn_spec.rb +504 -0
  97. data/spec/credential_spec.rb +362 -0
  98. data/spec/email_address_spec.rb +372 -0
  99. data/spec/host_name_ip_address_spec.rb +8 -0
  100. data/spec/host_name_spec.rb +207 -0
  101. data/spec/http_header_name_spec.rb +25 -0
  102. data/spec/http_query_param_name_spec.rb +25 -0
  103. data/spec/http_query_param_spec.rb +104 -0
  104. data/spec/http_request_header_spec.rb +72 -0
  105. data/spec/http_request_spec.rb +168 -0
  106. data/spec/http_response_header_spec.rb +74 -0
  107. data/spec/http_response_spec.rb +103 -0
  108. data/spec/ip_address_mac_addresses_spec.rb +8 -0
  109. data/spec/ip_address_spec.rb +386 -0
  110. data/spec/mac_address_spec.rb +67 -0
  111. data/spec/migrations_spec.rb +122 -0
  112. data/spec/model/has_name_spec.rb +65 -0
  113. data/spec/model/has_unique_name_spec.rb +61 -0
  114. data/spec/model/importable_spec.rb +105 -0
  115. data/spec/models_spec.rb +60 -0
  116. data/spec/open_port_spec.rb +87 -0
  117. data/spec/organization_spec.rb +10 -0
  118. data/spec/os_guess_spec.rb +43 -0
  119. data/spec/os_spec.rb +114 -0
  120. data/spec/password_spec.rb +81 -0
  121. data/spec/port_spec.rb +102 -0
  122. data/spec/schema_migration_spec.rb +8 -0
  123. data/spec/service_credential_spec.rb +43 -0
  124. data/spec/service_spec.rb +39 -0
  125. data/spec/software_spec.rb +76 -0
  126. data/spec/software_vendor_spec.rb +33 -0
  127. data/spec/spec_helper.rb +13 -0
  128. data/spec/url_query_param_name_spec.rb +25 -0
  129. data/spec/url_query_param_spec.rb +110 -0
  130. data/spec/url_scheme_spec.rb +39 -0
  131. data/spec/url_spec.rb +951 -0
  132. data/spec/user_name_spec.rb +54 -0
  133. data/spec/vulnerability_spec.rb +8 -0
  134. data/spec/web_credential_spec.rb +72 -0
  135. metadata +266 -0
@@ -0,0 +1,32 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninUrlQueryParamNamesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_url_query_param_names, if_not_exists: true do |t|
26
+ t.string :name, length: 256, null: false
27
+
28
+ t.index :name, unique: true
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninUserNamesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_user_names, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+ t.datetime :created_at, null: false
28
+
29
+ t.index :name, unique: true
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninSoftwareVendorsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_software_vendors, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+
28
+ t.index :name, unique: true
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
+ # payload crafting functionality.
4
+ #
5
+ # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This file is part of ronin-exploits.
8
+ #
9
+ # ronin-exploits is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # ronin-exploits is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>
21
+ #
22
+
23
+ #
24
+ # @api private
25
+ #
26
+ class CreateRoninAdvisoriesTable < ActiveRecord::Migration[7.0]
27
+
28
+ def change
29
+ create_table :ronin_advisories, id: false, if_not_exists: true do |t|
30
+ t.string :id, primary_key: true, null: false
31
+
32
+ t.string :prefix, null: false
33
+ t.integer :year, null: true
34
+ t.string :identifier, null: false
35
+
36
+ t.index :id, unique: true
37
+ t.index :publisher
38
+ t.index :year
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninHostNameIpAddressesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_host_name_ip_addresses, if_not_exists: true do |t|
26
+ t.references :host_name, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_host_names
29
+ }
30
+ t.references :ip_address, null: false,
31
+ foreign_key: {
32
+ to_table: :ronin_ip_addresses
33
+ }
34
+ t.datetime :created_at, null: false
35
+
36
+ t.index [:host_name_id, :ip_address_id], unique: true,
37
+ name: :index_ronin_host_name_ip_addresses_unique
38
+ t.index :host_name_id
39
+ t.index :ip_address_id
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninHostNamesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_host_names, if_not_exists: true do |t|
26
+ t.string :name, length: 255, null: false
27
+ t.datetime :last_scanned_at
28
+ t.datetime :created_at, null: false
29
+
30
+ t.index :name, unique: true
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ #
23
+ # @api private
24
+ #
25
+ class CreateRoninArchesTable < ActiveRecord::Migration[7.0]
26
+
27
+ def change
28
+ create_table :ronin_arches, if_not_exists: true do |t|
29
+ t.string :name, null: false
30
+ t.string :endian, length: 6, null: false
31
+ t.integer :word_size, null: false
32
+
33
+ t.index :name, unique: true
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninEmailAddressesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_email_addresses, if_not_exists: true do |t|
26
+ t.string :address, length: 320, null: false
27
+ t.references :user_name, null: false,
28
+ foreign_key: {
29
+ to_table: :ronin_user_names
30
+ }
31
+ t.references :host_name, null: false,
32
+ foreign_key: {
33
+ to_table: :ronin_host_names
34
+ }
35
+ t.datetime :created_at, null: false
36
+
37
+ t.index :address, unique: true
38
+ t.index :user_name_id
39
+ t.index :host_name_id
40
+ t.index [:user_name_id, :host_name_id], unique: true
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,36 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninOsesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_oses, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+ t.string :flavor, length: 5
28
+ t.string :version, null: false
29
+
30
+ t.index [:name, :version], unique: true
31
+ t.index :name
32
+ t.index :version
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninOrganizationsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_organizations, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+ t.datetime :created_at, null: false
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninIpAddressesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_ip_addresses, if_not_exists: true do |t|
26
+ t.string :address, length: 39, null: false
27
+ t.binary :hton, null: false, length: 16
28
+ t.integer :version, null: false
29
+ t.datetime :created_at, null: false
30
+
31
+ t.index :address, unique: true
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,40 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninOsGuessesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_os_guesses, if_not_exists: true do |t|
26
+ t.references :ip_address, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_ip_addresses
29
+ }
30
+ t.references :os, null: false,
31
+ foreign_key: {
32
+ to_table: :ronin_oses
33
+ }
34
+ t.datetime :created_at, null: false
35
+
36
+ t.index [:ip_address_id, :os_id], unique: true
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninUrlQueryParamsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_url_query_params, if_not_exists: true do |t|
26
+ t.references :name, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_url_query_param_names
29
+ }
30
+ t.text :value
31
+ t.references :url, null: false,
32
+ foreign_key: {
33
+ to_table: :ronin_urls
34
+ }
35
+
36
+ t.index [:name_id, :url_id], unique: true
37
+ t.index :name_id
38
+ t.index :url_id
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninPasswordsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_passwords, if_not_exists: true do |t|
26
+ t.string :plain_text, null: false
27
+
28
+ t.index :plain_text, unique: true
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninOpenPortsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_open_ports, if_not_exists: true do |t|
26
+ t.references :ip_address, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_ip_addresses
29
+ }
30
+ t.references :port, null: false,
31
+ foreign_key: {
32
+ to_table: :ronin_ports
33
+ }
34
+ t.references :service, null: true,
35
+ foreign_key: {
36
+ to_table: :ronin_services
37
+ }
38
+ t.datetime :last_scanned_at, null: true
39
+ t.datetime :created_at, null: false
40
+
41
+ t.index [:ip_address_id, :port_id, :service_id], unique: true,
42
+ name: :index_ronin_open_ports_unique
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,50 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninUrlsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_urls, if_not_exists: true do |t|
26
+ t.references :scheme, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_url_schemes
29
+ }
30
+ t.references :host_name, null: false,
31
+ foreign_key: {
32
+ to_table: :ronin_host_names
33
+ }
34
+ t.references :port, null: false,
35
+ foreign_key: {
36
+ to_table: :ronin_ports
37
+ }
38
+ t.string :path
39
+ t.string :query
40
+ t.string :fragment
41
+ t.datetime :last_scanned_at
42
+ t.datetime :created_at, null: false
43
+
44
+ t.index :scheme_id
45
+ t.index :host_name_id
46
+ t.index :port_id
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
+ #
4
+ # Copyright (c) 2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This file is part of ronin-db-activerecord.
7
+ #
8
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ class CreateRoninSoftwaresTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_softwares, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+ t.string :version, null: false
28
+ t.references :vendor, foreign_key: {
29
+ to_table: :ronin_software_vendors
30
+ }
31
+
32
+ t.index [:name, :version], unique: true
33
+ t.index :name
34
+ t.index :version
35
+ t.index :vendor_id
36
+ end
37
+ end
38
+
39
+ end