Skip to content

Commit 72f2b57

Browse files
committed
Land rapid7#4070, fix inverted eicar corruption logic
Fixes rapid7#4068
2 parents 813a2f8 + a9e5243 commit 72f2b57

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/msf/util/exe.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,15 +1931,19 @@ def self.to_executable_fmt_formats
19311931
# EICAR Canary: https://www.metasploit.com/redmine/projects/framework/wiki/EICAR
19321932
#
19331933
def self.is_eicar_corrupted?
1934-
path = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "..", "..", "data", "eicar.com"))
1935-
ret = true
1934+
path = ::File.expand_path(::File.join(
1935+
::File.dirname(__FILE__),"..", "..", "..", "data", "eicar.com")
1936+
)
1937+
return true unless ::File.exists?(path)
1938+
ret = false
19361939
if ::File.exists?(path)
19371940
begin
19381941
data = ::File.read(path)
19391942
unless Digest::SHA1.hexdigest(data) == "3395856ce81f2b7382dee72602f798b642f14140"
1940-
ret = false
1943+
ret = true
19411944
end
19421945
rescue ::Exception
1946+
ret = true
19431947
end
19441948
end
19451949
ret

0 commit comments

Comments
 (0)