ronin-db 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb843bad7ea3acbc3e60ab034a6a7eae3d89b95433a46e80ee92c49d38a0d7e1
4
- data.tar.gz: 37af4e6642c8a551df6b83547ae96c642359c3e3964e0bae173cbd9bf7d34e39
3
+ metadata.gz: e887e863b916cfbb31dcccf48adfb04ed662e5ecc8012e749d6389f1b9149a5a
4
+ data.tar.gz: 698d79788a12a30cd7fd03d9295d76dfe98e12911aef13d4a830f35c1a99ac29
5
5
  SHA512:
6
- metadata.gz: 1480524a5b1356e1206f1a24dc928faf9c37e7b54109949180626dd5be4bd0b32e93f36a3b3527a9fe6f9ed70d3699ab94bd50c1fcf38f185ef1359afac734e6
7
- data.tar.gz: 8a02d484ff3620a7165940d5eb77b5815f57571768c6353aaffdba5358700ea9114f629f42918a97d70938b77a5bd9547ac6851e7fd875be2136b4c92c44d77c
6
+ metadata.gz: 655172b999161aeec34794d90fd279e8d468e280a67b07f1db03f3659facedc99ad053c508e9245e40bb6623fae792cec2f241a476ece1fe178bbcd75674c198
7
+ data.tar.gz: 21e77b67c29ed5cc37aea7888d80b0547375eb7140bf1491283789750505ef35344bd53b185aef251b36a7186cb33001aa849728b2c6f13cb3a618b3ba916448
@@ -16,7 +16,7 @@ jobs:
16
16
  - truffleruby
17
17
  name: Ruby ${{ matrix.ruby }}
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v4
20
20
  - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
@@ -35,7 +35,7 @@ jobs:
35
35
  rubocop:
36
36
  runs-on: ubuntu-latest
37
37
  steps:
38
- - uses: actions/checkout@v2
38
+ - uses: actions/checkout@v4
39
39
  - name: Set up Ruby
40
40
  uses: ruby/setup-ruby@v1
41
41
  with:
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.1.3 / 2023-12-13
2
+
3
+ * Fixed a bug in {Ronin::DB::ConfigFile.edit} when `YAML::Store` would attempt
4
+ to create the config file but the parent directory did not exist yet.
5
+
1
6
  ### 0.1.2 / 2023-09-19
2
7
 
3
8
  * Fixed a typo in an exception message in {Ronin::DB.connect}.
@@ -21,6 +21,7 @@
21
21
  require 'ronin/db/exceptions'
22
22
  require 'ronin/db/home'
23
23
 
24
+ require 'fileutils'
24
25
  require 'yaml'
25
26
  require 'yaml/store'
26
27
 
@@ -65,21 +66,21 @@ module Ronin
65
66
  #
66
67
  def self.validate(path,data)
67
68
  unless data.kind_of?(Hash)
68
- raise(InvalidConfig)
69
+ raise(InvalidConfig,"config data must be a Hash: #{data.inspect}")
69
70
  end
70
71
 
71
72
  data.each do |key,value|
72
- unless (key.kind_of?(Symbol) || key.kind_of?(String))
73
- raise(InvalidConfig)
73
+ unless key.kind_of?(Symbol)
74
+ raise(InvalidConfig,"all Hash keys must be a Symbol: #{key.inspect}")
74
75
  end
75
76
 
76
77
  unless value.kind_of?(Hash)
77
- raise(InvalidConfig)
78
+ raise(InvalidConfig,"all Hash values must also be a Hash: #{value.inspect}")
78
79
  end
79
80
 
80
81
  value.each_key do |sub_key|
81
- unless (sub_key.kind_of?(Symbol) || sub_key.kind_of?(String))
82
- raise(InvalidConfig)
82
+ unless sub_key.kind_of?(Symbol)
83
+ raise(InvalidConfig,"all sub-keys must be a Symbol: #{sub_key.inspect}")
83
84
  end
84
85
  end
85
86
  end
@@ -124,8 +125,12 @@ module Ronin
124
125
  # The loaded YAML configuration data.
125
126
  #
126
127
  def self.edit(path=PATH,&block)
