pass-station 1.2.2 → 1.4.0

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: 7ec0b0404526c7b3184c441897083e2024404e7f22b4ac2851292d81f69cda25
4
- data.tar.gz: b27776bfc51827851cc6ef60ce4c378f0fa9ec923f104109abb66733df5ba5d3
3
+ metadata.gz: dce80d32341aedab22c054f5bba662411df09d1d585e8e7988fcbc6cb7a14a6c
4
+ data.tar.gz: cc71183091fed6f3766f7d4390973ecc869022a8760ebd8706d837066f240610
5
5
  SHA512:
6
- metadata.gz: 26891a1b483d324034656b3921dc2684938972ce18f6f39d7746f6aaa3f387bcff6fb4964a45160c87c98f6bdaaf26eb93f0ccc935f8573867cc4fa63f345bad
7
- data.tar.gz: 6728d55a675019cd612162b1f5c10f142a0f14008429984681fa3c939422c8ebf0ebdab0afb08d85cb5e3678a2e2e4a743771b24a2645be24c591bf94b0f89f5
6
+ metadata.gz: 6b48de95b152bcb493551c380390d528de04d61e36123d06d5ec62f2cc3bafd987ec8e411f8b10ef109b1ec116f08375f367da20860ee79813cf92a866d9efad
7
+ data.tar.gz: b5b30dc1e5885101617d0d893286d6b1086672fc8fd01d2a2767336f37c5d96551d76366897d3193d8e9828ac57fbc7333504895f7b661f30a44210ddfa6d229
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  MIT License
2
2
 
3
+ Copyright (c) 2021 Alexandre ZANNI
3
4
  Copyright (c) 2021 Alexandre ZANNI at SEC-IT
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
19
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
+ SOFTWARE.
data/bin/pass-station CHANGED
@@ -11,11 +11,11 @@ require 'docopt'
11
11
  require 'paint'
12
12
 
13
13
  doc = <<~DOCOPT
14
- Pass Station
14
+ Pass Station v#{PassStation::VERSION}
15
15
 
16
16
  Usage:
17
- pass-station list [--sort <col> --output <format>] [--debug]
18
- pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--no-color --debug]
17
+ pass-station list [--sort <col> --output <format>] [--source <id> --debug]
18
+ pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--source <id> --no-color --debug]
19
19
  pass-station update ([--force] <path> | --check) [--debug]
20
20
  pass-station -h | --help
21
21
  pass-station --version
@@ -24,10 +24,10 @@ doc = <<~DOCOPT
24
24
 
25
25
  Output options: can be used with list and search commands
26
26
  -o <format>, --output <format> Output format: JSON, CSV, YAML, table, pretty-table [default: pretty-table]
27
- -s <col>, --sort <col> Sort by column: productvendor | username | password [default: productvendor]
27
+ -s <col>, --sort <col> Sort by column (see documentation, columns depends on the database source)
28
28
 
29
29
  Search options:
30
- --field <col> Search in column: productvendor | username | password | all [default: productvendor]
30
+ --field <col> Search in column: column name (see documentation, columns depends on the database source) or all
31
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)
@@ -35,10 +35,11 @@ doc = <<~DOCOPT
35
35
  -c, --check Check for possible update
36
36
 
37
37
  Other options:
38
- --no-color Disable colorized output
39
- --debug Display arguments
40
- -h, --help Show this screen
41
- --version Show version
38
+ --source <id> Credentials source database: 1 (Default Credentials Cheat Sheet), 2 (Many passwords) [default: 1]
39
+ --no-color Disable colorized output
40
+ --debug Display arguments
41
+ -h, --help Show this screen
42
+ --version Show version
42
43
  DOCOPT
43
44
 
44
45
  begin
@@ -47,14 +48,17 @@ begin
47
48
  pp args if args['--debug']
48
49
  if args['update']
49
50
  if args['<path>']
50
- opts = {}
51
- opts[:sha256] = args['--force'] ? nil : PassStation::DB::UPSTREAM_DATABASE[:HASH]
52
- puts '[+] Updating database'
53
- path = PassStation::DB.download_upstream(args['<path>'], opts)
54
- if path
55
- puts "[+] Database updated #{path}"
56
- else
57
- puts '[+] Database already up to date'
51
+ PassStation::DB::UPSTREAM_DATABASE[:MAPPING].each do |k, v|
52
+ opts = {}
53
+ opts[:sha256] = args['--force'] ? nil : PassStation::DB::UPSTREAM_DATABASE[v][:HASH]
54
+ puts "[+] Updating database: #{v}"
55
+ opts[:source_db] = k
56
+ path = PassStation::DB.download_upstream(args['<path>'], opts)
57
+ if path
58
+ puts "[+] Database updated: #{v} (#{path})"
59
+ else
60
+ puts "[+] Database #{v} already up to date"
61
+ end
58
62
  end
59
63
  elsif args['--check']
60
64
  if PassStation::DB.check_for_update
@@ -64,13 +68,16 @@ begin
64
68
  end
65
69
  end
66
70
  elsif args['list']
67
- ps = PassStation::DB.new
68
- ps.parse(args['--sort'].to_sym)
71
+ db = args['--source'].nil? ? nil : args['--source'].to_i
72
+ ps = PassStation::DB.new(db)
73
+ args['--sort'].nil? ? ps.parse : ps.parse(args['--sort'].to_sym)
69
74
  puts ps.output_list(args['--output'])
70
75
  elsif args['search']
71
- ps = PassStation::DB.new
72
- ps.parse(args['--sort'].to_sym)
73
- ps.search(args['<term>'], args['--field'].to_sym, sensitive: args['--sensitive'])
76
+ db = args['--source'].nil? ? nil : args['--source'].to_i
77
+ ps = PassStation::DB.new(db)
78
+ args['--sort'].nil? ? ps.parse : ps.parse(args['--sort'].to_sym)
79
+ field = args['--field'].nil? ? nil : args['--field'].to_sym
80
+ ps.search(args['<term>'], field, sensitive: args['--sensitive'])
74
81
  output = ps.output_search(args['--output'])
75
82
  puts '[-] No result' if output.empty?
76
83
  puts ps.highlight_found(args['<term>'], output, args['--sensitive'])