pass-station 1.0.0 → 1.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b9ea9f62eaff1a5166ac66df8b994d5928173eb1d23fb997f02ca3cbdc5f712
4
- data.tar.gz: 1cb19d830a7b18b49e6317911c5a6ca8411e0641921d2471749bc2f81c64cb12
3
+ metadata.gz: 7ec0b0404526c7b3184c441897083e2024404e7f22b4ac2851292d81f69cda25
4
+ data.tar.gz: b27776bfc51827851cc6ef60ce4c378f0fa9ec923f104109abb66733df5ba5d3
5
5
  SHA512:
6
- metadata.gz: 89a6526c063b14e47d3316b6bb544396a03fd95e98fe488d366061e4837bb0e3b3994e2d402381d11fb5a2831479d2efa3ce252f168b85a5bb200939ff1ddb98
7
- data.tar.gz: bec11f0af9253d0d54c05192aa6544e335d502b0d8cf00296c6a3a7b4473bb3e9352ac942a102e5c6d2d3b4380132fb50fb6fe1340b2a9129df5d93cc7ee47f9
6
+ metadata.gz: 26891a1b483d324034656b3921dc2684938972ce18f6f39d7746f6aaa3f387bcff6fb4964a45160c87c98f6bdaaf26eb93f0ccc935f8573867cc4fa63f345bad
7
+ data.tar.gz: 6728d55a675019cd612162b1f5c10f142a0f14008429984681fa3c939422c8ebf0ebdab0afb08d85cb5e3678a2e2e4a743771b24a2645be24c591bf94b0f89f5
data/bin/pass-station CHANGED
@@ -28,7 +28,7 @@ doc = <<~DOCOPT
28
28
 
29
29
  Search options:
30
30
  --field <col> Search in column: productvendor | username | password | all [default: productvendor]
31
- --sensitive Sarch is case sensitive (case insensitive by default)
31
+ --sensitive Search is case sensitive (case insensitive by default)
32
32
 
33
33
  Update options: update the password database (replace Pass Station DB with upstream DB, use with care)
34
34
  -f, --force Bypass hash checking
@@ -72,6 +72,7 @@ begin
72
72
  ps.parse(args['--sort'].to_sym)
73
73
  ps.search(args['<term>'], args['--field'].to_sym, sensitive: args['--sensitive'])
74
74
  output = ps.output_search(args['--output'])
75
+ puts '[-] No result' if output.empty?
75
76
  puts ps.highlight_found(args['<term>'], output, args['--sensitive'])
76
77
  end
77
78
  rescue Docopt::Exit => e
@@ -4,4 +4,4 @@
4
4
  require 'pass_station'
5
5
  require 'irb'
6
6
 
7
- IRB.start(__FILE__)
7
+ IRB.start(__FILE__)
@@ -68,6 +68,9 @@ Addon,admin,admin
68
68
  AddPac Technology,root,router
69
69
  ADIC,admin,password
70
70
  ADIC,admin,secure
71
+ ADIP,adip,admin
72
+ ADIP,adip,consul
73
+ ADIP,adip,insta
71
74
  Adobe,admin,admin
72
75
  Adobe,anonymous,anonymous
73
76
  Adobe,aparker@geometrixx.info,aparker
@@ -533,6 +536,7 @@ CA APM Team Center (web),Guest,Guest
533
536
  Cable And Wireless,admin,1234
534
537
  Cabletron,<blank>,<blank>
535
538
  Cabletron,netman,<blank>
539
+ caldera,admin,admin
536
540
  CA NetQoS (web),nqadmin,nq
537
541
  CA NetQoS (web),nquser,nq
538
542
  Canon,<blank>,0
@@ -552,6 +556,7 @@ CCH (mssql),sa,PracticeUser1
552
556
  Celerity,mediator,mediator
553
557
  Celerity,root,Mua'dib
554
558
  Cellit,cellit,cellit
559
+ Centreon WebUI,admin,centreon
555
560
  Ceragon Networks,root,tooridu
