ronin-db-activerecord 0.1.0.beta2 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -0
  3. data/.rubocop.yml +16 -0
  4. data/ChangeLog.md +11 -1
  5. data/Gemfile +4 -0
  6. data/README.md +68 -34
  7. data/Rakefile +3 -3
  8. data/db/migrate/{0014_create_ronin_ip_addresses_table.rb → 0001_create_ronin_ip_addresses_table.rb} +4 -0
  9. data/db/migrate/{0021_create_ronin_mac_addresses_table.rb → 0002_create_ronin_mac_addresses_table.rb} +4 -0
  10. data/db/migrate/{0001_create_ronin_ip_address_mac_addresses_table.rb → 0003_create_ronin_ip_address_mac_addresses_table.rb} +4 -0
  11. data/db/migrate/{0009_create_ronin_host_names_table.rb → 0004_create_ronin_host_names_table.rb} +4 -0
  12. data/db/migrate/{0025_create_ronin_ports_table.rb → 0005_create_ronin_ports_table.rb} +4 -0
  13. data/db/migrate/{0023_create_ronin_services_table.rb → 0006_create_ronin_services_table.rb} +4 -0
  14. data/db/migrate/{0018_create_ronin_open_ports_table.rb → 0007_create_ronin_open_ports_table.rb} +4 -0
  15. data/db/migrate/{0003_create_ronin_url_schemes_table.rb → 0008_create_ronin_url_schemes_table.rb} +4 -0
  16. data/db/migrate/{0019_create_ronin_urls_table.rb → 0009_create_ronin_urls_table.rb} +5 -0
  17. data/db/migrate/0010_create_ronin_advisories_table.rb +45 -0
  18. data/db/migrate/{0002_create_ronin_vulnerabilities_table.rb → 0011_create_ronin_vulnerabilities_table.rb} +14 -11
  19. data/db/migrate/{0004_create_ronin_url_query_param_names_table.rb → 0012_create_ronin_url_query_param_names_table.rb} +4 -0
  20. data/db/migrate/{0005_create_ronin_user_names_table.rb → 0013_create_ronin_user_names_table.rb} +4 -0
  21. data/db/migrate/{0006_create_ronin_software_vendors_table.rb → 0014_create_ronin_software_vendors_table.rb} +4 -0
  22. data/db/migrate/{0008_create_ronin_host_name_ip_addresses_table.rb → 0015_create_ronin_host_name_ip_addresses_table.rb} +4 -0
  23. data/db/migrate/{0010_create_ronin_arches_table.rb → 0016_create_ronin_arches_table.rb} +3 -0
  24. data/db/migrate/{0011_create_ronin_email_addresses_table.rb → 0017_create_ronin_email_addresses_table.rb} +4 -0
  25. data/db/migrate/{0012_create_ronin_oses_table.rb → 0018_create_ronin_oses_table.rb} +4 -0
  26. data/db/migrate/{0013_create_ronin_organizations_table.rb → 0019_create_ronin_organizations_table.rb} +4 -0
  27. data/db/migrate/{0015_create_ronin_os_guesses_table.rb → 0020_create_ronin_os_guesses_table.rb} +4 -0
  28. data/db/migrate/{0016_create_ronin_url_query_params_table.rb → 0021_create_ronin_url_query_params_table.rb} +4 -0
  29. data/db/migrate/{0017_create_ronin_passwords_table.rb → 0022_create_ronin_passwords_table.rb} +4 -0
  30. data/db/migrate/{0020_create_ronin_softwares_table.rb → 0023_create_ronin_softwares_table.rb} +5 -3
  31. data/db/migrate/{0022_create_ronin_countries_table.rb → 0024_create_ronin_countries_table.rb} +4 -0
  32. data/db/migrate/{0024_create_ronin_credentials_table.rb → 0025_create_ronin_credentials_table.rb} +4 -0
  33. data/db/migrate/0026_create_ronin_asns_table.rb +4 -0
  34. data/db/migrate/0027_create_ronin_http_query_param_names_table.rb +4 -0
  35. data/db/migrate/{0033_create_ronin_http_responses_table.rb → 0028_create_ronin_http_responses_table.rb} +5 -3
  36. data/db/migrate/{0032_create_ronin_http_requests_table.rb → 0029_create_ronin_http_requests_table.rb} +5 -3
  37. data/db/migrate/{0028_create_ronin_http_query_params_table.rb → 0030_create_ronin_http_query_params_table.rb} +4 -0
  38. data/db/migrate/{0029_create_ronin_http_header_names_table.rb → 0031_create_ronin_http_header_names_table.rb} +4 -0
  39. data/db/migrate/{0030_create_ronin_http_request_headers_table.rb → 0032_create_ronin_http_request_headers_table.rb} +4 -0
  40. data/db/migrate/{0031_create_ronin_http_response_headers_table.rb → 0033_create_ronin_http_response_headers_table.rb} +4 -0
  41. data/db/migrate/0034_create_ronin_service_credentials_table.rb +4 -0
  42. data/db/migrate/0035_create_ronin_web_credentials_table.rb +4 -0
  43. data/gemspec.yml +1 -1
  44. data/lib/ronin/db/advisory.rb +5 -5
  45. data/lib/ronin/db/asn.rb +3 -3
  46. data/lib/ronin/db/host_name.rb +1 -1
  47. data/lib/ronin/db/http_response.rb +1 -1
  48. data/lib/ronin/db/ip_address.rb +1 -1
  49. data/lib/ronin/db/mac_address.rb +2 -2
  50. data/lib/ronin/db/migrations.rb +11 -8
  51. data/lib/ronin/db/model/has_unique_name.rb +3 -5
  52. data/lib/ronin/db/model/importable.rb +3 -0
  53. data/lib/ronin/db/model/last_scanned_at.rb +3 -0
  54. data/lib/ronin/db/model.rb +3 -0
  55. data/lib/ronin/db/models.rb +3 -0
  56. data/lib/ronin/db/password.rb +3 -3
  57. data/lib/ronin/db/url.rb +20 -23
  58. data/lib/ronin/db/url_scheme.rb +1 -1
  59. data/lib/ronin/db/vulnerability.rb +4 -0
  60. data/ronin-db-activerecord.gemspec +3 -3
  61. metadata +34 -33
  62. data/db/migrate/0007_create_ronin_advisories_table.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b716d66b7a23c90ef57e953549410a5633fd311dceddecfbdd828631704807a5
