Skip to content

Commit

Permalink
add many passwords support
Browse files Browse the repository at this point in the history
  • Loading branch information
noraj committed Nov 11, 2021
1 parent 413a10b commit b327816
Show file tree
Hide file tree
Showing 28 changed files with 2,994 additions and 201 deletions.
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pass-station (1.2.2)
pass-station (1.2.3)
docopt (~> 0.6)
paint (~> 2.2)

Expand Down Expand Up @@ -35,6 +35,7 @@ GEM
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
unicode-display_width (2.1.0)
webrick (1.7.0)
yard (0.9.26)

PLATFORMS
Expand All @@ -50,6 +51,7 @@ DEPENDENCIES
rake (~> 13.0)
redcarpet (~> 3.5)
rubocop (~> 1.10)
webrick (~> 1.7)
yard (~> 0.9)

BUNDLED WITH
Expand Down
51 changes: 29 additions & 22 deletions bin/pass-station
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ require 'docopt'
require 'paint'

doc = <<~DOCOPT
Pass Station
Pass Station v#{PassStation::VERSION}
Usage:
pass-station list [--sort <col> --output <format>] [--debug]
pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--no-color --debug]
pass-station list [--sort <col> --output <format>] [--source <id> --debug]
pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--source <id> --no-color --debug]
pass-station update ([--force] <path> | --check) [--debug]
pass-station -h | --help
pass-station --version
Expand All @@ -24,21 +24,22 @@ doc = <<~DOCOPT
Output options: can be used with list and search commands
-o <format>, --output <format> Output format: JSON, CSV, YAML, table, pretty-table [default: pretty-table]
-s <col>, --sort <col> Sort by column: productvendor | username | password [default: productvendor]
-s <col>, --sort <col> Sort by column (see documentation, columns depends on the database source)
Search options:
--field <col> Search in column: productvendor | username | password | all [default: productvendor]
--field <col> Search in column: column name (see documentation, columns depends on the database source) or all
--sensitive Search is case sensitive (case insensitive by default)
Update options: update the password database (replace Pass Station DB with upstream DB, use with care)
-f, --force Bypass hash checking
-c, --check Check for possible update
Other options:
--no-color Disable colorized output
--debug Display arguments
-h, --help Show this screen
--version Show version
--source <id> Credentials source database: 1 (Default Credentials Cheat Sheet), 2 (Many passwords) [default: 1]
--no-color Disable colorized output
--debug Display arguments
-h, --help Show this screen
--version Show version
DOCOPT

begin
Expand All @@ -47,14 +48,17 @@ begin
pp args if args['--debug']
if args['update']
if args['<path>']
opts = {}
opts[:sha256] = args['--force'] ? nil : PassStation::DB::UPSTREAM_DATABASE[:HASH]
puts '[+] Updating database'
path = PassStation::DB.download_upstream(args['<path>'], opts)
if path
puts "[+] Database updated #{path}"
else
puts '[+] Database already up to date'
PassStation::DB::UPSTREAM_DATABASE[:MAPPING].each do |k, v|
opts = {}
opts[:sha256] = args['--force'] ? nil : PassStation::DB::UPSTREAM_DATABASE[v][:HASH]
puts "[+] Updating database: #{v}"
opts[:source_db] = k
path = PassStation::DB.download_upstream(args['<path>'], opts)
if path
puts "[+] Database updated: #{v} (#{path})"
else
puts "[+] Database #{v} already up to date"
end
end
elsif args['--check']
if PassStation::DB.check_for_update
Expand All @@ -64,13 +68,16 @@ begin
end
end
elsif args['list']
ps = PassStation::DB.new
ps.parse(args['--sort'].to_sym)
db = args['--source'].nil? ? nil : args['--source'].to_i
ps = PassStation::DB.new(db)
args['--sort'].nil? ? ps.parse : ps.parse(args['--sort'].to_sym)
puts ps.output_list(args['--output'])
elsif args['search']
ps = PassStation::DB.new
ps.parse(args['--sort'].to_sym)
ps.search(args['<term>'], args['--field'].to_sym, sensitive: args['--sensitive'])
db = args['--source'].nil? ? nil : args['--source'].to_i
ps = PassStation::DB.new(db)
args['--sort'].nil? ? ps.parse : ps.parse(args['--sort'].to_sym)
field = args['--field'].nil? ? nil : args['--field'].to_sym
ps.search(args['<term>'], field, sensitive: args['--sensitive'])
output = ps.output_search(args['--output'])
puts '[-] No result' if output.empty?
puts ps.highlight_found(args['<term>'], output, args['--sensitive'])
Expand Down
2,561 changes: 2,561 additions & 0 deletions data/many-passwords.csv

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
## [1.2.3 - Unreleased]
## [1.2.3]

Credentials:

- Added [many passwords](https://github.com/many-passwords/many-passwords) source [#14][#14]
- Code needed for multi-source handling
- Update database (new entries) to reflect upstream

Chore:

- Fork: repository move from [sec-it/pass-station](https://github.com/sec-it/pass-station) to [noraj/pass-station](https://github.com/noraj/pass-station)

[#14]:https://github.com/noraj/pass-station/issues/14

## [1.2.2]

- Update database (new entries) to reflect upstream
Expand Down
73 changes: 73 additions & 0 deletions docs/pages/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,76 @@ Edimax,edimax,software01
Edimax,guest,1234
Edimax,guest,<blank>
```

Search among [many-passwords](https://github.com/many-passwords/many-passwords)
instead of [DefaultCreds-cheat-sheet](https://github.com/ihebski/DefaultCreds-cheat-sheet).

```plaintext
$ pass-station search palo --source 2 --output json --no-color | jq
[
{
"vendor": "Palo Alto Networks",
"modelsoftware_name": "GlobalProtect Gateway",
"version": "ANY",
"access_type": "HTTP/CLI",
"username": "admin",
"password": "admin",
"privileges": "Administrator",
"notes": "https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-admin/getting-started/integrate-the-firewall-into-your-management-network/perform-initial-configuration.html"
}
]
```

By default it searches in the `productvendor` column for _DefaultCreds-cheat-sheet_
and in the `vendor` column for _Many passwords_ because searching through all
columns results in too much false positive.
To search through non-default columns use the `--field` parameter.
All available columns can be seen in the [library documentation](https://noraj.github.io/pass-station/yard/PassStation/DB.html).
`--field all` also allow to search through all columns.

```
$ pass-station search cli --source 2 --output json --no-color --field access_type | jq
[
{
"vendor": "Linux Mint",
"modelsoftware_name": "Linux Mint Live session",
"version": "20.2",
"access_type": "Uma/CLI/Login",
"username": "mint",
"password": "<blank>",
"privileges": "user",
"notes": "<blank>"
},
{
"vendor": "MX Linux",
"modelsoftware_name": "MX Linux Live Medium",
"version": "MX-19.4.1",
"access_type": "CLI/Login",
"username": "demo",
"password": "demo",
"privileges": "user",
"notes": "<blank>"
},
{
"vendor": "MX Linux",
"modelsoftware_name": "MX Linux Live Medium",
"version": "MX-19.4.1",
"access_type": "CLI/Login",
"username": "root",
"password": "root",
"privileges": "superuser",
"notes": "<blank>"
},
{
"vendor": "Nortel",
"modelsoftware_name": "Remote Office 9150",
"version": "<blank>",
"access_type": "Client",
"username": "admin",
"password": "root",
"privileges": "Admin",
"notes": "<blank>"
},
...
```

21 changes: 11 additions & 10 deletions docs/pages/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

```plaintext
$ pass-station --help
Pass Station
Pass Station v1.2.2
Usage:
pass-station list [--sort <col> --output <format>] [--debug]
pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--no-color --debug]
pass-station list [--sort <col> --output <format>] [--source <id> --debug]
pass-station search <term> [--field <col> --sort <col> --sensitive --output <format>] [--source <id> --no-color --debug]
pass-station update ([--force] <path> | --check) [--debug]
pass-station -h | --help
pass-station --version
Expand All @@ -17,21 +17,22 @@ List options: list all default credentials
Output options: can be used with list and search commands
-o <format>, --output <format> Output format: JSON, CSV, YAML, table, pretty-table [default: pretty-table]
-s <col>, --sort <col> Sort by column: productvendor | username | password [default: productvendor]
-s <col>, --sort <col> Sort by column (see documentation, columns depends on the database source)
Search options:
--field <col> Search in column: productvendor | username | password | all [default: productvendor]
--sensitive Sarch is case sensitive (case insensitive by default)
--field <col> Search in column: column name (see documentation, columns depends on the database source) or all
--sensitive Search is case sensitive (case insensitive by default)
Update options: update the password database (replace Pass Station DB with upstream DB, use with care)
-f, --force Bypass hash checking
-c, --check Check for possible update
Other options:
--no-color Disable colorized output
--debug Display arguments
-h, --help Show this screen
--version Show version
--source <id> Credentials source database: 1 (Default Credentials Cheat Sheet), 2 (Many passwords) [default: 1]
--no-color Disable colorized output
--debug Display arguments
-h, --help Show this screen
--version Show version
```

## Library
Expand Down
5 changes: 5 additions & 0 deletions docs/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ because it's aggregating the entries of several default credentials lists:
_searchploit for default credentials_ but it was relying on [an online service](https://cirt.net/passwords)
and was lacking of features as well as being unmaintained.

Since v1.2.3, [Pass Station][0] can search through [Many passwords][4]
in additions to [DefaultCreds-cheat-sheet][3], which is enriched with access
type, version, notes, etc.

## General

| Tool | Maintained | Color | CLI | Library | Lang |
Expand Down Expand Up @@ -67,3 +71,4 @@ Legend:
[1]:https://github.com/Viralmaniar/Passhunt
[2]:https://github.com/ihebski/DefaultCreds-cheat-sheet/blob/main/creds
[3]:https://github.com/ihebski/DefaultCreds-cheat-sheet
[4]:https://github.com/many-passwords/many-passwords
2 changes: 1 addition & 1 deletion docs/yard/PassStation.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h3 class="inherited">Constants included
</div>

<div id="footer">
Generated on Fri Jul 30 12:32:47 2021 by
Generated on Thu Nov 11 22:17:30 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
Expand Down
Loading

0 comments on commit b327816

Please sign in to comment.