556
561
  CGI World,<blank>,protection
557
562
  Chase Research,<blank>,iolan
@@ -694,6 +699,8 @@ cuproplus,<blank>,<blank>
694
699
  cyberguard,cgadmin,cgadmin
695
700
  Cyberguard,cgadmin,cgadmin
696
701
  CyberMax,<blank>,Congress
702
+ CyberPower,cyber,cyber
703
+ CyberPower,device,cyber
697
704
  Cyclades,root,<blank>
698
705
  Cyclades,root,tslinux
699
706
  Cyclades,super,surt
@@ -1022,6 +1029,7 @@ Gericom,Administrator,<blank>
1022
1029
  "GE Security,Inc.",install,install
1023
1030
  giga,Administrator,admin
1024
1031
  Gigabyte,admin,admin
1032
+ GigaFiber,admin,jiocentrum
1025
1033
  glftpd,glftpd,glftpd
1026
1034
  glFtpD,glftpd,glftpd
1027
1035
  Globespan Virata,DSL,DSL
@@ -1421,6 +1429,7 @@ Jenkins (web),<blank>,<blank>
1421
1429
  Jetform,Jetform,<blank>
1422
1430
  JetWay,<blank>,spooml
1423
1431
  JioFi,administrator,administrator
1432
+ JioFiber,admin,jiocentrum
1424
1433
  Johnson Controls,johnson,control
1425
1434
  Joss Technology,<blank>,57gbzb
1426
1435
  Joss Technology,<blank>,technolgi
@@ -1749,6 +1758,7 @@ Netgear,Gearguy,Geardog
1749
1758
  Netgear,super,5777364
1750
1759
  Netgear,superman,21241036
1751
1760
  NetGenesis,naadmin,naadmin
1761
+ NETIO 4All PowerPDU,admin,admin
1752
1762
  Netopia,admin,<blank>
1753
1763
  Netopia,admin,noway
1754
1764
  Netopia,<blank>,<blank>
@@ -1958,6 +1968,7 @@ OpenMarket,user_expert,demo
1958
1968
  OpenMarket,user_marketer,demo
1959
1969
  OpenMarket,user_pricer,demo
1960
1970
  OpenMarket,user_publisher,demo
1971
+ OpenNetAdmin,admin,admin
1961
1972
  OPEN Networks,root,0P3N
1962
1973
  Openwave,cac_admin,cacadmin
1963
1974
  Openwave,sys,uplink
@@ -3114,6 +3125,7 @@ vacron (web),admin,admin
3114
3125
  Various,root,admin
3115
3126
  VASCO,admin,<blank>
3116
3127
  VBrick Systems,admin,admin
3128
+ vectr,admin,11_ThisIsTheFirstPassword_11
3117
3129
  Veramark,admin,password
3118
3130
  Verifone,<blank>,166816
3119
3131
  Verilink,<blank>,<blank>
data/lib/pass_station.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Ruby internal
4
+ require 'pathname'
3
5
  # Project internal
4
6
  require 'pass_station/source'
5
7
  require 'pass_station/parse'
@@ -15,8 +17,6 @@ module PassStation
15
17
  class DB
16
18
  # Get / set storage location, where will be stored the password database.
17
19
  # @return [String] database storage location. Default to +data/+.
18
- # @example
19
- # PassStation.storage_location = '/srv/downloads/'
20
20
  attr_accessor :storage_location
21
21
 
22
22
  # Get / set the password database name
@@ -24,15 +24,15 @@ module PassStation
24
24
  # +DefaultCreds-Cheat-Sheet.csv+.
25
25
  attr_accessor :database_name
26
26
 
27
- # Get the password database in +CSV::Table+ format
28
- # @return [CSV::Table] pasword database
27
+ # Get the password database in +Array<CSV::Row>+ format
28
+ # @return [Array<CSV::Row>] pasword database
29
29
  attr_reader :data
30
30
 
31
31
  # A new instance of Pass Station