4
- data.tar.gz: 54f60124c41e866c01ff469bc2335d72270380b871172b0ca9cde6adc567a286
3
+ metadata.gz: 7721bd84ea50f21af938f496faf1699c3107782131ca9db874eb101b19abf759
4
+ data.tar.gz: f4394aed731c6f2d83124d870ba29da9258c034828bc4ca96643f5a9b9267d46
5
5
  SHA512:
6
- metadata.gz: 4c302303bb760dd4f7959f1b7c2b7bafa348466a93b6f9dca5b03dd1739006ada03471c9b5d3c4855d63ebd71adb8ac6172e40a7b7609080972b852132886e21
7
- data.tar.gz: 22b82fc755709957d68b48d617c48267af335123ef53f24e82a1ffdff38d330b58d86a4d2b9ddaa7d7fb4c202ff28b6bb08a6a7068b09ba871b2f21715f831cb
6
+ metadata.gz: 2e4d44293f4877cfa1e2aa1c806b6f1b3ada40c58fe0b1d38702bc41dce1c898c7d89f6684bf24bf28888db87f7560c141fda2ea504c3ac5134c8603f0ce8e63
7
+ data.tar.gz: 2f003abce7ad7327b7c843ccb12d272af041f2b2f058afb3e2e7bb573e2ef9986aa8dd9c2fa35179837e21e3aef929524b389459de3ee12e06bce1c05ed77b50
@@ -30,3 +30,17 @@ jobs:
30
30
  run: bundle install --jobs 4 --retry 3
31
31
  - name: Run tests
32
32
  run: bundle exec rake test
