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 +4 -4
- data/lib/aws_recon/aws_recon.rb +13 -2
- data/lib/aws_recon/options.rb +7 -0
- data/lib/aws_recon/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2970ade786485b6ca81b67b96b10e70a23b2dc30b8e3ed83928bd019dc2cd00c
|
4
|
+
data.tar.gz: 1d35be082bd390129fb2b2cfaf1147946a0fa8eb80b08c364ea8b84646e527f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b106cc04a9d4a8955794ef3bf7f6a1e79222679105f093ef9edcf2275c2744812367c79db18b55f00d195fb44b1eec4685544277bf728a44786a8812e66846
|
7
|
+
data.tar.gz: 65e41b3d482e6a5598e582c52956f78421c67ad16ea0389bb32435c2e1166f79b1300207881fe5d4a30590dffe3d1bf2eb9692cc191e1584b32482645347a0b2
|
data/lib/aws_recon/aws_recon.rb
CHANGED
@@ -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,
|
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(
|
142
|
+
gzip_data.write(formatted_json)
|
132
143
|
gzip_data.close
|
133
144
|
|
134
145
|
# send it to S3
|
data/lib/aws_recon/options.rb
CHANGED
@@ -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
|
data/lib/aws_recon/version.rb
CHANGED