ronin-db-activerecord 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
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,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 CreateRoninMacAddressesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_mac_addresses, if_not_exists: true do |t|
26
+ t.string :address, length: 17, null: false
27
+ t.datetime :created_at, null: false
28
+
29
+ t.index :address, unique: true
30
+ end
31
+ end
32
+
33
+ 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 CreateRoninCountriesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_countries, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+ t.string :code, length: 2, null: false
28
+
29
+ t.index :name, unique: true
30
+ t.index :code, unique: true
31
+ end
32
+ end
33
+
34
+ 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 CreateRoninServicesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_services, 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,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 CreateRoninCredentialsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_credentials, if_not_exists: true do |t|
26
+ t.references :user_name, null: true,
27
+ foreign_key: {
28
+ to_table: :ronin_user_names
29
+ }
30
+ t.references :email_address, null: true,
31
+ foreign_key: {
32
+ to_table: :ronin_email_addresses
33
+ }
34
+ t.references :password, null: false,
35
+ foreign_key: {
36
+ to_table: :ronin_passwords
37
+ }
38
+
39
+ t.index [:user_name_id, :password_id, :email_address_id], unique: true,
40
+ name: :index_ronin_credentials_table_unique
41
+ end
42
+ end
43
+
44
+ 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 CreateRoninPortsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_ports, if_not_exists: true do |t|
26
+ t.string :protocol, length: 4, null: false
27
+ t.integer :number, null: false
28
+
29
+ t.index [:protocol, :number], unique: true
30
+ end
31
+ end
32
+
33
+ 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 CreateRoninAsnsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_asns, if_not_exists: true do |t|
26
+ t.integer :version, null: false
27
+
28
+ t.string :range_start, null: false
29
+ t.string :range_end, null: false
30
+
31
+ t.binary :range_start_hton, null: false, length: 16
32
+ t.binary :range_end_hton, null: false, length: 16
33
+
34
+ t.integer :number, null: false
35
+ t.string :country_code, null: true
36
+ t.string :name, null: true
37
+
38
+ t.index :range_start_hton
39
+ t.index :range_end_hton
40
+ t.index [:range_start, :range_end], unique: true
41
+ end
42
+ end
43
+
44
+ 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 CreateRoninHttpQueryParamNamesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_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,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 CreateRoninHttpQueryParamsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_query_params, if_not_exists: true do |t|
26
+ t.references :name, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_http_query_param_names
29
+ }
30
+ t.text :value
31
+ t.references :request, null: false,
32
+ foreign_key: {
33
+ to_table: :ronin_http_requests
34
+ }
35
+
36
+ t.index [:name_id, :request_id], unique: true
37
+ t.index :name_id
38
+ t.index :request_id
39
+ end
40
+ end
41
+
42
+ 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 CreateRoninHttpHeaderNamesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_header_names, if_not_exists: true do |t|
26
+ t.string :name, null: false
27
+
28
+ t.index :name, unique: true
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,41 @@
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 CreateRoninHttpRequestHeadersTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_request_headers, if_not_exists: true do |t|
26
+ t.references :name, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_http_header_names
29
+ }
30
+
31
+ t.text :value, null: false
32
+
33
+ t.references :request, null: false,
34
+ foreign_key: {
35
+ to_table: :ronin_http_requests
36
+ }
37
+
38
+ t.index [:name_id, :request_id], unique: true
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
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 CreateRoninHttpResponseHeadersTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_response_headers, if_not_exists: true do |t|
26
+ t.references :name, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_http_header_names
29
+ }
30
+
31
+ t.text :value, null: false
32
+
33
+ t.references :response, null: false,
34
+ foreign_key: {
35
+ to_table: :ronin_http_responses
36
+ }
37
+
38
+ t.index [:name_id, :response_id], unique: true
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
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 CreateRoninHttpRequestsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_requests, if_not_exists: true do |t|
26
+ t.string :request_method, length: 9, null: false
27
+ t.string :version, length: 3, null: false
28
+ t.string :path, null: false
29
+ t.text :body
30
+
31
+ t.references :response, foreign_key: {
32
+ to_table: :ronin_http_responses
33
+ }
34
+
35
+ t.datetime :created_at, null: false
36
+
37
+ t.index :request_method
38
+ t.index :path
39
+ end
40
+ end
41
+ 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 CreateRoninHttpResponsesTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_http_responses, if_not_exists: true do |t|
26
+ t.integer :status, null: false
27
+ t.text :body
28
+
29
+ t.references :response, foreign_key: {
30
+ to_table: :ronin_http_responses
31
+ }
32
+
33
+ t.datetime :created_at, null: false
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
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 CreateRoninServiceCredentialsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_service_credentials, if_not_exists: true do |t|
26
+ t.references :credential, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_credentials
29
+ }
30
+
31
+ t.references :open_port, null: false,
32
+ foreign_key: {
33
+ to_table: :ronin_open_ports
34
+ }
35
+
36
+ t.index [:credential_id, :open_port_id], unique: true,
37
+ name: :index_ronin_service_credentials_table_unique
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,41 @@
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 CreateRoninWebCredentialsTable < ActiveRecord::Migration[7.0]
23
+
24
+ def change
25
+ create_table :ronin_web_credentials, if_not_exists: true do |t|
26
+ t.references :credential, null: false,
27
+ foreign_key: {
28
+ to_table: :ronin_credentials
29
+ }
30
+
31
+ t.references :url, null: false,
32
+ foreign_key: {
33
+ to_table: :ronin_urls
34
+ }
35
+
36
+ t.index [:credential_id, :url_id], unique: true,
37
+ name: :index_ronin_web_credentials_table_unique
38
+ end
39
+ end
40
+
41
+ end
data/gemspec.yml ADDED
@@ -0,0 +1,28 @@
1
+ name: ronin-db-activerecord
2
+ version: 0.1.0.beta1
3
+ summary: ActiveRecord backend for the Ronin Database
4
+ description:
5
+ ronin-db-activerecord contains ActiveRecord models and migrations for the
6
+ Ronin Database.
7
+
8
+ license: LGPL-3.0
9
+ authors: Postmodern
10
+ email: postmodern.mod3@gmail.com
11
+ homepage: https://ronin-rb.dev/
12
+ has_yard: true
13
+
14
+ metadata:
15
+ documentation_uri: https://rubydoc.info/gems/ronin-db-activerecord
16
+ source_code_uri: https://github.com/ronin-rb/ronin-db-activerecord
17
+ bug_tracker_uri: https://github.com/ronin-rb/ronin-db-activerecord/issues
18
+ changelog_uri: https://github.com/ronin-rb/ronin-db-activerecord/blob/master/ChangeLog.md
19
+ rubygems_mfa_required: 'true'
20
+
21
+ required_ruby_version: ">= 3.0.0"
22
+
23
+ dependencies:
24
+ uri-query_params: ~> 0.6
25
+ activerecord: ~> 7.0
26
+
27
+ development_dependencies:
28
+ bundler: ~> 2.0