33
+
34
+ # rubocop linting
35
+ rubocop:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: 3.0
43
+ - name: Install dependencies
44
+ run: bundle install --jobs 4 --retry 3
45
+ - name: Run rubocop
46
+ run: bundle exec rubocop --parallel
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+
6
+ inherit_gem:
7
+ rubocop-ronin: rubocop.yml
8
+
9
+ #
10
+ # ronin-db-activerecord specific exceptions
11
+ #
12
+
13
+ # robucop mistakes :x86_64 for a "symbol number"
14
+ Naming/VariableNumber:
15
+ AllowedIdentifiers:
16
+ - x86_64
data/ChangeLog.md CHANGED
@@ -1,4 +1,14 @@
1
- ### 0.1.0 / 2023-XX-XX
1
+ ### 0.1.1 / 2023-04-04
2
+
3
+ * Reordered database migrations so they can be ran in correct order on
4
+ PostgreSQL databases.
5
+ * Fixed {Ronin::DB::URL.import} to correctly de-duplicate pre-existing URLs.
6
+ * Fixed `ronin_advisories.publisher` index on non-existent column.
7
+ * Added an index on the `ronin_advisories.identifier` column.
8
+ * Added missing unique index to `ronin_urls` table.
9
+ * Documentation improvements.
10
+
11
+ ### 0.1.0 / 2023-02-01
2
12
 
3
13
  * Initial release:
4
14
  * Can be used both as a standalone library or in a web app.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -24,4 +26,6 @@ group :development do
24
26
  gem 'dead_end', require: false
25
27
  gem 'sord', require: false, platform: :mri
26
28
  gem 'stackprof', require: false, platform: :mri
29
+ gem 'rubocop', require: false, platform: :mri
30
+ gem 'rubocop-ronin', require: false, platform: :mri
27
31
  end
data/README.md CHANGED
@@ -21,42 +21,76 @@ ronin-db-activerecord contains [ActiveRecord] models and migrations for the
21
21
 
22
22
  * Can be used both as a standalone library or in a web app.
23
23
  * Provides common [ActiveRecord] models:
24
- * {Ronin::DB::Advisory}
25
- * {Ronin::DB::Arch}
26
- * {Ronin::DB::ASN}
27
- * {Ronin::DB::EmailAddress}
28
- * {Ronin::DB::HostName}
29
- * {Ronin::DB::HostNameIPAddress}
30
- * {Ronin::DB::HTTPHeaderName}
31
- * {Ronin::DB::HTTPQueryParam}
32
- * {Ronin::DB::HTTPQueryParamName}
33
- * {Ronin::DB::HTTPRequest}
34
- * {Ronin::DB::HTTPRequestHeader}
35
- * {Ronin::DB::HTTPResponse}
36
- * {Ronin::DB::HTTPResponseHeader}
37
- * {Ronin::DB::IPAddress}
38
- * {Ronin::DB::IPAddressMACAddress}
39
- * {Ronin::DB::MACAddress}
40
- * {Ronin::DB::OpenPort}
41
- * {Ronin::DB::Organization}
42
- * {Ronin::DB::OS}
43
- * {Ronin::DB::OSGuess}
44
- * {Ronin::DB::Password}
45
- * {Ronin::DB::Port}
46
- * {Ronin::DB::Service}
47
- * {Ronin::DB::ServiceCredential}
48
- * {Ronin::DB::Software}
49
- * {Ronin::DB::SoftwareVendor}
50
- * {Ronin::DB::URL}
51
- * {Ronin::DB::URLQueryParam}
52
- * {Ronin::DB::URLQueryParamName}
53
- * {Ronin::DB::URLScheme}
54
- * {Ronin::DB::UserName}
55
- * {Ronin::DB::Vulnerability}
56
- * {Ronin::DB::WebCredential}
57
- * Has 96% documentation coverage.
24
+ * [Ronin::DB::Advisory]
25
+ * [Ronin::DB::Arch]
26
+ * [Ronin::DB::ASN]
27
+ * [Ronin::DB::EmailAddress]
28
+ * [Ronin::DB::HostName]
29
+ * [Ronin::DB::HostNameIPAddress]
30
+ * [Ronin::DB::HTTPHeaderName]
31
+ * [Ronin::DB::HTTPQueryParam]
32
+ * [Ronin::DB::HTTPQueryParamName]
33
+ * [Ronin::DB::HTTPRequest]
34
+ * [Ronin::DB::HTTPRequestHeader]
35
+ * [Ronin::DB::HTTPResponse]
36
+ * [Ronin::DB::HTTPResponseHeader]
37
+ * [Ronin::DB::IPAddress]
38
+ * [Ronin::DB::IPAddressMACAddress]
39
+ * [Ronin::DB::MACAddress]
40
+ * [Ronin::DB::OpenPort]
41
+ * [Ronin::DB::Organization]
42
+ * [Ronin::DB::OS]
43
+ * [Ronin::DB::OSGuess]
44
+ * [Ronin::DB::Password]
45
+ * [Ronin::DB::Port]
46
+ * [Ronin::DB::Service]
47
+ * [Ronin::DB::ServiceCredential]
48
+ * [Ronin::DB::Software]
49
+ * [Ronin::DB::SoftwareVendor]
50
+ * [Ronin::DB::URL]
51
+ * [Ronin::DB::URLQueryParam]
52
+ * [Ronin::DB::URLQueryParamName]
53
+ * [Ronin::DB::URLScheme]
54
+ * [Ronin::DB::UserName]
55
+ * [Ronin::DB::Vulnerability]
56
+ * [Ronin::DB::WebCredential]
57
+ * Has 98% documentation coverage.
58
58
  * Has 99% test coverage.