127
- store = YAML::Store.new(path)
128
+ unless File.file?(path)
129
+ # create the parent directory for YAML::Store
130
+ FileUtils.mkdir_p(File.dirname(path))
131
+ end
128
132
 
133
+ store = YAML::Store.new(path)
129
134
  store.transaction(&block)
130
135
  end
131
136
  end
@@ -20,7 +20,16 @@
20
20
 
21
21
  module Ronin
22
22
  module DB
23
+ #
24
+ # Indicates that the given database name is not in the config file.
25
+ #
23
26
  class UnknownDatabase < RuntimeError
24
27
  end
28
+
29
+ #
30
+ # Indicates that the config file is corrupted.
31
+ #
32
+ class InvalidConfig < RuntimeError
33
+ end
25
34
  end
26
35
  end
@@ -21,6 +21,6 @@
21
21
  module Ronin
22
22
  module DB
23
23
  # ronin-db version
24
- VERSION = '0.1.2'
24
+ VERSION = '0.1.3'
25
25
  end
26
26
  end
data/lib/ronin/db.rb CHANGED
@@ -91,6 +91,15 @@ module Ronin
91
91
  # @raise [ArgumentError]
92
92
  # The given database was not a Symbol or a Hash.
93
93
  #
94
+ # @example Connect to the default database (`~/.local/share/ronin-db/default.sqlite3`):
95
+ # DB.connect
96
+ #
97
+ # @example Connect to a specific database from the configuration file (`~/.config/ronin-db/databases.yml`):
98
+ # DB.connect(:my_database)
99
+ #
100
+ # @example Connect to an arbitrary database:
101
+ # Db.connect({adapter: 'sqlite3', database: '/path/to/database.sqlite3'})
102
+ #
94
103
  # @api semipublic
95
104
  #
96
105
  def self.connect(database=:default, migrate: nil, load_models: true)
data/man/ronin-db-add.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-add 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db add\fR \[lB]\fIoptions\fP\[rB] \fINAME\fP \[lB]\fIURI\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-asn.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-asn 1 "2023-02-01" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db asn\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-creds.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-creds 1 "2023-01-02" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db creds\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-edit.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-edit 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db edit\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-emails 1 "2023-02-01" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db emails\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
@@ -59,7 +59,7 @@ Searches for email addresses associated with the \fIHOST\fP\.
59
59
  \fB-I\fR, \fB--with-ip\fR \fIIP\fP
60
60
  Searches for email addresses associated with the IP address\.
61
61
  .LP
62
- .HP
62
+ .PP
63
63
  \fB-u\fR, \fB--with-users\fR \fINAME\fP \[lB]\.\.\.\[rB]
64
64
  Searches for email addresses associated with the user NAME(s)\.
65
65
  .LP
data/man/ronin-db-hosts.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-hosts 1 "2023-02-01" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db hosts\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-ips.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-ips 1 "2023-02-01" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db ips\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-irb.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-irb 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db irb\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-list.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-list 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db list\fR \[lB]\fIoptions\fP\[rB] \[lB]\fINAME\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-migrate 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db migrate\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-remove 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db remove\fR \[lB]\fIoptions\fP\[rB] \fINAME\fP
9
9
  .LP
10
10
  .SH DESCRIPTION
data/man/ronin-db-urls.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
3
  .TH ronin-db-urls 1 "2023-02-01" Ronin "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db urls\fR \[lB]\fIoptions\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
@@ -71,11 +71,11 @@ Searches for URLs associated with the \fIPORT\fP\.
71
71
  \fB-d\fR, \fB--directory\fR \fIDIRECTORY\fP
72
72
  Searches for URLs sharing the DIRECTORY\.
73
73
  .LP
74
- .HP
74
+ .PP
75
75
  \fB-q\fR, \fB--with-query-param\fR \fINAME\fP \[lB]\.\.\.\[rB]
76
76
  Searches for URLs containing the query\-param NAME\.
77
77
  .LP
78
- .HP
78
+ .PP
79
79
  \fB-Q\fR, \fB--with-query-value\fR \fIVALUE\fP \[lB]\.\.\.\[rB]
80
80
  Searches for URLs containing the query\-param VALUE\.
81
81
  .LP
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3