pass-station 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pass_station/output.rb +17 -17
- data/lib/pass_station/parse.rb +1 -1
- data/lib/pass_station/search.rb +2 -2
- data/lib/pass_station/source.rb +4 -6
- data/lib/pass_station/version.rb +1 -1
- data/lib/pass_station.rb +4 -4
- metadata +5 -136
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b31b81d976f3ffc9c63384b5bdcf829af5fca16bf28a955f5610c9b827125b
|
4
|
+
data.tar.gz: a498b1e9f6708cc4525135edadca428b5021c0832b38e6f8ae66ca873efb3157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e3622f6afecdcf0125438a13ef399a11847aa08a3b45e1b4f1d98353926336b0bac82f5b76cd67a3f79265de927a569808f903e8ed68d19c4c9f202ab68d86
|
7
|
+
data.tar.gz: 6551999d9d796f61c9941fe8a120d53b0fcf4e6a59e5bb838c205f1fdc703871bcfaf53ccd9854072c408a7158322a2fed67fb8886d61d82d87d8028c9b970c8
|
data/lib/pass_station/output.rb
CHANGED
@@ -12,7 +12,7 @@ module PassStation
|
|
12
12
|
# Password database handling
|
13
13
|
class DB
|
14
14
|
# Output the data in the chosen format
|
15
|
-
# @param formatter [String] Engine to use to format the data:
|
15
|
+
# @param formatter [String] Engine to use to format the data: `table`, `'pretty-table'`, `JSON`, `CSV`, `YAML`
|
16
16
|
# @param data [Array<CSV::Row>]
|
17
17
|
# @return [Array<String>] formatted output
|
18
18
|
def output(formatter, data)
|
@@ -21,7 +21,7 @@ module PassStation
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# Output the data in the chosen format (list command)
|
24
|
-
# @param formatter [String] Engine to use to format the data:
|
24
|
+
# @param formatter [String] Engine to use to format the data: `table`, `'pretty-table'`, `JSON`, `CSV`, `YAML`
|
25
25
|
# @return [Array<String>] formatted output
|
26
26
|
def output_list(formatter)
|
27
27
|
data_nil?
|
@@ -29,7 +29,7 @@ module PassStation
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# Output the data in the chosen format (search command)
|
32
|
-
# @param formatter [String] Engine to use to format the data:
|
32
|
+
# @param formatter [String] Engine to use to format the data: `table`, `'pretty-table'`, `JSON`, `CSV`, `YAML`
|
33
33
|
# @return [Array<String>] formatted output
|
34
34
|
def output_search(formatter)
|
35
35
|
return [] if @search_result.empty?
|
@@ -68,8 +68,8 @@ module PassStation
|
|
68
68
|
# Simple table formatter
|
69
69
|
class Table
|
70
70
|
class << self
|
71
|
-
# Format the
|
72
|
-
# @param table [Array<CSV::Row>] an
|
71
|
+
# Format the `Array<CSV::Row>` into a simple table with justified columns
|
72
|
+
# @param table [Array<CSV::Row>] an `Array<CSV::Row>`
|
73
73
|
# @return [Array<String>] the formatted table ready to be printed
|
74
74
|
def format(table)
|
75
75
|
out = []
|
@@ -112,7 +112,7 @@ module PassStation
|
|
112
112
|
end
|
113
113
|
|
114
114
|
# Left justify an element of the column
|
115
|
-
# @param row [CSV::Row]
|
115
|
+
# @param row [CSV::Row] `CSV::Row`
|
116
116
|
# @param column [Symbol] the symbol of the column
|
117
117
|
# @param colsizes [Hash] hash containing the column size for each column as returned by {colsizes_count}
|
118
118
|
# @return [String] the justified element
|
@@ -121,7 +121,7 @@ module PassStation
|
|
121
121
|
end
|
122
122
|
|
123
123
|
# Left justify all elements of the column
|
124
|
-
# @param row [CSV::Row]
|
124
|
+
# @param row [CSV::Row] `CSV::Row`
|
125
125
|
# @param colsizes [Hash] hash containing the column size for each column as returned by {colsizes_count}
|
126
126
|
# @return [String] the justified row
|
127
127
|
def justify_row(row, colsizes)
|
@@ -146,8 +146,8 @@ module PassStation
|
|
146
146
|
# Pretty table with ASCII borders formatter
|
147
147
|
class PrettyTable < Table
|
148
148
|
class << self
|
149
|
-
# Format the
|
150
|
-
# @param table [Array<CSV::Row>] an
|
149
|
+
# Format the `Array<CSV::Row>` into a simple table with justified columns
|
150
|
+
# @param table [Array<CSV::Row>] an `Array<CSV::Row>`
|
151
151
|
# @return [Array<String>] the formatted table ready to be printed
|
152
152
|
def format(table)
|
153
153
|
out = []
|
@@ -162,7 +162,7 @@ module PassStation
|
|
162
162
|
end
|
163
163
|
|
164
164
|
# Left justify an element of the column
|
165
|
-
# @param row [CSV::Row]
|
165
|
+
# @param row [CSV::Row] `CSV::Row`
|
166
166
|
# @param column [Symbol] the symbol of the column
|
167
167
|
# @param colsizes [Hash] hash containing the column size for each column as returned by {colsizes_count}
|
168
168
|
# @return [String] the justified element
|
@@ -171,7 +171,7 @@ module PassStation
|
|
171
171
|
end
|
172
172
|
|
173
173
|
# Left justify all elements of the column
|
174
|
-
# @param row [CSV::Row]
|
174
|
+
# @param row [CSV::Row] `CSV::Row`
|
175
175
|
# @param colsizes [Hash] hash containing the column size for each column as returned by {colsizes_count}
|
176
176
|
# @return [String] the justified row
|
177
177
|
def justify_row(row, colsizes)
|
@@ -203,8 +203,8 @@ module PassStation
|
|
203
203
|
# CSV formatter
|
204
204
|
class Csv
|
205
205
|
class << self
|
206
|
-
# Format the
|
207
|
-
# @param table [Array<CSV::Row>] an
|
206
|
+
# Format the `Array<CSV::Row>` into a CSV
|
207
|
+
# @param table [Array<CSV::Row>] an `Array<CSV::Row>`
|
208
208
|
# @return [Array<String>] the formatted CSV ready to be printed
|
209
209
|
def format(table)
|
210
210
|
CSV::Table.new(table).to_csv.split("\n")
|
@@ -215,8 +215,8 @@ module PassStation
|
|
215
215
|
# JSON formatter
|
216
216
|
class Json
|
217
217
|
class << self
|
218
|
-
# Format the
|
219
|
-
# @param table [Array<CSV::Row>] an
|
218
|
+
# Format the `Array<CSV::Row>` into JSON
|
219
|
+
# @param table [Array<CSV::Row>] an `Array<CSV::Row>`
|
220
220
|
# @return [Array<String>] the formatted JSON ready to be printed (only
|
221
221
|
# one element on the array, keep an array for compatibility with
|
222
222
|
# {DB.highlight_found} and homogeneity with other formatters)
|
@@ -229,8 +229,8 @@ module PassStation
|
|
229
229
|
# YAML formatter
|
230
230
|
class Yaml
|
231
231
|
class << self
|
232
|
-
# Format the
|
233
|
-
# @param table [Array<CSV::Row>] an
|
232
|
+
# Format the `Array<CSV::Row>` into YAML
|
233
|
+
# @param table [Array<CSV::Row>] an `Array<CSV::Row>`
|
234
234
|
# @return [Array<String>] the formatted YAML ready to be printed (only
|
235
235
|
# one element on the array, keep an array for compatibility with
|
236
236
|
# {DB.highlight_found} and homogeneity with other formatters)
|
data/lib/pass_station/parse.rb
CHANGED
@@ -23,7 +23,7 @@ module PassStation
|
|
23
23
|
|
24
24
|
# Parse, sort and sanitize the password database
|
25
25
|
# @param sort [Symbol] column name to sort by (columns depends on the database source, see {UPSTREAM_DATABASE})
|
26
|
-
# @return [Array<CSV::Row>] table of
|
26
|
+
# @return [Array<CSV::Row>] table of `CSV::Row`, each row contains multiple
|
27
27
|
# attributes (columns depends on the database source, see {UPSTREAM_DATABASE})
|
28
28
|
def parse(sort = nil)
|
29
29
|
sort ||= UPSTREAM_DATABASE[@database_type][:COLUMNS].first[0]
|
data/lib/pass_station/search.rb
CHANGED
@@ -8,8 +8,8 @@ module PassStation
|
|
8
8
|
# @param term [String] the searched term
|
9
9
|
# @param col [Symbol] the column to search in: column name (columns depends on the database source, see
|
10
10
|
# {UPSTREAM_DATABASE}) or :all (all columns)
|
11
|
-
# @see build_regexp for
|
12
|
-
# @return [Array<CSV::Row>] table of
|
11
|
+
# @see build_regexp for `opts` param description
|
12
|
+
# @return [Array<CSV::Row>] table of `CSV::Row`, each row contains multiple
|
13
13
|
# attributes (columns depends on the database source, see {UPSTREAM_DATABASE})
|
14
14
|
def search(term, col, opts = {})
|
15
15
|
col ||= UPSTREAM_DATABASE[@database_type][:COLUMNS].first[0]
|
data/lib/pass_station/source.rb
CHANGED
@@ -58,7 +58,7 @@ module PassStation
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# Check if an update is available
|
61
|
-
# @return [Boolean]
|
61
|
+
# @return [Boolean] `true` if there is, `false` else.
|
62
62
|
def check_for_update
|
63
63
|
ret_vals = []
|
64
64
|
UPSTREAM_DATABASE[:MAPPING].each do |_k, v|
|
@@ -93,8 +93,8 @@ module PassStation
|
|
93
93
|
# Check if a file match a SHA256 hash
|
94
94
|
# @param file [String] the path of the file.
|
95
95
|
# @param hash [String] tha SHA256 hash to check against.
|
96
|
-
# @return [Boolean] if the hash of the file matched the one provided (
|
97
|
-
# or not (
|
96
|
+
# @return [Boolean] if the hash of the file matched the one provided (`true`)
|
97
|
+
# or not (`false`).
|
98
98
|
def check_hash(file, hash)
|
99
99
|
if !hash.nil? && File.file?(file)
|
100
100
|
computed_h = Digest::SHA256.file(file)
|
@@ -120,9 +120,7 @@ module PassStation
|
|
120
120
|
# @param file_content [String] the content to write in the file
|
121
121
|
# @return [String] destination file path
|
122
122
|
def write_file(destination_file, file_content)
|
123
|
-
File.
|
124
|
-
file.write(file_content)
|
125
|
-
end
|
123
|
+
File.binwrite(destination_file, file_content)
|
126
124
|
destination_file
|
127
125
|
end
|
128
126
|
|
data/lib/pass_station/version.rb
CHANGED
data/lib/pass_station.rb
CHANGED
@@ -16,15 +16,15 @@ module PassStation
|
|
16
16
|
# Password database handling
|
17
17
|
class DB
|
18
18
|
# Get / set storage location, where will be stored the password database.
|
19
|
-
# @return [String] database storage location. Default to
|
19
|
+
# @return [String] database storage location. Default to `data/`.
|
20
20
|
attr_accessor :storage_location
|
21
21
|
|
22
22
|
# Get / set the password database name
|
23
23
|
# @return [String] password database filename. Default to
|
24
|
-
#
|
24
|
+
# `DefaultCreds-Cheat-Sheet.csv`.
|
25
25
|
attr_accessor :database_name
|
26
26
|
|
27
|
-
# Get the password database in
|
27
|
+
# Get the password database in `Array<CSV::Row>` format
|
28
28
|
# @return [Array<CSV::Row>] password database
|
29
29
|
attr_reader :data
|
30
30
|
|
@@ -52,7 +52,7 @@ module PassStation
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# Check if the password database exists
|
55
|
-
# @return [Boolean]
|
55
|
+
# @return [Boolean] `true` if the file exists
|
56
56
|
def database_exists?
|
57
57
|
exists = File.file?(@database_path)
|
58
58
|
raise "Database does not exist: #{@database_path}" unless exists
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pass-station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre ZANNI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -38,138 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.2'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.1.0
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '2.3'
|
51
|
-
type: :development
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 2.1.0
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '2.3'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: commonmarker
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '0.21'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - "~>"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0.21'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: github-markup
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '4.0'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '4.0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: minitest
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '5.12'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '5.12'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: rake
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '13.0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '13.0'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: redcarpet
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '3.5'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '3.5'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: rubocop
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '1.10'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - "~>"
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '1.10'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: webrick
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - "~>"
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '1.7'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '1.7'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: yard
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0.9'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '0.9'
|
173
41
|
description: CLI & library to search for default credentials among thousands of Products
|
174
42
|
/ Vendors
|
175
43
|
email: alexandre.zanni@engineer.com
|
@@ -200,6 +68,7 @@ metadata:
|
|
200
68
|
documentation_uri: https://noraj.github.io/pass-station/yard/
|
201
69
|
homepage_uri: https://noraj.github.io/pass-station/
|
202
70
|
source_code_uri: https://github.com/noraj/pass-station/
|
71
|
+
rubygems_mfa_required: 'true'
|
203
72
|
post_install_message:
|
204
73
|
rdoc_options: []
|
205
74
|
require_paths:
|
@@ -211,14 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
80
|
version: 2.6.0
|
212
81
|
- - "<"
|
213
82
|
- !ruby/object:Gem::Version
|
214
|
-
version: '3.
|
83
|
+
version: '3.2'
|
215
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
85
|
requirements:
|
217
86
|
- - ">="
|
218
87
|
- !ruby/object:Gem::Version
|
219
88
|
version: '0'
|
220
89
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.3.3
|
222
91
|
signing_key:
|
223
92
|
specification_version: 4
|
224
93
|
summary: CLI & library to search for default credentials among thousands of Products
|