Skip to content

Commit 8b9661d

Browse files
committed
Land rapid7#7262, FLUSHALL support for redis/file_upload
2 parents 219f643 + b0e4534 commit 8b9661d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/auxiliary/scanner/redis/file_upload.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def initialize(info = {})
4040
[
4141
OptPath.new('LocalFile', [false, 'Local file to be uploaded']),
4242
OptString.new('RemoteFile', [false, 'Remote file path']),
43-
OptBool.new('DISABLE_RDBCOMPRESSION', [true, 'Disable compression when saving if found to be enabled', true])
43+
OptBool.new('DISABLE_RDBCOMPRESSION', [true, 'Disable compression when saving if found to be enabled', true]),
44+
OptBool.new('FLUSHALL', [true, 'Run flushall to remove all redis data before saving', false])
4445
]
4546
)
4647
end
@@ -83,6 +84,13 @@ def send_file(path, content)
8384
end
8485
end
8586

87+
if datastore['FLUSHALL']
88+
data = redis_command('FLUSHALL')
89+
unless data.include?('+OK')
90+
print_warning("#{peer} -- failed to flushall(); continuing")
91+
end
92+
end
93+
8694
# set a key in this db that contains our content
8795
# XXX: this does not work well (at all) if the content we are uploading is
8896
# multiline. It also probably doesn't work well if the content isn't

0 commit comments

Comments
 (0)