32
32
  def initialize
33
33
  @storage_location = 'data/'
34
34
  @database_name = 'DefaultCreds-Cheat-Sheet.csv'
35
- @database_path = @storage_location + @database_name
35
+ @database_path = absolute_db_path
36
36
  database_exists?
37
37
  @config = {}
38
38
  csv_config
@@ -40,6 +40,14 @@ module PassStation
40
40
  @search_result = []
41
41
  end
42
42
 
43
+ # Find the absolute path of the DB from its relative location
44
+ # @return [String] absolute filename of the DB
45
+ def absolute_db_path
46
+ pn = Pathname.new(__FILE__)
47
+ install_dir = pn.dirname.parent.to_s + Pathname::SEPARATOR_LIST
48
+ install_dir + @storage_location + @database_name
49
+ end
50
+
43
51
  # Check if the password database exists
44
52
  # @return [Boolean] +true+ if the file exists
45
53
  def database_exists?
@@ -49,6 +57,6 @@ module PassStation
49
57
  exists
50
58
  end
51
59
 
52
- protected :database_exists?
60
+ protected :database_exists?, :absolute_db_path
53
61
  end
54
62
  end
@@ -13,7 +13,7 @@ module PassStation
13
13
  class DB
14
14
  # Output the data in the chosen format
15
15
  # @param formatter [String] Engine to use to format the data: +table+, +'pretty-table'+, +JSON+, +CSV+, +YAML+
16
- # @param data [CSV::Table]
16
+ # @param data [Array<CSV::Row>]
17
17
  # @return [Array<String>] formatted output
18
18
  def output(formatter, data)
19
19
  # Convert string to class
@@ -32,7 +32,7 @@ module PassStation
32
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
- return '[-] No result' if @search_result.empty?
35
+ return [] if @search_result.empty?
36
36
 
37
37
  output(formatter, @search_result)
38
38
  end
@@ -68,8 +68,8 @@ module PassStation
68
68
  # Simple table formatter
69
69
  class Table
70
70
  class << self
71
- # Format the +CSV::Table+ into a simple table with justified columns
72
- # @param table [CSV::Table] a +CSV::Table+
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 = []
@@ -82,7 +82,7 @@ module PassStation
82
82
  end
83
83
 
84
84
  # Calculate column size (max item size)
85
- # @param table [CSV::Table]
85
+ # @param table [Array<CSV::Row>]
86
86
  # @param column [Symbol] the symbol of the column
87
87
  # @return [Integer] the column size
88
88
  def colsize_count(table, column)
@@ -90,7 +90,7 @@ module PassStation
90
90
  end
91
91
 
92
92
  # Calculate the size of all columns (max item size)
93
- # @param table [CSV::Table]
93
+ # @param table [Array<CSV::Row>]
94
94
  # @return [Hash] keys are columns name, values are columns size
95
95
  def colsizes_count(table)
96
96
  colsizes = table.first.to_h.keys.each_with_object({}) do |c, h|
@@ -147,8 +147,8 @@ module PassStation
147
147
  # Pretty table with ASCII borders formatter
148
148
  class PrettyTable < Table
149
149
  class << self
150
- # Format the +CSV::Table+ into a simple table with justified columns
151
- # @param table [CSV::Table] a +CSV::Table+
150
+ # Format the +Array<CSV::Row>+ into a simple table with justified columns
151
+ # @param table [Array<CSV::Row>] an +Array<CSV::Row>+
152
152
  # @return [Array<String>] the formatted table ready to be printed
153
153
  def format(table)
154
154
  out = []
@@ -200,5 +200,45 @@ module PassStation
200
200
  protected :dividers, :headers, :justify_row, :justify
201
201
  end
202
202
  end