59
59
 
60
+ [Ronin::DB::Advisory]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Advisory.html
61
+ [Ronin::DB::Arch]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Arch.html
62
+ [Ronin::DB::ASN]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/ASN.html
63
+ [Ronin::DB::EmailAddress]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/EmailAddress.html
64
+ [Ronin::DB::HostName]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HostName.html
65
+ [Ronin::DB::HostNameIPAddress]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HostNameIPAddress.html
66
+ [Ronin::DB::HTTPHeaderName]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPHeaderName.html
67
+ [Ronin::DB::HTTPQueryParam]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPQueryParam.html
68
+ [Ronin::DB::HTTPQueryParamName]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPQueryParamName.html
69
+ [Ronin::DB::HTTPRequest]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPRequest.html
70
+ [Ronin::DB::HTTPRequestHeader]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPRequestHeader.html
71
+ [Ronin::DB::HTTPResponse]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPResponse.html
72
+ [Ronin::DB::HTTPResponseHeader]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/HTTPResponseHeader.html
73
+ [Ronin::DB::IPAddress]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/IPAddress.html
74
+ [Ronin::DB::IPAddressMACAddress]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/IPAddressMACAddress.html
75
+ [Ronin::DB::MACAddress]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/MACAddress.html
76
+ [Ronin::DB::OpenPort]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/OpenPort.html
77
+ [Ronin::DB::Organization]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Organization.html
78
+ [Ronin::DB::OS]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/OS.html
79
+ [Ronin::DB::OSGuess]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/OSGuess.html
80
+ [Ronin::DB::Password]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Password.html
81
+ [Ronin::DB::Port]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Port.html
82
+ [Ronin::DB::Service]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Service.html
83
+ [Ronin::DB::ServiceCredential]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/ServiceCredential.html
84
+ [Ronin::DB::Software]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Software.html
85
+ [Ronin::DB::SoftwareVendor]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/SoftwareVendor.html
86
+ [Ronin::DB::URL]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/URL.html
87
+ [Ronin::DB::URLQueryParam]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/URLQueryParam.html
88
+ [Ronin::DB::URLQueryParamName]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/URLQueryParamName.html
89
+ [Ronin::DB::URLScheme]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/URLScheme.html
90
+ [Ronin::DB::UserName]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/UserName.html
91
+ [Ronin::DB::Vulnerability]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/Vulnerability.html
92
+ [Ronin::DB::WebCredential]: https://ronin-rb.dev/docs/ronin-db-activerecord/Ronin/DB/WebCredential.html
93
+
60
94
  ## Examples
61
95
 
62
96
  Create a database:
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'bundler'
5
5
  rescue LoadError => e
6
6
  warn e.message
7
7
  warn "Run `gem install bundler` to install Bundler"
8
- exit -1
8
+ exit(-1)
9
9
  end
10
10
 
11
11
  begin
@@ -67,6 +67,6 @@ namespace :db do
67
67
  require 'irb'
68
68
  include Ronin::DB
69
69
  ARGV.clear
70
- IRB.start()
70
+ IRB.start
71
71
  end
72
72
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_ip_addresses` table.
25
+ #
22
26
  class CreateRoninIpAddressesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_mac_addresses` table.
25
+ #
22
26
  class CreateRoninMacAddressesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_ip_address_mac_addresses` table.
25
+ #
22
26
  class CreateRoninIpAddressMacAddressesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_host_names` table.
25
+ #
22
26
  class CreateRoninHostNamesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_ports` table.
25
+ #
22
26
  class CreateRoninPortsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_services` table.
