Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 3240860

Browse files
committed
add csv, json, yaml output
1 parent 3fe1a35 commit 3240860

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

README.md

-5
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,3 @@ Homepage / Documentation: https://sec-it.github.io/pass-station/
4242
## Author
4343

4444
Made by Alexandre ZANNI ([@noraj](https://pwn.by/noraj/)), pentester at [SEC-IT](https://sec-it.fr).
45-
46-
## TODO list / Roadmap:
47-
48-
- [ ] CSV, JSON, YAML output formatter
49-
- [ ] publish on BA & pentoo

lib/pass_station/output.rb

+24
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,29 @@ def headers(colsizes)
200200
protected :dividers, :headers, :justify_row, :justify
201201
end
202202
end
203+
204+
class Csv
205+
class << self
206+
def format(table)
207+
CSV::Table.new(table).to_csv.split("\n")
208+
end
209+
end
210+
end
211+
212+
class Json
213+
class << self
214+
def format(table)
215+
[table.map(&:to_h).to_json]
216+
end
217+
end
218+
end
219+
220+
class Yaml
221+
class << self
222+
def format(table)
223+
[table.map(&:to_h).to_yaml]
224+
end
225+
end
226+
end
203227
end
204228
end

0 commit comments

Comments
 (0)