203
+
204
+ # CSV formatter
205
+ class Csv
206
+ class << self
207
+ # Format the +Array<CSV::Row>+ into a CSV
208
+ # @param table [Array<CSV::Row>] an +Array<CSV::Row>+
209
+ # @return [Array<String>] the formatted CSV ready to be printed
210
+ def format(table)
211
+ CSV::Table.new(table).to_csv.split("\n")
212
+ end
213
+ end
214
+ end
215
+
216
+ # JSON formatter
217
+ class Json
218
+ class << self
219
+ # Format the +Array<CSV::Row>+ into JSON
220
+ # @param table [Array<CSV::Row>] an +Array<CSV::Row>+
221
+ # @return [Array<String>] the formatted JSON ready to be printed (only
222
+ # one element on the array, keep an array for compatibility with
223
+ # {highlight_found} and homogeneity with other formatters)
224
+ def format(table)
225
+ [table.map(&:to_h).to_json]
226
+ end
227
+ end
228
+ end
229
+
230
+ # YAML formatter
231
+ class Yaml
232
+ class << self
233
+ # Format the +Array<CSV::Row>+ into YAML
234
+ # @param table [Array<CSV::Row>] an +Array<CSV::Row>+
235
+ # @return [Array<String>] the formatted YAML ready to be printed (only
236
+ # one element on the array, keep an array for compatibility with
237
+ # {highlight_found} and homogeneity with other formatters)
238
+ def format(table)
239
+ [table.map(&:to_h).to_yaml]
240
+ end
241
+ end
242
+ end
203
243
  end
204
244
  end
@@ -23,10 +23,10 @@ module PassStation
23
23
 
24
24
  # Parse, sort and sanitize the password database
25
25
  # @param sort [Symbol] column name to sort by: +:productvendor+, +:username+, +:password+
26
- # @return [CSV::Table] table of +CSV::Row+, each row contains three
26
+ # @return [Array<CSV::Row>] table of +CSV::Row+, each row contains three
27
27
  # attributes: :productvendor, :username, :password
28
28
  def parse(sort = :productvendor)
29
- @data = CSV.table(@database_path, @config).sort_by do |s|
29
+ @data = CSV.table(@database_path, **@config).sort_by do |s|
30
30
  s[sort].downcase
31
31
  end
32
32
  end
@@ -8,7 +8,7 @@ module PassStation
8
8
  # @param term [String] the searched term
9
9
  # @param col [Symbol] the column to search in: :productvendor | :username | :password | :all (all columns)
10
10
  # @see build_regexp for +opts+ param description
11
- # @return [CSV::Table] table of +CSV::Row+, each row contains three
11
+ # @return [Array<CSV::Row>] table of +CSV::Row+, each row contains three
12
12
  # attributes: :productvendor, :username, :password
13
13
  def search(term, col, opts = {})
14
14
  r1 = prepare_search(term, opts)
@@ -10,7 +10,7 @@ module PassStation
10
10
  class DB
11
11
  UPSTREAM_DATABASE = {
12
12
  URL: 'https://raw.githubusercontent.com/ihebski/DefaultCreds-cheat-sheet/main/DefaultCreds-Cheat-Sheet.csv',
13
- HASH: 'de6a9f7e7ac94fbcd142ec5817efb71d3a0027076266c87ead5158a4960ec708'
13
+ HASH: '2107f3105bcc1a218a646beac6f92e2e8c639fac1f3f3e4a3da76b3d14a40dc8'
14
14
  }.freeze
15
15
 
16
16
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '1.0.0'
5
- end
4
+ VERSION = '1.2.2'
5
+ end
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.0.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -193,17 +193,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
193
  requirements:
194
194
  - - ">="
195
195
  - !ruby/object:Gem::Version
196
- version: 2.4.0
196
+ version: 2.6.0
197
197
  - - "<"
198
198
  - !ruby/object:Gem::Version
199
- version: '3.0'
199
+ version: '3.1'
200
200
  required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  requirements:
202
202
  - - ">="
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  requirements: []
206
- rubygems_version: 3.1.4
206
+ rubygems_version: 3.2.15
207
207
  signing_key:
208
208
  specification_version: 4
209
209
  summary: CLI & library to search for default credentials among thousands of Products