25
+ #
22
26
  class CreateRoninServicesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_open_ports` table.
25
+ #
22
26
  class CreateRoninOpenPortsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_url_schemes` table.
25
+ #
22
26
  class CreateRoninUrlSchemesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_urls` table.
25
+ #
22
26
  class CreateRoninUrlsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -44,6 +48,7 @@ class CreateRoninUrlsTable < ActiveRecord::Migration[7.0]
44
48
  t.index :scheme_id
45
49
  t.index :host_name_id
46
50
  t.index :port_id
51
+ t.index [:scheme_id, :host_name_id, :port_id, :path, :query, :fragment], unique: true, name: 'url_index'
47
52
  end
48
53
  end
49
54
 
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
4
+ #
5
+ # Copyright (c) 2022-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This file is part of ronin-db-activerecord.
8
+ #
9
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU Lesser General Public License as published
11
+ # by the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # ronin-db-activerecord 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 Lesser General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU Lesser General Public License
20
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
21
+ #
22
+
23
+ #
24
+ # Creates the `ronin_advisories` table.
25
+ #
26
+ # @api private
27
+ #
28
+ class CreateRoninAdvisoriesTable < ActiveRecord::Migration[7.0]
29
+
30
+ def change
31
+ create_table :ronin_advisories, id: false, if_not_exists: true do |t|
32
+ t.string :id, primary_key: true, null: false
33
+
34
+ t.string :prefix, null: false
35
+ t.integer :year, null: true
36
+ t.string :identifier, null: false
37
+
38
+ t.index :id, unique: true
39
+ t.index :prefix
40
+ t.index :year
41
+ t.index :identifier
42
+ end
43
+ end
44
+
45
+ end
@@ -1,25 +1,28 @@
1
+ # frozen_string_literal: true
1
2
  #
2
- # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
- # payload crafting functionality.
3
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
4
4
  #
5
- # Copyright (c) 2007-2022-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2022-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
- # This file is part of ronin-exploits.
7
+ # This file is part of ronin-db-activerecord.
8
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
9
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU Lesser General Public License as published
11
+ # by the Free Software Foundation, either version 3 of the License, or
12
12
  # (at your option) any later version.
13
13
  #
14
- # ronin-exploits is distributed in the hope that it will be useful,
14
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
15
15
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
16
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU General Public License for more details.
17
+ # GNU Lesser General Public License for more details.
18
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/>
19
+ # You should have received a copy of the GNU Lesser General Public License
20
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
21
21
  #
22
22
 
23
+ #
24
+ # Creates the `ronin_vulnerabilities` table.
25
+ #
23
26
  class CreateRoninVulnerabilitiesTable < ActiveRecord::Migration[7.0]
24
27
 
25
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_url_query_param_names` table.
25
+ #
22
26
  class CreateRoninUrlQueryParamNamesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_user_names` table.
25
+ #
22
26
  class CreateRoninUserNamesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_software_vendors` table.
25
+ #
22
26
  class CreateRoninSoftwareVendorsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_host_name_ip_addresses` table.
25
+ #
22
26
  class CreateRoninHostNameIpAddressesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,8 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_arches` table.
22
25
  #
23
26
  # @api private
24
27
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_email_addresses` table.
25
+ #
22
26
  class CreateRoninEmailAddressesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_oses` table.
25
+ #
22
26
  class CreateRoninOsesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_organizations` table.
25
+ #
22
26
  class CreateRoninOrganizationsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_os_guesses` table.
25
+ #
22
26
  class CreateRoninOsGuessesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_url_query_params` table.
25
+ #
22
26
  class CreateRoninUrlQueryParamsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_passwords` table.
25
+ #
22
26
  class CreateRoninPasswordsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,15 +20,16 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_softwares` table.
25
+ #
22
26
  class CreateRoninSoftwaresTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
25
29
  create_table :ronin_softwares, if_not_exists: true do |t|
26
30
  t.string :name, null: false
27
31
  t.string :version, null: false
28
- t.references :vendor, foreign_key: {
29
- to_table: :ronin_software_vendors
30
- }
32
+ t.references :vendor, foreign_key: {to_table: :ronin_software_vendors}
31
33
 
32
34
  t.index [:name, :version], unique: true
33
35
  t.index :name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_countries` table.
25
+ #
22
26
  class CreateRoninCountriesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change