aws_recon 0.4.4 → 0.4.5

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: 48ccf03d964fff678dc732fcf74d4dcd9c7c06293845bbb9a4f54e9e1ce61a24
4
- data.tar.gz: 7c39747a7845fe497be052baae41af8ee45014166d97114abb797d5f6c06e5b9
3
+ metadata.gz: 2970ade786485b6ca81b67b96b10e70a23b2dc30b8e3ed83928bd019dc2cd00c
4
+ data.tar.gz: 1d35be082bd390129fb2b2cfaf1147946a0fa8eb80b08c364ea8b84646e527f2
5
5
  SHA512:
6
- metadata.gz: 3b6c26ff3b38dd58c63313b70a609e6b08fe6d16762afb9651bbc81d6cef21d7c46e8b11ad73d40caf0e6abbfd877ef5d5f2fde1536425b70a25afe82b7a4a78
7
- data.tar.gz: a74af8ad1b868895d997110a4688bc88266536ad2187c235ba27a0720e3ccce0d18d6959981ab3e82e40bb738944d1402380761f9c3c65ce33cc1649bfddbc4e
6
+ metadata.gz: a2b106cc04a9d4a8955794ef3bf7f6a1e79222679105f093ef9edcf2275c2744812367c79db18b55f00d195fb44b1eec4685544277bf728a44786a8812e66846
7
+ data.tar.gz: 65e41b3d482e6a5598e582c52956f78421c67ad16ea0389bb32435c2e1166f79b1300207881fe5d4a30590dffe3d1bf2eb9692cc191e1584b32482645347a0b2
@@ -65,6 +65,17 @@ module AwsRecon
65
65
  @resources.concat(collection) if @options.output_file
66
66
  end
67
67
 
68
+ #
69
+ # Format @resources as either
70
+ #
71
+ def formatted_json
72
+ if @options.jsonl
73
+ @resources.map { |r| JSON.generate(r) }.join("\n")
74
+ else
75
+ @resources.to_json
76
+ end
77
+ end
78
+
68
79
  #
69
80
  # main wrapper
70
81
  #
@@ -112,7 +123,7 @@ module AwsRecon
112
123
  if @options.output_file && !@options.s3
113
124
  puts "Saving resources to #{@options.output_file}.\n\n"
114
125
 
115
- File.write(@options.output_file, @resources.to_json)
126
+ File.write(@options.output_file, formatted_json)
116
127
  end
117
128
 
118
129
  # write output file to S3 bucket
@@ -128,7 +139,7 @@ module AwsRecon
128
139
  # build IO object and gzip it
129
140
  io = StringIO.new
130
141
  gzip_data = Zlib::GzipWriter.new(io)
131
- gzip_data.write(@resources.to_json)
142
+ gzip_data.write(formatted_json)
132
143
  gzip_data.close
133
144
 
134
145
  # send it to S3
@@ -20,6 +20,7 @@ class Parser
20
20
  :output_file,
21
21
  :output_format,
22
22
  :threads,
23
+ :jsonl,
23
24
  :collect_user_data,
24
25
  :skip_slow,
25
26
  :skip_credential_report,
@@ -55,6 +56,7 @@ class Parser
55
56
  false,
56
57
  false,
57
58
  false,
59
+ false,
58
60
  false
59
61
  )
60
62
 
@@ -116,6 +118,11 @@ class Parser
116
118
  args.threads = threads.to_i if (0..Parser::MAX_THREADS).include?(threads.to_i)
117
119
  end
118
120
 
121
+ # output NDJSON/JSONL format
122
+ opts.on('-l', '--json-lines', 'Output NDJSON/JSONL format (default: false)') do
123
+ args.jsonl = true
124
+ end
125
+
119
126
  # collect EC2 instance user data
120
127
  opts.on('-u', '--user-data', 'Collect EC2 instance user data (default: false)') do
121
128
  args.collect_user_data = true
@@ -1,3 +1,3 @@
1
1
  module AwsRecon
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_recon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Larsen